Skip to content

Commit fb752e9

Browse files
drorganvidezclaude
andcommitted
docs(deployment): the production stack no longer publishes app or database
Only nginx binds a host port now, so the deployment page says which containers are reachable from outside and how to get a database client into an incident without publishing 3306. The troubleshooting entry for "address already in use" on 3306 is scoped to the development stack, which is the only one that publishes it. The SECRET_KEY warning stops telling the reader to add a line the example file was missing -- the line is in the file now -- and explains the failure instead. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
1 parent d0c56af commit fb752e9

2 files changed

Lines changed: 15 additions & 10 deletions

File tree

deployment/deployment_in_server.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,18 +56,14 @@ Note that `WORKING_DIR` is `/workspace/`. That is the `WORKDIR` of every image u
5656
path the application and the Rosemary CLI resolve is built from it. Do not change it.
5757

5858
{: .warning-title }
59-
> <i class="fa-solid fa-key"></i> Add a `SECRET_KEY` — the example file does not include one
59+
> <i class="fa-solid fa-key"></i> `SECRET_KEY` is not optional here
6060
>
61-
> `.env.docker.production.example` has no `SECRET_KEY` line, but with `FLASK_ENV=production` the framework's
62-
> `ProductionConfig` raises `RuntimeError: SECRET_KEY environment variable must be set in production.` as soon
63-
> as the application is created. Both the entrypoint's `flask db upgrade` and Gunicorn's import of `app:app`
64-
> create the application, so without this variable the `web` container exits at boot. Append a line to `.env`:
61+
> With `FLASK_ENV=production` the framework's `ProductionConfig` raises
62+
> `RuntimeError: SECRET_KEY environment variable must be set in production.` as soon as the application is
63+
> created. Both the entrypoint's `flask db upgrade` and Gunicorn's import of `app:app` create the application,
64+
> so leaving it as `<CHANGE_THIS>`-and-forgotten makes the `web` container exit at boot with that traceback.
6565
>
66-
> ```
67-
> SECRET_KEY=<CHANGE_THIS>
68-
> ```
69-
>
70-
> and set it to a long random value, for example the output of
66+
> Set it to a long random value, for example the output of
7167
> `python -c "import secrets; print(secrets.token_hex(32))"`.
7268
7369
{: .important-title }
@@ -154,6 +150,12 @@ There is no `--build` here: the image is pulled, not built.
154150
This brings up four containers: `web_app_container` (the application, served by Gunicorn on port 5000),
155151
`mariadb_container`, `nginx_web_server_container` (listening on port 80) and `watchtower_container`.
156152

153+
Only nginx publishes a port to the host. Gunicorn and MariaDB are reachable by service name on the
154+
compose network and nowhere else, so every request reaches the application through the proxy and the
155+
database is never exposed to the outside. If you need a database client during an incident, go
156+
through the container — `docker exec -it mariadb_container mariadb -u root -p` — rather than
157+
publishing 3306.
158+
157159
If you want to serve over HTTPS, use the SSL variant instead, which adds Certbot and exposes port 443. Replace
158160
`<your_dockerhub_name>` in `docker/docker-compose.prod.ssl.yml` the same way:
159161

troubleshooting/docker.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ permalink: /troubleshooting/docker
1818

1919
This occurs because there is already a process on port 3306 (typically because MariaDB has been installed manually).
2020

21+
It only affects the development stack, which publishes 3306 on the host so you can point a database client at it.
22+
The production compose files do not publish that port at all, so they cannot collide with a local MariaDB.
23+
2124
### Identify the process using port 3306
2225

2326
```

0 commit comments

Comments
 (0)