commit 0131e5601be8d1c613a4b63f3f2ee9e9b72757a5
parent f21823d8d477cca68bdd56a7b6ed8bd937876696
Author: Andreas Gruhler <andreas.gruhler@adfinis.com>
Date: Sun, 20 Oct 2024 10:00:33 +0200
feat(myheats-nginx): cleanup docker dir
Diffstat:
6 files changed, 0 insertions(+), 212 deletions(-)
diff --git a/docker/docker-myheats-nginx/README.md b/docker/docker-myheats-nginx/README.md
@@ -1,73 +0,0 @@
-My Heats Nginx Image
---------------------
-
-Build instructions for Digital Ocean.
-
-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):
-
- export VITE_APP_DOC_TITLE='My title'
-
- # use NODE_ENV=prod to exclude the `devDependencies` (e.g., vite)
- export NODE_ENV=dev
-
-2 - Build frontend and push:
-
- # https://cloud.digitalocean.com/account/api/tokens
- podman login registry.digitalocean.com/myheats
-
- buildah bud --no-cache \
- --build-arg="VITE_APP_DOC_TITLE=$VITE_APP_DOC_TITLE" \
- --build-arg="NODE_ENV=$NODE_ENV" \
- --network=slirp4netns \
- -t registry.digitalocean.com/myheats/myheats:latest .
-
- buildah push registry.digitalocean.com/myheats/myheats:latest
-
-3 - Build backend/api and push:
-
- # https://code.in0rdr.ch/nomad/file/docker/docker-myheats-api/Dockerfile.html
-
- buildah bud --no-cache \
- --network=slirp4netns \
- -t registry.digitalocean.com/myheats/myheats:api .
-
- buildah push registry.digitalocean.com/myheats/myheats:api
-
-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
- - Configure certbot
-
-3 - Clone repos (Podman and db schema)
-
- git clone --depth=1 https://git.in0rdr.ch/myheats.git myheats.git
- 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)
-
- sudo podman login registry.digitalocean.com/myheats
- sudo podman-compose up -d
diff --git a/docker/docker-myheats-nginx/digital-ocean-app.yaml b/docker/docker-myheats-nginx/digital-ocean-app.yaml
@@ -1,44 +0,0 @@
-alerts:
-- rule: DEPLOYMENT_FAILED
-- rule: DOMAIN_FAILED
-databases:
-- engine: PG
- name: myheats-db
-features:
-- buildpack-stack=ubuntu-22
-ingress:
- rules:
- - component:
- name: myheats-frontend
- match:
- path:
- prefix: /
- - component:
- name: myheats-api
- match:
- path:
- prefix: /api
-name: myheats-app
-region: fra
-services:
-- http_port: 80
- image:
- deploy_on_push:
- enabled: true
- registry_type: DOCR
- repository: myheats
- tag: latest
- instance_count: 1
- instance_size_slug: apps-s-1vcpu-0.5gb
- 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
-
diff --git a/docker/docker-myheats-nginx/docker-compose.yml b/docker/docker-myheats-nginx/docker-compose.yml
@@ -1,56 +0,0 @@
-# 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:
- proxy:
- container_name: proxy
- image: docker.io/library/nginx:stable-alpine
- # wait for other services
- command: ["sh", "-c", "sleep 10 && nginx -g 'daemon off;'"]
- #command: ["sh", "-c", "sleep 3600"]
- volumes:
- - ./proxy.conf:/etc/nginx/conf.d/proxy.conf:ro
- - ./certs:/etc/nginx/certs:ro
- ports:
- - target: 8443
- published: 443
- protocol: tcp
- networks:
- - myheats
-
- myheats-frontend:
- container_name: myheats-frontend
- image: registry.digitalocean.com/myheats/myheats:latest
- env_file: ".env.local"
- networks:
- - myheats
-
- myheats-api:
- container_name: myheats-api
- image: registry.digitalocean.com/myheats/myheats:api
- env_file: ".env.local"
- networks:
- - myheats
-
- myheats-db:
- container_name: myheats-db
- image: docker.io/postgres:16-alpine
- shm_size: 128mb
- volumes:
- - ./data/pgdata:/var/lib/postgresql/data
- - ./init-db.sh:/docker-entrypoint-initdb.d/init-db.sh:ro
- - ~/myheats.git/schema:/schema: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
@@ -1,4 +0,0 @@
-#!/bin/bash
-set -e
-
-cat /schema/*.sql | psql -U postgres
diff --git a/docker/docker-myheats-nginx/myheats.conf b/docker/docker-myheats-nginx/myheats.conf
@@ -1,8 +0,0 @@
-server {
- listen 80;
-
- location / {
- root /usr/share/nginx/html;
- try_files $uri /index.html;
- }
-}
diff --git a/docker/docker-myheats-nginx/proxy.conf b/docker/docker-myheats-nginx/proxy.conf
@@ -1,27 +0,0 @@
-server {
- listen 8443 ssl;
-
- ssl_certificate /etc/nginx/certs/fullchain.pem;
- ssl_certificate_key /etc/nginx/certs/privkey.pem;
-
- location / {
- proxy_pass http://myheats-frontend:80;
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Forwarded-Proto $scheme;
- }
- location /api {
- proxy_pass http://myheats-api:8000;
- proxy_set_header Host $host;
- proxy_set_header X-Real-IP $remote_addr;
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
- proxy_set_header X-Forwarded-Proto $scheme;
-
- # WebSocket proxying
- # https://nginx.org/en/docs/http/websocket.html
- proxy_http_version 1.1;
- proxy_set_header Upgrade $http_upgrade;
- proxy_set_header Connection "upgrade";
- }
-}