You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Stop a locally running FastAPI server before starting the Compose backend because both use port `8000`.
77
77
78
-
**Note**: The first time you start the stack, it might take a minute to be ready while the backend waits for the database and configures everything. To monitor it, use `docker compose logs`, or `docker compose logs backend` for the backend service.
78
+
**Note**: The first time you start the stack, it might take a minute for all the services to be ready. To monitor it, use `docker compose logs`, or `docker compose logs backend` for the backend service.
79
79
80
80
## Mailcatcher
81
81
82
82
Mailcatcher captures emails sent during local development instead of delivering them. The local backend connects to it at `localhost:1025`, and the Compose backend connects to the `mailcatcher` service. Captured emails are available at <http://localhost:1080>.
83
83
84
-
## Docker Compose in `localhost.tiangolo.com`
85
-
86
-
When you start the Docker Compose stack, it uses `localhost` by default, with different ports for each service (backend, adminer, etc).
87
-
88
-
When you deploy it to production (or staging), the application uses one domain. The frontend is served at `/` and the API lives under `/api`.
89
-
90
-
In the guide about [deployment](deployment.md) you can read about Traefik, the configured proxy. That's the component in charge of transmitting traffic to the application service based on the domain.
91
-
92
-
If you want to test that it's all working locally, you can edit the local `.env` file, and change:
93
-
94
-
```dotenv
95
-
DOMAIN=localhost.tiangolo.com
96
-
```
97
-
98
-
That will be used by the Docker Compose files to configure the base domain for the services.
99
-
100
-
Traefik will transmit application traffic at `localhost.tiangolo.com` to FastAPI, which serves both the frontend and API.
101
-
102
-
The domain `localhost.tiangolo.com` is a special domain that is configured (with all its subdomains) to point to `127.0.0.1`. This way you can use that for your local development.
103
-
104
-
After you update it, run again:
105
-
106
-
```bash
107
-
docker compose watch
108
-
```
109
-
110
-
Traefik is included in the main Docker Compose file. The development overrides expose its local dashboard so you can inspect the routes used with `localhost.tiangolo.com`.
111
-
112
84
## Docker Compose files and env vars
113
85
114
86
There is a main `compose.yml` file with all the configurations that apply to the whole stack, it is used automatically by `docker compose`.
@@ -119,8 +91,6 @@ The `compose.deploy.yml` file contains the deployment-specific settings, includi
119
91
120
92
The backend reads local settings from the `.env` file. Docker Compose also uses it for variable interpolation and passes the settings each container needs.
121
93
122
-
They also use some additional configurations taken from environment variables set in the scripts before calling the `docker compose` command.
123
-
124
94
After changing variables, make sure you restart the stack:
0 commit comments