Skip to content

Commit cef7d34

Browse files
committed
docs(quick-start): use .env.production for upload + explain shared symlink flow
1 parent 2e205fd commit cef7d34

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

website/src/content/docs/docs/quick-start.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,13 +97,25 @@ If anything is red, fix it before deploying.
9797

9898
## 4. Upload secrets
9999

100-
If your app reads from `.env`, push it once:
100+
Most apps need environment variables in production — database URLs, API keys, signing secrets. Keep them in a local file (do **not** commit it) and push it to the server once:
101101

102102
```bash
103-
npx shipnode env
103+
npx shipnode env --file .env.production
104104
```
105105

106-
The file lands at `<deployPath>/shared/.env` and is symlinked into every release. PM2 picks up changes on the next `restart` or `deploy` (both use `--update-env`).
106+
What this does, step by step:
107+
108+
1. **Reads `.env.production`** from your project root locally.
109+
2. **SSHes into the server** using the host + user from `shipnode.config.ts`.
110+
3. **Writes the file to `<deployPath>/shared/.env`** — outside any release directory, owned by the deploy user, `chmod 600`.
111+
4. Every current and future release gets `.env` **symlinked in** from `shared/.env`, so all releases share the same env without you redeploying when a value changes.
112+
5. **PM2 picks up new values** on the next `shipnode restart` or `shipnode deploy` (both pass `--update-env`).
113+
114+
This separation matters: secrets live in `shared/`, code lives in `releases/<timestamp>/`. Rolling back a release does **not** roll back your secrets, and rotating a secret does **not** require a redeploy.
115+
116+
:::tip
117+
If you only have one env file called `.env`, you can omit `--file` and shipnode will use whatever the `env` block in `shipnode.config.ts` points at.
118+
:::
107119

108120
## 5. Deploy
109121

0 commit comments

Comments
 (0)