From 89e1c634eecb5c82a40c56e81630bc1c951ea4b1 Mon Sep 17 00:00:00 2001 From: Dominic Ricottone Date: Fri, 11 Nov 2022 17:12:12 -0600 Subject: [PATCH] v2 update Image version is bumped. This corresponds to the major update in huttese-apk. Aside from that, there are a number of smaller updates included. cron service isn't necessary inside the huttese container, so that has been killed off. make recipes for backups have been added. Restoration recipes are TODO, but a rough implementation is available in comments next to each backup recipe. The make recipes have been cleaned up to (1) not check for services being up constantly, and (2) to more closely mirror each other between the docker and podman implementations. --- .gitignore | 3 + Makefile.docker | 76 +++++++--- Makefile.podman | 166 ++++++++++++++-------- sr/etc/supervisor/conf.d/supervisord.conf | 5 - 4 files changed, 164 insertions(+), 86 deletions(-) diff --git a/.gitignore b/.gitignore index f9095d3..eb1a663 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,6 @@ sr/etc/postfix/generic sr/etc/postfix/sasl/sasl_passwd sr/etc/sr.ht/config.ini +# backups directory +backups/ + diff --git a/Makefile.docker b/Makefile.docker index 7731eec..c2608a7 100644 --- a/Makefile.docker +++ b/Makefile.docker @@ -23,17 +23,22 @@ GIT_DATADIR=/var/deploy/data/git # set image tag data SRHT_LOCALNAME=srht -SRHT_LOCALVERSION=1 +SRHT_LOCALVERSION=2 CERTDIR=/var/deploy/certs keys: ssh-keygen -A -f etc/ssh/ +network: + $(CONMAN) inspect $(HUTTESE_NETWORK) >/dev/null 2>&1 \ + || $(CONMAN) network create $(HUTTESE_NETWORK) + databases: - $(CONMAN) inspect $(HUTTESE_NETWORK) >/dev/null 2>&1 - $(CONMAN) inspect -f '{{.State.Running}}' $(HUTTESE_POSTGRES) >/dev/null 2>&1 - $(CONMAN) inspect -f '{{.State.Running}}' $(HUTTESE_REDIS) >/dev/null 2>&1 + $(CONMAN) inspect -f '{{.State.Running}}' $(HUTTESE_POSTGRES) >/dev/null 2>&1 \ + || $(CONMAN) start $(HUTTESE_POSTGRES) + $(CONMAN) inspect -f '{{.State.Running}}' $(HUTTESE_REDIS) >/dev/null 2>&1 \ + || $(CONMAN) start $(HUTTESE_REDIS) cleanup: $(CONMAN) network disconnect --force $(HUTTESE_NETWORK) $(HUTTESE_REDIS) >/dev/null 2>&1 || true @@ -43,10 +48,7 @@ cleanup: $(CONMAN) rm --force $(HUTTESE_POSTGRES) >/dev/null 2>&1 || true $(CONMAN) image rm --force $(POSTGRES_LOCALNAME):latest >/dev/null 2>&1 || true -setup: - $(CONMAN) inspect $(HUTTESE_NETWORK) >/dev/null 2>&1 \ - || $(CONMAN) network create $(HUTTESE_NETWORK) - +setup: network $(CONMAN) inspect $(REDIS_LOCALNAME) >/dev/null 2>&1 \ || $(CONMAN) pull $(REDIS_TARGET) \ && $(CONMAN) tag $(REDIS_TARGET) $(REDIS_LOCALNAME) @@ -80,7 +82,7 @@ image: # again, only necessary if on aarch64 rm -rf sr/pkg sr/etc/apk/keys -dbinit: databases image +dbinit: $(CONMAN) exec $(HUTTESE_POSTGRES) \ createdb -U postgres meta.sr.ht $(CONMAN) exec $(HUTTESE_POSTGRES) \ @@ -97,27 +99,27 @@ dbinit: databases image --network $(HUTTESE_NETWORK) \ $(SRHT_LOCALNAME) todosrht-initdb -dbmigrate: databases image +dbmigrate: databases $(CONMAN) run --name $(HUTTESE_SRHT)_dbmigrate --rm \ --network $(HUTTESE_NETWORK) \ - $(SRHT_LOCALNAME) srht-migrate meta.sr.ht -a upgrade head + $(SRHT_LOCALNAME) srht-migrate meta.sr.ht upgrade head $(CONMAN) run --name $(HUTTESE_SRHT)_dbmigrate --rm \ --network $(HUTTESE_NETWORK) \ - $(SRHT_LOCALNAME) metasrht-migrate -a upgrade head + $(SRHT_LOCALNAME) metasrht-migrate upgrade head $(CONMAN) run --name $(HUTTESE_SRHT)_dbmigrate --rm \ --network $(HUTTESE_NETWORK) \ - $(SRHT_LOCALNAME) srht-migrate git.sr.ht -a upgrade head + $(SRHT_LOCALNAME) srht-migrate git.sr.ht upgrade head $(CONMAN) run --name $(HUTTESE_SRHT)_dbmigrate --rm \ --network $(HUTTESE_NETWORK) \ - $(SRHT_LOCALNAME) gitsrht-migrate -a upgrade head + $(SRHT_LOCALNAME) gitsrht-migrate upgrade head $(CONMAN) run --name $(HUTTESE_SRHT)_dbmigrate --rm \ --network $(HUTTESE_NETWORK) \ - $(SRHT_LOCALNAME) srht-migrate todo.sr.ht -a upgrade head + $(SRHT_LOCALNAME) srht-migrate todo.sr.ht upgrade head $(CONMAN) run --name $(HUTTESE_SRHT)_dbmigrate --rm \ --network $(HUTTESE_NETWORK) \ - $(SRHT_LOCALNAME) todosrht-migrate -a upgrade head + $(SRHT_LOCALNAME) todosrht-migrate upgrade head -start: databases image +start: network databases image $(CONMAN) run --detach --name $(HUTTESE_SRHT) --restart always \ --hostname tatooine \ --hostname dominic-ricottone.com \ @@ -158,4 +160,42 @@ clean: $(CONMAN) rm --force $(HUTTESE_SRHT) >/dev/null 2>&1 || true $(CONMAN) image rm --force $(SRHT_LOCALNAME):latest >/dev/null 2>&1 || true -.PHONY: databases cleanup setup image dbinit dbmigrate start adduser addadmin shell psql stop restart clean +backups/image-backup.tar: + mkdir -p backups + $(CONMAN) pod stop $(HUTTESE_POD) + $(CONMAN) commit $(HUTTESE_SRHT) backup + $(CONMAN) save --output backups/image-backup.tar backup + #try: $(CONMAN) load --input backups/image-backup.tar + +backups/db-postgres-backup.sql: + mkdir -p backups + $(CONMAN) exec -it $(HUTTESE_POSTGRES) bash -c 'pg_dump --clean --dbname=postgres --username=postgres > /db-postgres-backup.sql' + $(CONMAN) cp $(HUTTESE_POSTGRES):/db-postgres-backup.sql backups/db-postgres-backup.sql + #try: $(CONMAN) cp backups/db-postgres-backup.sql cp $(HUTTESE_POSTGRES):/db-postgres-backup.sql && $(CONMAN) exec -it $(HUTTESE_POSTGRES) pg_restore --clean --dbname=postgres --username=postgres /db-postgres-backup.sql + +backups/db-meta.sr.ht-backup.sql: + mkdir -p backups + $(CONMAN) exec -it $(HUTTESE_POSTGRES) bash -c 'pg_dump --clean --dbname=meta.sr.ht --username=postgres > /db-meta.sr.ht-backup.sql' + $(CONMAN) cp $(HUTTESE_POSTGRES):/db-meta.sr.ht-backup.sql backups/db-meta.sr.ht-backup.sql + #try: $(CONMAN) cp backups/db-meta.sr.ht-backup.sql cp $(HUTTESE_POSTGRES):/db-meta.sr.ht-backup.sql && $(CONMAN) exec -it $(HUTTESE_POSTGRES) pg_restore --clean --dbname=meta.sr.ht --username=postgres /db-meta.sr.ht-backup.sql + +backups/db-git.sr.ht-backup.sql: + mkdir -p backups + $(CONMAN) exec -it $(HUTTESE_POSTGRES) bash -c 'pg_dump --clean --dbname=git.sr.ht --username=postgres > /db-git.sr.ht-backup.sql' + $(CONMAN) cp $(HUTTESE_POSTGRES):/db-git.sr.ht-backup.sql backups/db-git.sr.ht-backup.sql + #try: $(CONMAN) cp backups/db-git.sr.ht-backup.sql cp $(HUTTESE_POSTGRES):/db-git.sr.ht-backup.sql && $(CONMAN) exec -it $(HUTTESE_POSTGRES) pg_restore --clean --dbname=git.sr.ht --username=postgres /db-git.sr.ht-backup.sql + +backups/db-todo.sr.ht-backup.sql: + mkdir -p backups + $(CONMAN) exec -it $(HUTTESE_POSTGRES) bash -c 'pg_dump --clean --dbname=todo.sr.ht --username=postgres > /db-todo.sr.ht-backup.sql' + $(CONMAN) cp $(HUTTESE_POSTGRES):/db-todo.sr.ht-backup.sql backups/db-todo.sr.ht-backup.sql + #try: $(CONMAN) cp backups/db-todo.sr.ht-backup.sql cp $(HUTTESE_POSTGRES):/db-todo.sr.ht-backup.sql && $(CONMAN) exec -it $(HUTTESE_POSTGRES) pg_restore --clean --dbname=todo.sr.ht --username=postgres /db-todo.sr.ht-backup.sql + +backups/git-backup.tar.gz: + mkdir -p backups + sudo tar -czvf backups/git-backup.tar.gz ../../data/git + #try: sudo tar -xzvf backups/git-backup.tar.gz -C ../../data/git + +backup: backups/image-backup.tar backups/db-postgres-backup.sql backups/db-meta.sr.ht-backup.sql backups/db-git.sr.ht-backup.sql backups/db-todo.sr.ht-backup.sql backups/git-backup.tar.gz + +.PHONY: network databases cleanup setup image dbinit dbmigrate start adduser addadmin shell psql stop restart clean backup diff --git a/Makefile.podman b/Makefile.podman index 65116e8..ef4033f 100644 --- a/Makefile.podman +++ b/Makefile.podman @@ -1,5 +1,5 @@ # set podman-compliant container management CLI binary -PODMAN=podman +CONMAN=podman # set fun names for the containers HUTTESE_POD=podracing @@ -23,7 +23,7 @@ GIT_DATADIR=/var/deploy/data/git # set image tag data SRHT_LOCALNAME=srht -SRHT_LOCALVERSION=1 +SRHT_LOCALVERSION=2 CERTDIR=/var/deploy/certs @@ -31,8 +31,8 @@ keys: ssh-keygen -A -f etc/ssh/ pod: - $(PODMAN) pod exists $(HUTTESE_POD) >/dev/null 2>&1 \ - || $(PODMAN) pod create --name $(HUTTESE_POD) \ + $(CONMAN) pod exists $(HUTTESE_POD) >/dev/null 2>&1 \ + || $(CONMAN) pod create --name $(HUTTESE_POD) \ --add-host=tatooine:127.0.0.1 \ --add-host=dominic-ricottone.com:127.0.0.1 \ --add-host=meta.dominic-ricottone.com:127.0.0.1 \ @@ -41,29 +41,31 @@ pod: --publish 0.0.0.0:80:80 --publish 0.0.0.0:443:443 --publish 0.0.0.0:8822:22 databases: - $(PODMAN) inspect -f '{{.State.Running}}' $(HUTTESE_POSTGRES) >/dev/null 2>&1 - $(PODMAN) inspect -f '{{.State.Running}}' $(HUTTESE_REDIS) >/dev/null 2>&1 + $(CONMAN) inspect -f '{{.State.Running}}' $(HUTTESE_POSTGRES) >/dev/null 2>&1 \ + || $(CONMAN) start $(HUTTESE_POSTGRES) + $(CONMAN) inspect -f '{{.State.Running}}' $(HUTTESE_REDIS) >/dev/null 2>&1 \ + || $(CONMAN) start $(HUTTESE_REDIS) cleanup: - $(PODMAN) rm --force $(HUTTESE_REDIS) >/dev/null 2>&1 || true - $(PODMAN) image rm --force $(REDIS_LOCALNAME):latest >/dev/null 2>&1 || true - $(PODMAN) rm --force $(HUTTESE_POSTGRES) >/dev/null 2>&1 || true - $(PODMAN) image rm --force $(POSTGRES_LOCALNAME):latest >/dev/null 2>&1 || true + $(CONMAN) rm --force $(HUTTESE_REDIS) >/dev/null 2>&1 || true + $(CONMAN) image rm --force $(REDIS_LOCALNAME):latest >/dev/null 2>&1 || true + $(CONMAN) rm --force $(HUTTESE_POSTGRES) >/dev/null 2>&1 || true + $(CONMAN) image rm --force $(POSTGRES_LOCALNAME):latest >/dev/null 2>&1 || true setup: pod - $(PODMAN) inspect $(REDIS_LOCALNAME) >/dev/null 2>&1 \ - || $(PODMAN) pull $(REDIS_TARGET) \ - && $(PODMAN) tag $(REDIS_TARGET) $(REDIS_LOCALNAME) - $(PODMAN) run --detach --name $(HUTTESE_REDIS) --restart always \ - --pod podracing \ + $(CONMAN) inspect $(REDIS_LOCALNAME) >/dev/null 2>&1 \ + || $(CONMAN) pull $(REDIS_TARGET) \ + && $(CONMAN) tag $(REDIS_TARGET) $(REDIS_LOCALNAME) + $(CONMAN) run --detach --name $(HUTTESE_REDIS) --restart always \ + --pod $(HUTTESE_POD) \ $(REDIS_LOCALNAME) - $(PODMAN) inspect $(POSTGRES_LOCALNAME) >/dev/null 2>&1 \ - || $(PODMAN) pull $(POSTGRES_TARGET) \ - && $(PODMAN) tag $(POSTGRES_TARGET) $(POSTGRES_LOCALNAME) - $(PODMAN) run --detach --name $(HUTTESE_POSTGRES) --restart always \ + $(CONMAN) inspect $(POSTGRES_LOCALNAME) >/dev/null 2>&1 \ + || $(CONMAN) pull $(POSTGRES_TARGET) \ + && $(CONMAN) tag $(POSTGRES_TARGET) $(POSTGRES_LOCALNAME) + $(CONMAN) run --detach --name $(HUTTESE_POSTGRES) --restart always \ --env POSTGRES_HOST_AUTH_METHOD=trust \ - --pod podracing \ + --pod $(HUTTESE_POD) \ --mount type=bind,src=$(POSTGRES_DATADIR),dst=/var/lib/postgresql/data,Z \ --mount type=bind,src=$(POSTGRES_CONF),dst=/etc/postgresql/postgresql.conf,Z \ $(POSTGRES_LOCALNAME) -c 'config_file=/etc/postgresql/postgresql.conf' @@ -73,8 +75,8 @@ image: cp -r /var/deploy/build/huttese-apk/pkg sr/pkg cp -r /var/deploy/build/huttese-apk/keys sr/etc/apk/keys - $(PODMAN) inspect $(SRHT_LOCALNAME) >/dev/null 2>&1 \ - || $(PODMAN) build \ + $(CONMAN) inspect $(SRHT_LOCALNAME) >/dev/null 2>&1 \ + || $(CONMAN) build \ --tag $(SRHT_LOCALNAME):latest \ --tag $(SRHT_LOCALNAME):$(SRHT_LOCALVERSION) \ sr/ @@ -82,46 +84,46 @@ image: # again, only necessary if on aarch64 rm -rf sr/pkg sr/etc/apk/keys -dbinit: pod databases image - $(PODMAN) exec $(HUTTESE_POSTGRES) \ +dbinit: + $(CONMAN) exec $(HUTTESE_POSTGRES) \ createdb -U postgres meta.sr.ht - $(PODMAN) exec $(HUTTESE_POSTGRES) \ + $(CONMAN) exec $(HUTTESE_POSTGRES) \ createdb -U postgres git.sr.ht - $(PODMAN) exec $(HUTTESE_POSTGRES) \ + $(CONMAN) exec $(HUTTESE_POSTGRES) \ createdb -U postgres todo.sr.ht - $(PODMAN) run --name $(HUTTESE_SRHT)_dbinit --rm \ - --pod podracing \ + $(CONMAN) run --name $(HUTTESE_SRHT)_dbinit --rm \ + --pod $(HUTTESE_POD) \ $(SRHT_LOCALNAME) metasrht-initdb - $(PODMAN) run --name $(HUTTESE_SRHT)_dbinit --rm \ - --pod podracing \ + $(CONMAN) run --name $(HUTTESE_SRHT)_dbinit --rm \ + --pod $(HUTTESE_POD) \ $(SRHT_LOCALNAME) gitsrht-initdb - $(PODMAN) run --name $(HUTTESE_SRHT)_dbinit --rm \ - --pod podracing \ + $(CONMAN) run --name $(HUTTESE_SRHT)_dbinit --rm \ + --pod $(HUTTESE_POD) \ $(SRHT_LOCALNAME) todosrht-initdb -dbmigrate: pod databases image - $(PODMAN) run --name $(HUTTESE_SRHT)_dbmigrate --rm \ - --pod podracing \ - $(SRHT_LOCALNAME) srht-migrate meta.sr.ht -a upgrade head - $(PODMAN) run --name $(HUTTESE_SRHT)_dbmigrate --rm \ - --pod podracing \ - $(SRHT_LOCALNAME) metasrht-migrate -a upgrade head - $(PODMAN) run --name $(HUTTESE_SRHT)_dbmigrate --rm \ - --pod podracing \ - $(SRHT_LOCALNAME) srht-migrate git.sr.ht -a upgrade head - $(PODMAN) run --name $(HUTTESE_SRHT)_dbmigrate --rm \ - --pod podracing \ - $(SRHT_LOCALNAME) gitsrht-migrate -a upgrade head - $(PODMAN) run --name $(HUTTESE_SRHT)_dbmigrate --rm \ - --pod podracing \ - $(SRHT_LOCALNAME) srht-migrate todo.sr.ht -a upgrade head - $(PODMAN) run --name $(HUTTESE_SRHT)_dbmigrate --rm \ - --pod podracing \ - $(SRHT_LOCALNAME) todosrht-migrate -a upgrade head +dbmigrate: databases + $(CONMAN) run --name $(HUTTESE_SRHT)_dbmigrate --rm \ + --pod $(HUTTESE_POD) \ + $(SRHT_LOCALNAME) srht-migrate meta.sr.ht upgrade head + $(CONMAN) run --name $(HUTTESE_SRHT)_dbmigrate --rm \ + --pod $(HUTTESE_POD) \ + $(SRHT_LOCALNAME) metasrht-migrate upgrade head + $(CONMAN) run --name $(HUTTESE_SRHT)_dbmigrate --rm \ + --pod $(HUTTESE_POD) \ + $(SRHT_LOCALNAME) srht-migrate git.sr.ht upgrade head + $(CONMAN) run --name $(HUTTESE_SRHT)_dbmigrate --rm \ + --pod $(HUTTESE_POD) \ + $(SRHT_LOCALNAME) gitsrht-migrate upgrade head + $(CONMAN) run --name $(HUTTESE_SRHT)_dbmigrate --rm \ + --pod $(HUTTESE_POD) \ + $(SRHT_LOCALNAME) srht-migrate todo.sr.ht upgrade head + $(CONMAN) run --name $(HUTTESE_SRHT)_dbmigrate --rm \ + --pod $(HUTTESE_POD) \ + $(SRHT_LOCALNAME) todosrht-migrate upgrade head start: pod databases image - $(PODMAN) run --detach --name $(HUTTESE_SRHT) --restart always \ - --pod podracing \ + $(CONMAN) run --detach --name $(HUTTESE_SRHT) --restart always \ + --pod $(HUTTESE_POD) \ --mount type=bind,src=$(GIT_DATADIR),dst=/var/lib/git,Z \ --mount type=bind,src=$(CERTDIR),dst=/var/lets-encrypt,Z \ $(SRHT_LOCALNAME) @@ -130,27 +132,65 @@ USER_EMAIL?= USER_NAME?= adduser: databases - $(PODMAN) exec -it $(HUTTESE_SRHT) metasrht-manageuser -e $(USER_EMAIL) -t active_free $(USER_NAME) \ + $(CONMAN) exec -it $(HUTTESE_SRHT) metasrht-manageuser -e $(USER_EMAIL) -t active_free $(USER_NAME) \ || echo "USAGE: USER_EMAIL=me@example.com USER_NAME=me make adduser" addadmin: databases - $(PODMAN) exec -it $(HUTTESE_SRHT) metasrht-manageuser -e $(USER_EMAIL) -t admin $(USER_NAME) \ + $(CONMAN) exec -it $(HUTTESE_SRHT) metasrht-manageuser -e $(USER_EMAIL) -t admin $(USER_NAME) \ || echo "USAGE: USER_EMAIL=me@example.com USER_NAME=me make adduser" shell: - $(PODMAN) exec -it $(HUTTESE_SRHT) sh + $(CONMAN) exec -it $(HUTTESE_SRHT) sh psql: databases - $(PODMAN) exec -it huttpg psql --username=postgres + $(CONMAN) exec -it huttpg psql --username=postgres stop: - $(PODMAN) stop $(HUTTESE_SRHT) + $(CONMAN) stop $(HUTTESE_SRHT) restart: databases - $(PODMAN) restart $(HUTTESE_SRHT) + $(CONMAN) restart $(HUTTESE_SRHT) clean: - $(PODMAN) rm --force $(HUTTESE_SRHT) >/dev/null 2>&1 || true - $(PODMAN) image rm --force $(SRHT_LOCALNAME):latest >/dev/null 2>&1 || true - -.PHONY: pod databases cleanup setup image dbinit dbmigrate start adduser addadmin shell psql stop restart clean + $(CONMAN) rm --force $(HUTTESE_SRHT) >/dev/null 2>&1 || true + $(CONMAN) image rm --force $(SRHT_LOCALNAME):latest >/dev/null 2>&1 || true + +backups/image-backup.tar: + mkdir -p backups + $(CONMAN) pod stop $(HUTTESE_POD) + $(CONMAN) commit $(HUTTESE_SRHT) backup + $(CONMAN) save --output backups/image-backup.tar backup + #try: $(CONMAN) load --input backups/image-backup.tar + +backups/db-postgres-backup.sql: + mkdir -p backups + $(CONMAN) exec -it $(HUTTESE_POSTGRES) bash -c 'pg_dump --clean --dbname=postgres --username=postgres > /db-postgres-backup.sql' + $(CONMAN) cp $(HUTTESE_POSTGRES):/db-postgres-backup.sql backups/db-postgres-backup.sql + #try: $(CONMAN) cp backups/db-postgres-backup.sql cp $(HUTTESE_POSTGRES):/db-postgres-backup.sql && $(CONMAN) exec -it $(HUTTESE_POSTGRES) pg_restore --clean --dbname=postgres --username=postgres /db-postgres-backup.sql + +backups/db-meta.sr.ht-backup.sql: + mkdir -p backups + $(CONMAN) exec -it $(HUTTESE_POSTGRES) bash -c 'pg_dump --clean --dbname=meta.sr.ht --username=postgres > /db-meta.sr.ht-backup.sql' + $(CONMAN) cp $(HUTTESE_POSTGRES):/db-meta.sr.ht-backup.sql backups/db-meta.sr.ht-backup.sql + #try: $(CONMAN) cp backups/db-meta.sr.ht-backup.sql cp $(HUTTESE_POSTGRES):/db-meta.sr.ht-backup.sql && $(CONMAN) exec -it $(HUTTESE_POSTGRES) pg_restore --clean --dbname=meta.sr.ht --username=postgres /db-meta.sr.ht-backup.sql + +backups/db-git.sr.ht-backup.sql: + mkdir -p backups + $(CONMAN) exec -it $(HUTTESE_POSTGRES) bash -c 'pg_dump --clean --dbname=git.sr.ht --username=postgres > /db-git.sr.ht-backup.sql' + $(CONMAN) cp $(HUTTESE_POSTGRES):/db-git.sr.ht-backup.sql backups/db-git.sr.ht-backup.sql + #try: $(CONMAN) cp backups/db-git.sr.ht-backup.sql cp $(HUTTESE_POSTGRES):/db-git.sr.ht-backup.sql && $(CONMAN) exec -it $(HUTTESE_POSTGRES) pg_restore --clean --dbname=git.sr.ht --username=postgres /db-git.sr.ht-backup.sql + +backups/db-todo.sr.ht-backup.sql: + mkdir -p backups + $(CONMAN) exec -it $(HUTTESE_POSTGRES) bash -c 'pg_dump --clean --dbname=todo.sr.ht --username=postgres > /db-todo.sr.ht-backup.sql' + $(CONMAN) cp $(HUTTESE_POSTGRES):/db-todo.sr.ht-backup.sql backups/db-todo.sr.ht-backup.sql + #try: $(CONMAN) cp backups/db-todo.sr.ht-backup.sql cp $(HUTTESE_POSTGRES):/db-todo.sr.ht-backup.sql && $(CONMAN) exec -it $(HUTTESE_POSTGRES) pg_restore --clean --dbname=todo.sr.ht --username=postgres /db-todo.sr.ht-backup.sql + +backups/git-backup.tar.gz: + mkdir -p backups + sudo tar -czvf backups/git-backup.tar.gz ../../data/git + #try: sudo tar -xzvf backups/git-backup.tar.gz -C ../../data/git + +backup: backups/image-backup.tar backups/db-postgres-backup.sql backups/db-meta.sr.ht-backup.sql backups/db-git.sr.ht-backup.sql backups/db-todo.sr.ht-backup.sql backups/git-backup.tar.gz + +.PHONY: pod databases cleanup setup image dbinit dbmigrate start adduser addadmin shell psql stop restart clean backup diff --git a/sr/etc/supervisor/conf.d/supervisord.conf b/sr/etc/supervisor/conf.d/supervisord.conf index c3877a9..a20bfa3 100644 --- a/sr/etc/supervisor/conf.d/supervisord.conf +++ b/sr/etc/supervisor/conf.d/supervisord.conf @@ -5,11 +5,6 @@ logfile_maxbytes=0 nodaemon=true user=root -[program:crond] -autostart=true -command=crond -f -l 2 -redirect_stderr=true - [program:postfix] autorestart=false command=postfix start -- 2.45.2