Compare commits
2 Commits
e490405dc5
...
22b308803c
| Author | SHA1 | Date | |
|---|---|---|---|
|
22b308803c
|
|||
|
2dfde555dd
|
@@ -46,6 +46,10 @@ services:
|
|||||||
networks:
|
networks:
|
||||||
- cloudreve
|
- cloudreve
|
||||||
- caddy_network
|
- caddy_network
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: 1G
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis:latest
|
image: redis:latest
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ services:
|
|||||||
image: nextcloud
|
image: nextcloud
|
||||||
container_name: nextcloud
|
container_name: nextcloud
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
networks:
|
networks:
|
||||||
- nextcloud
|
- nextcloud
|
||||||
- caddy_network
|
- caddy_network
|
||||||
depends_on:
|
depends_on:
|
||||||
@@ -35,7 +35,7 @@ services:
|
|||||||
container_name: nextcloud-db
|
container_name: nextcloud-db
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
|
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
|
||||||
networks:
|
networks:
|
||||||
- nextcloud
|
- nextcloud
|
||||||
volumes:
|
volumes:
|
||||||
- {{ nextcloud_data_dir }}/database:/var/lib/mysql
|
- {{ nextcloud_data_dir }}/database:/var/lib/mysql
|
||||||
@@ -56,8 +56,8 @@ services:
|
|||||||
image: redis:alpine
|
image: redis:alpine
|
||||||
container_name: redis
|
container_name: redis
|
||||||
volumes:
|
volumes:
|
||||||
- {{ nextcloud_data_dir }}/redis:/data
|
- {{ nextcloud_data_dir }}/redis:/data
|
||||||
networks:
|
networks:
|
||||||
- nextcloud
|
- nextcloud
|
||||||
deploy:
|
deploy:
|
||||||
resources:
|
resources:
|
||||||
|
|||||||
47
ansible/tasks/servers/services/sathub/.env.j2
Normal file
47
ansible/tasks/servers/services/sathub/.env.j2
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
# Production Environment Variables
|
||||||
|
# Copy this to .env and fill in your values
|
||||||
|
|
||||||
|
# Database configuration (PostgreSQL)
|
||||||
|
DB_TYPE=postgres
|
||||||
|
DB_HOST=postgres
|
||||||
|
DB_PORT=5432
|
||||||
|
DB_USER=sathub
|
||||||
|
DB_PASSWORD={{ lookup('community.general.onepassword', 'sathub', vault='Dotfiles', field='DB_PASSWORD') }}
|
||||||
|
DB_NAME=sathub
|
||||||
|
|
||||||
|
# Required: JWT secret for token signing
|
||||||
|
JWT_SECRET={{ lookup('community.general.onepassword', 'sathub', vault='Dotfiles', field='JWT_SECRET') }}
|
||||||
|
|
||||||
|
# Required: Two-factor authentication encryption key
|
||||||
|
TWO_FA_ENCRYPTION_KEY={{ lookup('community.general.onepassword', 'sathub', vault='Dotfiles', field='TWO_FA_ENCRYPTION_KEY') }}
|
||||||
|
|
||||||
|
# Email configuration (required for password resets)
|
||||||
|
SMTP_HOST={{ lookup('community.general.onepassword', 'sathub', vault='Dotfiles', field='SMTP_HOST') }}
|
||||||
|
SMTP_PORT={{ lookup('community.general.onepassword', 'sathub', vault='Dotfiles', field='SMTP_PORT') }}
|
||||||
|
SMTP_USERNAME={{ lookup('community.general.onepassword', 'sathub', vault='Dotfiles', field='SMTP_USERNAME') }}
|
||||||
|
SMTP_PASSWORD={{ lookup('community.general.onepassword', 'sathub', vault='Dotfiles', field='SMTP_PASSWORD') }}
|
||||||
|
SMTP_FROM_EMAIL={{ lookup('community.general.onepassword', 'sathub', vault='Dotfiles', field='SMTP_FROM_EMAIL') }}
|
||||||
|
|
||||||
|
# MinIO Object Storage configuration
|
||||||
|
MINIO_ROOT_USER={{ lookup('community.general.onepassword', 'sathub', vault='Dotfiles', field='MINIO_ROOT_USER') }}
|
||||||
|
MINIO_ROOT_PASSWORD={{ lookup('community.general.onepassword', 'sathub', vault='Dotfiles', field='MINIO_ROOT_PASSWORD') }}
|
||||||
|
# Basically the same as the above
|
||||||
|
MINIO_ACCESS_KEY={{ lookup('community.general.onepassword', 'sathub', vault='Dotfiles', field='MINIO_ROOT_USER') }}
|
||||||
|
MINIO_SECRET_KEY={{ lookup('community.general.onepassword', 'sathub', vault='Dotfiles', field='MINIO_ROOT_PASSWORD') }}
|
||||||
|
|
||||||
|
# GitHub credentials for Watchtower (auto-updates)
|
||||||
|
GITHUB_USER={{ lookup('community.general.onepassword', 'sathub', vault='Dotfiles', field='GITHUB_USER') }}
|
||||||
|
GITHUB_PAT={{ lookup('community.general.onepassword', 'sathub', vault='Dotfiles', field='GITHUB_PAT') }}
|
||||||
|
REPO_USER={{ lookup('community.general.onepassword', 'sathub', vault='Dotfiles', field='GITHUB_USER') }}
|
||||||
|
REPO_PASS={{ lookup('community.general.onepassword', 'sathub', vault='Dotfiles', field='GITHUB_PAT') }}
|
||||||
|
|
||||||
|
# Optional: Override defaults if needed
|
||||||
|
# GIN_MODE=release (set automatically)
|
||||||
|
FRONTEND_URL=https://sathub.de
|
||||||
|
|
||||||
|
# CORS configuration (optional - additional allowed origins)
|
||||||
|
CORS_ALLOWED_ORIGINS=https://sathub.de,https://sathub.nl,https://api.sathub.de
|
||||||
|
|
||||||
|
# Frontend configuration (optional - defaults are provided)
|
||||||
|
VITE_API_BASE_URL=https://api.sathub.de
|
||||||
|
VITE_ALLOWED_HOSTS=sathub.de,sathub.nl
|
||||||
@@ -1,43 +1,108 @@
|
|||||||
services:
|
services:
|
||||||
backend:
|
# Migration service - runs once on stack startup
|
||||||
|
migrate:
|
||||||
image: ghcr.io/vleeuwenmenno/sathub/backend:latest
|
image: ghcr.io/vleeuwenmenno/sathub/backend:latest
|
||||||
container_name: sathub-backend
|
container_name: sathub-migrate
|
||||||
restart: unless-stopped
|
restart: "no"
|
||||||
|
command: ["./main", "auto-migrate"]
|
||||||
environment:
|
environment:
|
||||||
- GIN_MODE=release
|
- GIN_MODE=release
|
||||||
- FRONTEND_URL=${FRONTEND_URL:-https://sathub.de}
|
|
||||||
- CORS_ALLOWED_ORIGINS={{ cors_allowed_origins | default('') }}
|
|
||||||
|
|
||||||
# Database settings
|
# Database settings
|
||||||
- DB_TYPE=postgres
|
- DB_TYPE=postgres
|
||||||
- DB_HOST=postgres
|
- DB_HOST=postgres
|
||||||
- DB_PORT=5432
|
- DB_PORT=5432
|
||||||
- DB_USER=${DB_USER:-sathub}
|
- DB_USER=${DB_USER:-sathub}
|
||||||
- DB_PASSWORD={{ lookup('community.general.onepassword', 'sathub', vault='Dotfiles', field='DB_PASSWORD') }}
|
- DB_PASSWORD=${DB_PASSWORD}
|
||||||
- DB_NAME=${DB_NAME:-sathub}
|
- DB_NAME=${DB_NAME:-sathub}
|
||||||
|
|
||||||
# Security settings
|
|
||||||
- JWT_SECRET={{ lookup('community.general.onepassword', 'sathub', vault='Dotfiles', field='JWT_SECRET') }}
|
|
||||||
- TWO_FA_ENCRYPTION_KEY={{ lookup('community.general.onepassword', 'sathub', vault='Dotfiles', field='TWO_FA_ENCRYPTION_KEY') }}
|
|
||||||
|
|
||||||
# SMTP settings
|
|
||||||
- SMTP_HOST={{ lookup('community.general.onepassword', 'sathub', vault='Dotfiles', field='SMTP_HOST') }}
|
|
||||||
- SMTP_PORT={{ lookup('community.general.onepassword', 'sathub', vault='Dotfiles', field='SMTP_PORT') }}
|
|
||||||
- SMTP_USERNAME={{ lookup('community.general.onepassword', 'sathub', vault='Dotfiles', field='SMTP_USERNAME') }}
|
|
||||||
- SMTP_PASSWORD={{ lookup('community.general.onepassword', 'sathub', vault='Dotfiles', field='SMTP_PASSWORD') }}
|
|
||||||
- SMTP_FROM_EMAIL={{ lookup('community.general.onepassword', 'sathub', vault='Dotfiles', field='SMTP_FROM_EMAIL') }}
|
|
||||||
|
|
||||||
# MinIO settings
|
# MinIO settings
|
||||||
- MINIO_ENDPOINT=http://minio:9000
|
- MINIO_ENDPOINT=http://minio:9000
|
||||||
- MINIO_BUCKET=sathub-images
|
- MINIO_BUCKET=sathub-images
|
||||||
- MINIO_ACCESS_KEY={{ lookup('community.general.onepassword', 'sathub', vault='Dotfiles', field='MINIO_ROOT_USER') }}
|
- MINIO_ACCESS_KEY=${MINIO_ACCESS_KEY}
|
||||||
- MINIO_SECRET_KEY={{ lookup('community.general.onepassword', 'sathub', vault='Dotfiles', field='MINIO_ROOT_PASSWORD') }}
|
- MINIO_SECRET_KEY=${MINIO_SECRET_KEY}
|
||||||
|
- MINIO_EXTERNAL_URL=https://obj.sathub.de
|
||||||
|
networks:
|
||||||
|
- sathub
|
||||||
|
depends_on:
|
||||||
|
- postgres
|
||||||
|
|
||||||
|
backend:
|
||||||
|
image: ghcr.io/vleeuwenmenno/sathub/backend:latest
|
||||||
|
container_name: sathub-backend
|
||||||
|
restart: unless-stopped
|
||||||
|
command: ["./main", "api"]
|
||||||
|
environment:
|
||||||
|
- GIN_MODE=release
|
||||||
|
- FRONTEND_URL=${FRONTEND_URL:-https://sathub.de}
|
||||||
|
- CORS_ALLOWED_ORIGINS=${CORS_ALLOWED_ORIGINS:-https://sathub.de}
|
||||||
|
|
||||||
|
# Database settings
|
||||||
|
- DB_TYPE=postgres
|
||||||
|
- DB_HOST=postgres
|
||||||
|
- DB_PORT=5432
|
||||||
|
- DB_USER=${DB_USER:-sathub}
|
||||||
|
- DB_PASSWORD=${DB_PASSWORD}
|
||||||
|
- DB_NAME=${DB_NAME:-sathub}
|
||||||
|
|
||||||
|
# Security settings
|
||||||
|
- JWT_SECRET=${JWT_SECRET}
|
||||||
|
- TWO_FA_ENCRYPTION_KEY=${TWO_FA_ENCRYPTION_KEY}
|
||||||
|
|
||||||
|
# SMTP settings
|
||||||
|
- SMTP_HOST=${SMTP_HOST}
|
||||||
|
- SMTP_PORT=${SMTP_PORT}
|
||||||
|
- SMTP_USERNAME=${SMTP_USERNAME}
|
||||||
|
- SMTP_PASSWORD=${SMTP_PASSWORD}
|
||||||
|
- SMTP_FROM_EMAIL=${SMTP_FROM_EMAIL}
|
||||||
|
|
||||||
|
# MinIO settings
|
||||||
|
- MINIO_ENDPOINT=http://minio:9000
|
||||||
|
- MINIO_BUCKET=sathub-images
|
||||||
|
- MINIO_ACCESS_KEY=${MINIO_ACCESS_KEY}
|
||||||
|
- MINIO_SECRET_KEY=${MINIO_SECRET_KEY}
|
||||||
- MINIO_EXTERNAL_URL=https://obj.sathub.de
|
- MINIO_EXTERNAL_URL=https://obj.sathub.de
|
||||||
networks:
|
networks:
|
||||||
- sathub
|
- sathub
|
||||||
- caddy_network
|
- caddy_network
|
||||||
depends_on:
|
depends_on:
|
||||||
- postgres
|
migration:
|
||||||
|
condition: service_completed_successfully
|
||||||
|
|
||||||
|
worker:
|
||||||
|
image: ghcr.io/vleeuwenmenno/sathub/backend:latest
|
||||||
|
container_name: sathub-worker
|
||||||
|
restart: unless-stopped
|
||||||
|
command: ["./main", "worker"]
|
||||||
|
environment:
|
||||||
|
- GIN_MODE=release
|
||||||
|
|
||||||
|
# Database settings
|
||||||
|
- DB_TYPE=postgres
|
||||||
|
- DB_HOST=postgres
|
||||||
|
- DB_PORT=5432
|
||||||
|
- DB_USER=${DB_USER:-sathub}
|
||||||
|
- DB_PASSWORD=${DB_PASSWORD}
|
||||||
|
- DB_NAME=${DB_NAME:-sathub}
|
||||||
|
|
||||||
|
# SMTP settings (needed for notifications)
|
||||||
|
- SMTP_HOST=${SMTP_HOST}
|
||||||
|
- SMTP_PORT=${SMTP_PORT}
|
||||||
|
- SMTP_USERNAME=${SMTP_USERNAME}
|
||||||
|
- SMTP_PASSWORD=${SMTP_PASSWORD}
|
||||||
|
- SMTP_FROM_EMAIL=${SMTP_FROM_EMAIL}
|
||||||
|
|
||||||
|
# MinIO settings
|
||||||
|
- MINIO_ENDPOINT=http://minio:9000
|
||||||
|
- MINIO_BUCKET=sathub-images
|
||||||
|
- MINIO_ACCESS_KEY=${MINIO_ACCESS_KEY}
|
||||||
|
- MINIO_SECRET_KEY=${MINIO_SECRET_KEY}
|
||||||
|
- MINIO_EXTERNAL_URL=https://obj.sathub.de
|
||||||
|
networks:
|
||||||
|
- sathub
|
||||||
|
depends_on:
|
||||||
|
migration:
|
||||||
|
condition: service_completed_successfully
|
||||||
|
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:15-alpine
|
image: postgres:15-alpine
|
||||||
@@ -45,10 +110,10 @@ services:
|
|||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
- POSTGRES_USER=${DB_USER:-sathub}
|
- POSTGRES_USER=${DB_USER:-sathub}
|
||||||
- POSTGRES_PASSWORD={{ lookup('community.general.onepassword', 'sathub', vault='Dotfiles', field='DB_PASSWORD') }}
|
- POSTGRES_PASSWORD=${DB_PASSWORD}
|
||||||
- POSTGRES_DB=${DB_NAME:-sathub}
|
- POSTGRES_DB=${DB_NAME:-sathub}
|
||||||
volumes:
|
volumes:
|
||||||
- {{ sathub_data_dir }}/postgres:/var/lib/postgresql/data
|
- postgres_data:/var/lib/postgresql/data
|
||||||
networks:
|
networks:
|
||||||
- sathub
|
- sathub
|
||||||
|
|
||||||
@@ -57,8 +122,8 @@ services:
|
|||||||
container_name: sathub-frontend
|
container_name: sathub-frontend
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
- VITE_API_BASE_URL={{ frontend_api_base_url | default('https://api.sathub.de') }}
|
- VITE_API_BASE_URL=${VITE_API_BASE_URL:-https://api.sathub.de}
|
||||||
- VITE_ALLOWED_HOSTS={{ frontend_allowed_hosts | default('sathub.de,sathub.nl') }}
|
- VITE_ALLOWED_HOSTS=${VITE_ALLOWED_HOSTS:-sathub.de,sathub.nl}
|
||||||
networks:
|
networks:
|
||||||
- sathub
|
- sathub
|
||||||
- caddy_network
|
- caddy_network
|
||||||
@@ -68,10 +133,10 @@ services:
|
|||||||
container_name: sathub-minio
|
container_name: sathub-minio
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
environment:
|
environment:
|
||||||
- MINIO_ROOT_USER={{ lookup('community.general.onepassword', 'sathub', vault='Dotfiles', field='MINIO_ROOT_USER') }}
|
- MINIO_ROOT_USER=${MINIO_ROOT_USER}
|
||||||
- MINIO_ROOT_PASSWORD={{ lookup('community.general.onepassword', 'sathub', vault='Dotfiles', field='MINIO_ROOT_PASSWORD') }}
|
- MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD}
|
||||||
volumes:
|
volumes:
|
||||||
- {{ sathub_data_dir }}/minio:/data
|
- minio_data:/data
|
||||||
command: server /data --console-address :9001
|
command: server /data --console-address :9001
|
||||||
networks:
|
networks:
|
||||||
- sathub
|
- sathub
|
||||||
@@ -87,15 +152,25 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
- WATCHTOWER_CLEANUP=true
|
- WATCHTOWER_CLEANUP=true
|
||||||
- WATCHTOWER_INCLUDE_STOPPED=false
|
- WATCHTOWER_INCLUDE_STOPPED=false
|
||||||
- REPO_USER={{ lookup('community.general.onepassword', 'sathub', vault='Dotfiles', field='GITHUB_USER') }}
|
- REPO_USER=${REPO_USER}
|
||||||
- REPO_PASS={{ lookup('community.general.onepassword', 'sathub', vault='Dotfiles', field='GITHUB_PAT') }}
|
- REPO_PASS=${REPO_PASS}
|
||||||
command: --interval 30 --cleanup --include-stopped=false sathub-backend sathub-frontend
|
command: --interval 30 --cleanup --include-stopped=false sathub-backend sathub-worker sathub-frontend
|
||||||
networks:
|
networks:
|
||||||
- sathub
|
- sathub
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
minio_data:
|
||||||
|
driver: local
|
||||||
|
postgres_data:
|
||||||
|
driver: local
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
sathub:
|
sathub:
|
||||||
driver: bridge
|
driver: bridge
|
||||||
|
|
||||||
|
# We assume you're running a Caddy instance in a separate compose file with this network
|
||||||
|
# If not, you can remove this network and the related depends_on in the services above
|
||||||
|
# But the stack is designed to run behind a Caddy reverse proxy for SSL termination and routing
|
||||||
caddy_network:
|
caddy_network:
|
||||||
external: true
|
external: true
|
||||||
name: caddy_default
|
name: caddy_default
|
||||||
|
|||||||
@@ -24,6 +24,13 @@
|
|||||||
state: directory
|
state: directory
|
||||||
mode: "0755"
|
mode: "0755"
|
||||||
|
|
||||||
|
- name: Deploy SatHub .env
|
||||||
|
ansible.builtin.template:
|
||||||
|
src: .env.j2
|
||||||
|
dest: "{{ sathub_service_dir }}/.env"
|
||||||
|
mode: "0644"
|
||||||
|
register: sathub_env
|
||||||
|
|
||||||
- name: Deploy SatHub docker-compose.yml
|
- name: Deploy SatHub docker-compose.yml
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: docker-compose.yml.j2
|
src: docker-compose.yml.j2
|
||||||
@@ -33,11 +40,11 @@
|
|||||||
|
|
||||||
- name: Stop SatHub service
|
- name: Stop SatHub service
|
||||||
ansible.builtin.command: docker compose -f "{{ sathub_service_dir }}/docker-compose.yml" down --remove-orphans
|
ansible.builtin.command: docker compose -f "{{ sathub_service_dir }}/docker-compose.yml" down --remove-orphans
|
||||||
when: sathub_compose.changed
|
when: sathub_compose.changed or sathub_env.changed
|
||||||
|
|
||||||
- name: Start SatHub service
|
- name: Start SatHub service
|
||||||
ansible.builtin.command: docker compose -f "{{ sathub_service_dir }}/docker-compose.yml" up -d
|
ansible.builtin.command: docker compose -f "{{ sathub_service_dir }}/docker-compose.yml" up -d
|
||||||
when: sathub_compose.changed
|
when: sathub_compose.changed or sathub_env.changed
|
||||||
tags:
|
tags:
|
||||||
- services
|
- services
|
||||||
- sathub
|
- sathub
|
||||||
|
|||||||
Reference in New Issue
Block a user