- Auto k3s installation if k3s is not presented
- Traefik, kube-config, etc. managed by deployment script
- Postgres 18 alpine, no redis, local pv mounts
- Traefik configured to use Let's Encrypt certs and XFF
- All secrets and relevant configs in .env file (something like single source of truth)
It just works
First steps:
sudo apt install git curl -y
git clone https://github.com/r1zekami/gzctf-simple-deploy.git
cd gzctf-simple-deploy
To deploy, create .env file in the same directory as config/env/.env.example:
cp config/env/.env.example config/env/.env
Then change the insides of config/env/.env
If you need to modify the appsettings.json variables, that are not in the .env file, modify the appsettings.template.json file.
appsettings.json, traefik-config.yaml and ingress.yaml is RENDERED files that are not supposed to be changed manually.
You need to change corresponding *.template.* file for it.
Save changed configuration files, then:
chmod +x ./deploy.sh && ./deploy.sh
Then you need to wait while the scripts do all the work. It usually about 2-5 minutes.
If you need to purge all:
sudo kubectl delete -k .
sudo rm -rf /mnt/data/gzctf
You can then safely re-run deploy.sh script
If you need to reapply appsettings.json/.env/etc you can change the thing you need, then:
./deploy.sh # Will render changed configs
sudo kubectl delete pod -n gzctf-server -l app=gzctf
That will recreate the gzctf-server pod and new config will be applied.
If you accidentaly use '' in POSTGRES_PASSWORD in .env (like POSTGRES_PASSWORD='password') you can change it manually:
sudo kubectl exec -it -n gzctf-server deployment/gzctf-db -- psql -U postgres -c "ALTER USER postgres WITH PASSWORD 'password';"
It will delete '' from the database password.
Or you can just rm the mountpoint/pv's/pvc's.
It will not work on ADMIN_PASSWORD variable. It is also gonna be stored in the database, so if you do this with the admin password - just change it via web service itself.
Host files changed:
/mnt/data/gzctf/files
/mnt/data/gzctf/db
/var/lib/rancher/k3s/server/manifests/traefik-config.yaml
/etc/rancher/k3s/config.yaml
/etc/rancher/k3s/registries.yaml
TODO:
- Tests (I mean it's working fine but there may be hidden issues)
- Version fixation (k3s, ps, traefik?... I dont really think it is necessary)