myheats

Live heats, scoring and leaderboard for sport events
git clone https://git.in0rdr.ch/myheats.git
Log | Files | Refs | Pull requests | README | LICENSE

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 Ocean
     51 
     52 ## Droplet setup
     53 
     54 Cheap and cheerful.
     55 
     56 1 - Create droplet
     57 
     58 2 - Create user
     59   - Configure ssh key and sshd agent
     60   - Configure sudoers
     61   - Install podman
     62   - Configure certbot
     63 
     64 3 - Clone repos (Podman and db schema)
     65 
     66 ```bash
     67 git clone --depth=1 https://git.in0rdr.ch/myheats.git myheats.git
     68 git clone --depth=1 https://git.in0rdr.ch/nomad.git nomad.git
     69 cd nomad.git/docker/docker-myheats-nginx/
     70 ```
     71 
     72 4 - Run podman services (frontend, api, db)
     73 
     74 ```bash
     75 sudo podman login registry.digitalocean.com/myheats
     76 sudo podman-compose up -d
     77 ```