3.2 KiB
3.2 KiB
Infisical Secret Management
This guide shows how to run (and maintain) the self-hosted Infisical instance for VoxBlog. A production instance is already running on this VPS at https://secrets.pusula.blog with files under /home/adminuser/infisical.
1. Start Infisical
- Copy the sample environment:
cp infisical/.env.example infisical/.env - Edit
infisical/.envand set:INFISICAL_SITE_URL=https://secrets.pusula.blog.INFISICAL_POSTGRES_PASSWORD— database password (strong, unique).INFISICAL_AUTH_SECRET— 32-byte base64 secret (openssl rand -base64 32).- Leave
INFISICAL_ENCRYPTION_KEYblank and setINFISICAL_ROOT_ENCRYPTION_KEYto a 32-byte base64 secret (openssl rand -base64 32). - Set
INFISICAL_DATABASE_URL=postgresql://infisical:${INFISICAL_POSTGRES_PASSWORD}@postgres:5432/infisical.
- Boot the stack:
docker compose \ --env-file infisical/.env \ -f infisical/docker-compose.yml \ up -d - Point your reverse proxy (Caddy is already configured) at
http://127.0.0.1:8080so the public URL works over HTTPS.
2. Bootstrap Infisical
- Visit
INFISICAL_SITE_URLand create the initial admin account. - Create a Workspace (e.g.
voxblog). - Add environments you need (at least
production, maybestaging/development). - Inside each environment, create a secret path (e.g.
/) and add the VoxBlog variables:MYSQL_ROOT_PASSWORDMYSQL_PASSWORDADMIN_PASSWORDOPENAI_API_KEYGHOST_ADMIN_API_KEYGHOST_ADMIN_API_URLS3_BUCKETS3_REGIONS3_ACCESS_KEYS3_SECRET_KEYS3_ENDPOINTVITE_API_URL
3. Service Token for Automation
- In the workspace, open Integration → Service Tokens → Create Token.
- Scope the token to the
productionenvironment and the secret path containing the keys (usually/). - Copy the token value and store it somewhere safe—you will not see it again.
4. Wire Deployments
Gitea Actions
- In your VoxBlog repository, go to Settings → Secrets and add:
INFISICAL_TOKEN— the service token from the previous step.INFISICAL_SITE_URL—https://secrets.pusula.blog.
- No other secret variables are needed; the workflow now loads them dynamically before running Docker Compose.
Manual / Webhook Deployments
- On the VPS, export the token before running
deploy.sh:export INFISICAL_TOKEN=st.your_token_value export INFISICAL_SITE_URL=https://secrets.pusula.blog ./deploy.sh - The script prefers Infisical; it only falls back to
.envwhen no token is set, so consider removing any old.envfile from the server.
5. Rotating Secrets
- Update the value inside Infisical.
- Re-run the deployment pipeline (or
deploy.sh) so new containers launch with the rotated configuration. - Old values never touch disk—no extra clean-up is required.
6. Backups & Maintenance
- Backup the Postgres volume (
infisical-postgres-data) using your usual VPS backup process. - Protect the Infisical site with HTTPS and, ideally, IP allow-lists or SSO.
- Rotate the service token periodically; update the Gitea secret and any server-side exports at the same time.