Skip to content

feat: add K3S single-node deployment scripts for self-hosted EnvSync - #16

Open
jmac052002 wants to merge 5 commits into
EnvSync-Cloud:mainfrom
jmac052002:feature/k3s-deploy-scripts
Open

feat: add K3S single-node deployment scripts for self-hosted EnvSync#16
jmac052002 wants to merge 5 commits into
EnvSync-Cloud:mainfrom
jmac052002:feature/k3s-deploy-scripts

Conversation

@jmac052002

Copy link
Copy Markdown

What this PR adds

Three platform-agnostic bash scripts for deploying and maintaining
EnvSync on a self-hosted K3S single-node cluster.

scripts/deploy/init.sh

  • Prompts for root domain at runtime and generates all subdomains
  • Installs K3S on any fresh Ubuntu/Debian server
  • Generates Traefik IngressRoute manifests dynamically using the domain
  • Configures: api.x.y · auth.x.y · s3.x.y · app.x.y
  • Waits for pods to be healthy then runs bun cli init

scripts/deploy/backup.sh

  • Runs pg_dump inside the postgres pod via kubectl exec
  • Saves to /var/backups/envsync/$DATE with timestamp folder
  • Prunes backups older than 7 days automatically

scripts/deploy/upgrade.sh

  • Accepts a new image tag as an argument (e.g. v0.4.2)
  • Runs a backup automatically before any changes
  • Performs rolling update via kubectl set image
  • Auto rolls back if the rollout fails

Notes

  • Zero cloud provider dependencies -works on Hetzner, AWS, DigitalOcean,
    or bare metal
  • Assumes wildcard DNS *.domain already points to the server IP

@BRAVO68WEB BRAVO68WEB left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure to test this once, also make sure to run other containers too

Comment thread scripts/deploy/init.sh
@@ -0,0 +1,158 @@
#!/bin/bash

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This script only creates the reverse proxy, It also needs to create pods for older container like postgres, clickstack, zetadel, etc

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review you're right, the deployment and service manifests for postgres, Zitadel, Redis, RustFS, and the app containers are missing. I'll add those to init.sh now.

@BRAVO68WEB
BRAVO68WEB self-requested a review March 28, 2026 06:54
@jmac052002

Copy link
Copy Markdown
Author

Updated added Deployment and Service manifests for all pods: postgres, redis, rustfs, zitadel, zitadel-db, openfga, openfga-db, minikms, minikms-db, envsync-api, and envsync-web. Also added a secrets manifest for MINIKMS_ROOT_KEY. Tested locally with k3d all infrastructure pods come up healthy, openfga-migrate completes successfully. envsync-api and envsync-web require the production .env values and a publicly accessible GHCR image to fully start.

@BRAVO68WEB
BRAVO68WEB self-requested a review April 1, 2026 18:37
@BRAVO68WEB BRAVO68WEB added the wontfix This will not be worked on label Apr 5, 2026
@EnvSync-Cloud EnvSync-Cloud locked as spam and limited conversation to collaborators Apr 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

wontfix This will not be worked on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants