diff options
| author | Santo Cariotti <santo@dcariotti.me> | 2022-09-18 09:21:14 +0000 |
|---|---|---|
| committer | Santo Cariotti <santo@dcariotti.me> | 2022-09-18 09:21:14 +0000 |
| commit | fa7ca7224a16a1106c7a2fb30e14616ab283c177 (patch) | |
| tree | 3cf9700f7ef1a393ba085f37898f805690b9faab | |
| parent | 3aae8ec6da9c1a1a5dffb4e8cd2ffc2560e5b9f1 (diff) | |
Add deploy guide
| -rw-r--r-- | README.md | 55 |
1 files changed, 55 insertions, 0 deletions
@@ -20,3 +20,58 @@ UPLOADS_ENDPOINT="/uploads" RUST_LOG=verden=debug,tower_http=debug ALLOWED_HOST=localhost:3000 ``` + +# Deploy + +This is a guide for a good deploy on a [Dokku](https://dokku.me) server, which +deploys Verden on port 9090. + +Dockerfile defines a `DATABASE_URL` argument by default cause `sqlx` dependence +but, if you define the environment variabile, it will use the one you defined on +`dokku config`. + +1. Log into the server and create a new app + ``` + dokku apps:create verden-api + ``` +2. Create the database and link it to the app. `DATABASE_URL` automatically set + ``` + dokku postgres:create verden-api # Database has got the same app name + dokku postgres:link verden-api verden-api + ``` +3. Create a storage where uploads will be located + ``` + mkdir -p /var/lib/dokku/data/storage/verden-api/uploads/ + dokku storage:mount verden-api /var/lib/dokku/data/storage/verden-api/uploads:/storage/uploads + ``` +4. Set config vars + ``` + dokku config:set verden-api JWT_SECRET=foobar + dokku config:set verden-api PAGE_LIMIT=20 + dokku config:set verden-api SAVE_FILE_BASE_PATH=/storage/uploads + dokku config:set verden-api UPLOADS_ENDPOINT=/uploads + dokku config:set verden-api RUST_LOG=verden=debug,tower_http=debug + dokku config:set verdena-pi ALLOWED_HOST=0.0.0.0:9090 + ``` +5. Fix ports for HTTP + ``` + dokku proxy:ports-add verden-api http:80:9090 + dokku proxy:ports-remove verden-api http:9090:9090 + ``` +6. Add a remote and push this code + ``` + git remote add dokku dokku_user@your_server:verden-api + git push dokku main + ``` +7. Install [Let's Encrypt](https://github.com/dokku/dokku-letsencrypt) + ``` + sudo dokku plugin:install https://github.com/dokku/dokku-letsencrypt.git + dokku config:set --no-restart verden-api DOKKU_LETSENCRYPT_EMAIL=your_email + dokku letsencrypt:enable verden-api + ``` +8. Log in the app and run migrate + ``` + dokku enter verden-api + sqlx migrate run + ``` +9. Enjoy Verden at `https://verden-api.<your-server>` |
