Self-host
This documentation is intended to deploy Agatha on a Nixos server with a keycloak and both a beta and a default instances (to be honest it’s my recipe to be able to reinstall everything in case of trouble)
The documentation will be improved to better adress the needs of an everyday self-hoster with ready to use nixos packages and redirection toward the Agatha Identity provider rather than having to install your own. Make yourself known so I can prioritize it accordingly.
/!\ This requires an understanding of Nixos as you will need to edit the OS configuration file
create a NIXOS VPS
see vps2day
log as root on your new server
git and non root user
add this lines to the file:
then update
retrieving the server configuration
- clone the agatha deploy repo
see Github documentation to authorize a new ssh key
- Add the server configuration to your repo to version it
-
note : hardware-configuration wont be changed but it is needed in the nixos folder so that the relative links in configuration.nix stay valid
-
troubleshooting : if you receive the error “git@github.com: Permission denied (publickey).” run
-
troubleshooting : error: insufficient permission for adding an object to repository database .git/objects edit the file manually with the erica user to change ownership somehow
-
Update the /var/deploy/nixos/configuration.nix file to include the required element (you can take inspiration from the old_configuration.nix file)
Updating the configuration
- [important] change the base version
Nix needs to know what your start point was in order to handle updates correctly
Adding local config
go trough the files to change the value depending on your configuration
note for the Agatha-team, see the relevant repo to find our own configuration
setting the symbolic links
[optionnal]
it should not be needed if you used the same structure as this doc
- /home/erica
- config
- deploy
otherwise update the following script
prepare folder for frontend
let’s go
Let’s save the day
import backup
- create a new database from scratch
- import the backup
- then, see “change the database” section
/!\ Warning ! Do not import the data in the current database. This is likely to create a migration conflict between the current structure and the former data
change the database
-
keycloak
- update the configuration.nix file
- update the db_password file in the server config
-
agatha
- update the gradle.properties int the server config
- update the flyway.conf in the server config
change the url
if you want to change the url you will have to update :
- the gradle.properties files the server config
- the configuration.nix file
- when building the front :
- app/front/scripts/set_beta_properties.sh
- app/front/scripts/set_prod_properties.sh