commit dda24a98c1665e9159422a90dc26786070039a5c
parent 5be5d1b1e5339cb84b7d6a58606c347776182738
Author: Andreas Gruhler <andreas.gruhler@adfinis.com>
Date: Thu, 10 Oct 2024 23:28:13 +0200
feat(myheats-doc): add db and api
Diffstat:
2 files changed, 35 insertions(+), 4 deletions(-)
diff --git a/docker/docker-myheats-nginx/README.md b/docker/docker-myheats-nginx/README.md
@@ -3,6 +3,8 @@ My Heats Nginx Image
Build instructions for Digital Ocean.
+Estimated Monthly App Cost: $17.00 (2x$5 services + $7 PostgreSQL db)
+
1 - Prepare build environment (variables are fixed during "vite build" step):
export VITE_APP_DOC_TITLE='My title'
@@ -10,7 +12,7 @@ Build instructions for Digital Ocean.
# use NODE_ENV=prod to exclude the `devDependencies` (e..g, vite)
export NODE_ENV=dev
-2 - Build and push:
+2 - Build frontend and push:
# https://cloud.digitalocean.com/account/api/tokens
podman login registry.digitalocean.com/myheats
@@ -23,4 +25,14 @@ Build instructions for Digital Ocean.
buildah push registry.digitalocean.com/myheats/myheats:latest
-3 - Use `digital-ocean-app.yaml` to configure the app in Digital Ocean.
+3 - Build backend/api and push:
+
+ # https://code.in0rdr.ch/nomad/file/docker/docker-myheats-demo/Dockerfile.html
+
+ buildah bud --no-cache \
+ --network=slirp4netns \
+ -t registry.digitalocean.com/myheats/myheats:api .
+
+ buildah push registry.digitalocean.com/myheats/myheats:api
+
+4 - Use `digital-ocean-app.yaml` app spec to configure the app in Digital Ocean.
diff --git a/docker/docker-myheats-nginx/digital-ocean-app.yaml b/docker/docker-myheats-nginx/digital-ocean-app.yaml
@@ -1,15 +1,23 @@
alerts:
- rule: DEPLOYMENT_FAILED
- rule: DOMAIN_FAILED
+databases:
+- engine: PG
+ name: myheats-db
features:
- buildpack-stack=ubuntu-22
ingress:
rules:
- component:
- name: myheats
+ name: myheats-frontend
match:
path:
prefix: /
+ - component:
+ name: myheats-api
+ match:
+ path:
+ prefix: /api
name: myheats-app
region: fra
services:
@@ -22,4 +30,15 @@ services:
tag: latest
instance_count: 1
instance_size_slug: apps-s-1vcpu-0.5gb
- name: myheats
+ name: myheats-frontend
+- http_port: 8000
+ image:
+ deploy_on_push:
+ enabled: true
+ registry_type: DOCR
+ repository: myheats
+ tag: api
+ instance_count: 1
+ instance_size_slug: apps-s-1vcpu-0.5gb
+ name: myheats-api
+