commit 1846143a63a067fdc9d3d3249c797137a34658af
parent dda24a98c1665e9159422a90dc26786070039a5c
Author: Andreas Gruhler <andreas.gruhler@adfinis.com>
Date: Fri, 11 Oct 2024 00:57:14 +0200
feat(myheats-doc): add droplet
Diffstat:
3 files changed, 81 insertions(+), 2 deletions(-)
diff --git a/docker/docker-myheats-nginx/README.md b/docker/docker-myheats-nginx/README.md
@@ -3,7 +3,15 @@ My Heats Nginx Image
Build instructions for Digital Ocean.
-Estimated Monthly App Cost: $17.00 (2x$5 services + $7 PostgreSQL db)
+Estimated Monthly
+- App Cost: $17.00 (2x$5 services + $7 PostgreSQL db)
+- Managed external db: $15
+- Droplet (incl. db, app services,): $6
+
+https://www.digitalocean.com/pricing
+
+Build and push images
+---------------------
1 - Prepare build environment (variables are fixed during "vite build" step):
@@ -35,4 +43,29 @@ Estimated Monthly App Cost: $17.00 (2x$5 services + $7 PostgreSQL db)
buildah push registry.digitalocean.com/myheats/myheats:api
-4 - Use `digital-ocean-app.yaml` app spec to configure the app in Digital Ocean.
+App service setup
+-----------------
+
+Use `digital-ocean-app.yaml` app spec to configure the app in Digital Ocean
+
+Droplet setup
+-------------
+
+Cheap and cheerful.
+
+1 - Create droplet
+
+2 - Create user
+ - Configure ssh key and sshd agent
+ - Configure sudoers
+ - Install podman
+
+3 - Clone repo
+
+ git clone --depth=1 https://git.in0rdr.ch/nomad.git nomad.git
+ cd nomad.git/docker/docker-myheats-nginx/
+
+4 - Run podman services (frontend, api, db)
+
+ podman login registry.digitalocean.com/myheats
+ podman-compose up -d
diff --git a/docker/docker-myheats-nginx/docker-compose.yml b/docker/docker-myheats-nginx/docker-compose.yml
@@ -0,0 +1,39 @@
+# Use postgres/example user/password credentials
+# - https://hub.docker.com/_/postgres
+# - https://github.com/docker-library/docs/blob/master/postgres/README.md
+version: '3.9'
+
+services:
+ myheats-frontend:
+ container_name: myheats-frontend
+ image: registry.digitalocean.com/myheats/myheats:latest
+ networks:
+ - myheats
+
+ myheats-backend:
+ container_name: myheats-api
+ image: registry.digitalocean.com/myheats/myheats:api
+ networks:
+ - myheats
+
+ myheats-db:
+ container_name: myheats-db
+ image: docker.io/postgres:16-alpine
+ shm_size: 128mb
+ environment:
+ POSTGRES_PASSWORD: example
+ volumes:
+ - ./data/pgdata:/var/lib/postgresql/data
+ - ./init-db.sh:/docker-entrypoint-initdb.d/init-db.sh:ro
+ networks:
+ - myheats
+
+ adminer:
+ container_name: adminer
+ image: docker.io/adminer:latest
+ restart: always
+ networks:
+ - myheats
+
+networks:
+ myheats:
diff --git a/docker/docker-myheats-nginx/init-db.sh b/docker/docker-myheats-nginx/init-db.sh
@@ -0,0 +1,7 @@
+#!/bin/bash
+set -e
+
+git clone --depth=1 https://git.in0rdr.ch/myheats.git myheats.git
+/schema/99-init-db.sql
+
+cat ./myheats.git/schema/*.sql | psql -h 127.0.0.1 -U postgres -p 5432