DIGIALOCEAN.md (1820B)
1 # Digitalocean deployment 2 3 Build instructions for Digital Ocean. 4 5 Estimated monthly: 6 * App cost: $17.00 (2x$5 services + $7 PostgreSQL db) 7 * Managed external db: $15 8 * Droplet (incl. db, app services): $6 9 10 https://www.digitalocean.com/pricing 11 12 ## Build and push images 13 14 1 - Prepare build environment (variables are fixed during "vite build" step): 15 16 ```bash 17 export VITE_APP_DOC_TITLE='My title' 18 # use NODE_ENV=prod to exclude the `devDependencies` (e.g., vite) 19 export NODE_ENV=dev 20 ``` 21 22 2 - Build frontend and push: 23 24 ```bash 25 # https://cloud.digitalocean.com/account/api/tokens 26 podman login registry.digitalocean.com/myheats 27 28 buildah bud --no-cache \ 29 --build-arg="VITE_APP_DOC_TITLE=$VITE_APP_DOC_TITLE" \ 30 --build-arg="NODE_ENV=$NODE_ENV" \ 31 --network=slirp4netns \ 32 -t registry.digitalocean.com/myheats/myheats:latest . 33 34 buildah push registry.digitalocean.com/myheats/myheats:latest 35 ``` 36 37 3 - Build backend/api and push: 38 39 ```bash 40 # https://code.in0rdr.ch/nomad/file/docker/docker-myheats-api/Dockerfile.html 41 buildah bud --no-cache \ 42 --network=slirp4netns \ 43 -t registry.digitalocean.com/myheats/myheats:api . 44 45 buildah push registry.digitalocean.com/myheats/myheats:api 46 ``` 47 48 ## App service setup 49 50 Use `../dev/digital-ocean-app.yaml` app spec to configure the app in Digital 51 Ocean 52 53 ## Droplet setup 54 55 Cheap and cheerful. 56 57 1 - Create droplet 58 59 2 - Create user 60 - Configure ssh key and sshd agent 61 - Configure sudoers 62 - Install podman 63 - Configure certbot 64 65 3 - Clone repos (Podman and db schema) 66 67 ```bash 68 git clone --depth=1 https://git.in0rdr.ch/myheats.git myheats.git 69 git clone --depth=1 https://git.in0rdr.ch/nomad.git nomad.git 70 cd nomad.git/docker/docker-myheats-nginx/ 71 ``` 72 73 4 - Run podman services (frontend, api, db) 74 75 ```bash 76 sudo podman login registry.digitalocean.com/myheats 77 sudo podman-compose up -d 78 ```