No description
Find a file
Lukas Gysin d52a39ca60
feat: Version Bump
Signed-off-by: Lukas Gysin <L.Gysin@pm.me>
2026-04-30 18:36:31 +02:00
database-upgrade feat: Major DB Update 2026-02-10 21:32:06 +01:00
.env.example feat: Major DB Update 2026-02-10 21:32:06 +01:00
.gitignore feat: Major DB Update 2026-02-10 21:32:06 +01:00
CODE_OF_CONDUCT Initial commit 2025-09-22 23:04:58 +02:00
docker-compose.yaml feat: Version Bump 2026-04-30 18:36:31 +02:00
LICENSE Initial commit 2025-09-22 23:04:58 +02:00
README.md docs: Generic DB 2026-02-10 22:28:20 +01:00

Git Remote Repository

This repository provides the resources for a git remote repository on the homeserver.

Getting Started

These instructions will give you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

Requirements for the software and other tools to build, test and push

Supported IDEs

You can use the IDE of your choice to continue developing the project. However, the following IDEs are recommended and officially supported:

Secret Management

Sensitive data is stored in a .env file. An empty example of the structure can be found in .env.example

Development

This repository is a full functional docker compose application stack. Therefore, you can use the terminal to deploy a development instance on your local machine.

docker-compose up -d

Deployment

For the deployment, the docker compose stack must be copied to the server and started

ssh $USER@$SERVER "docker compose -f $PATH/docker-compose.yaml down"
scp .env $USER@$SERVER:/$PATH/
scp  docker-compose.yaml $USER@$SERVER:/$PATH/
ssh $USER@$SERVER "docker compose -f $PATH/docker-compose.yaml up -d"

The $USER variable holds the username of the user on the server. The $SERVER variable holds the IP-address or the domain of the server. The $PATH variable holds the absolut path to the application folder on the server.

Database Update

When updateing postgres to a new major version, some internals change. For a major upgrade the database has to be backuped and resored on the new version.

docker compose down
docker compose up -d database
docker compose exec -T database pg_dumpall -U $DB_USER > ./database-upgrade/dump.sql
docker compose down
docker run --rm -v gitops_database:/source -v ./database-upgrade:/backup alpine tar -czf /backup/volume-backup.tar.gz -C /source .
docker run --rm -v gitops_database:/data alpine rm -rf /data
# Update the postgres database to the new major version
docker compose up -d database
cat ./database-upgrade/dump.sql | docker compose exec -T database psql $DB_DATABASE -U $DB_USER
docker compose up -d

Restore

If something goes wrong, with the following script the data from the backup can be restored.

docker compose down
docker run --rm -v gitops_database:/data alpine rm -rf /data
docker run --rm -v gitops_database:/target -v ./database-upgrade:/backup alpine sh -c "cd /target && tar -xzf /backup/volume-backup.tar.gz"
# Restore the old database version
docker compose up -d

Authors

License

This project is licensed under the MIT License

Acknowledgments