|
|
||
|---|---|---|
| database-upgrade | ||
| .env.example | ||
| .gitignore | ||
| CODE_OF_CONDUCT | ||
| docker-compose.yaml | ||
| LICENSE | ||
| README.md | ||
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
- Lukas Gysin - Main Contributor & Project Owner
License
This project is licensed under the MIT License
Acknowledgments
- Billie Thompson - Provided README Template
- Contributor Covenant - Provided CODE_OF_CONDUCT Template