mirror of
https://github.com/Govor-team/Govor.git
synced 2026-11-16 20:56:03 +00:00
Add E2EE messaging and VPS deployment
Add signed, encrypted messages and attachments with per-session device keys, conversation key discovery, and server-side validation. Extend CI to publish immutable container images and deploy to a VPS, with setup and protocol documentation.
This commit is contained in:
@@ -0,0 +1,3 @@
|
||||
{$GOVOR_DOMAIN} {
|
||||
reverse_proxy api:8080
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
name: govor
|
||||
|
||||
services:
|
||||
api:
|
||||
image: ${GOVOR_IMAGE:?Set GOVOR_IMAGE to the published image digest}
|
||||
restart: unless-stopped
|
||||
env_file:
|
||||
- /opt/govor/shared/runtime.env
|
||||
environment:
|
||||
ASPNETCORE_ENVIRONMENT: Production
|
||||
ASPNETCORE_HTTP_PORTS: "8080"
|
||||
volumes:
|
||||
- type: bind
|
||||
source: /opt/govor/data/logs
|
||||
target: /app/logs
|
||||
bind:
|
||||
create_host_path: false
|
||||
- type: bind
|
||||
source: /opt/govor/data/uploads
|
||||
target: /app/uploads
|
||||
bind:
|
||||
create_host_path: false
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "--fail", "--silent", "--show-error", "--max-time", "5", "http://127.0.0.1:8080/server/ready"]
|
||||
interval: 10s
|
||||
timeout: 6s
|
||||
start_period: 20s
|
||||
retries: 12
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
|
||||
proxy:
|
||||
image: caddy:2
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
GOVOR_DOMAIN: ${GOVOR_DOMAIN:?Set GOVOR_DOMAIN in shared/deploy.env}
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
volumes:
|
||||
- ./Caddyfile:/etc/caddy/Caddyfile:ro
|
||||
- caddy_data:/data
|
||||
- caddy_config:/config
|
||||
depends_on:
|
||||
api:
|
||||
condition: service_healthy
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
|
||||
volumes:
|
||||
caddy_data:
|
||||
caddy_config:
|
||||
@@ -0,0 +1 @@
|
||||
GOVOR_DOMAIN=api.example.com
|
||||
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
set -Eeuo pipefail
|
||||
umask 077
|
||||
|
||||
release_dir="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
||||
image="${1:?Usage: bash deploy.sh ghcr.io/owner/repo@sha256:digest}"
|
||||
[[ "$image" =~ ^ghcr\.io/[a-z0-9._/-]+@sha256:[a-f0-9]{64}$ ]] || {
|
||||
echo "Expected an immutable GHCR image digest" >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# The lock also protects against simultaneous manual and Actions deployments.
|
||||
exec 9>/opt/govor/deploy.lock
|
||||
flock -w 600 9
|
||||
test -s /opt/govor/shared/runtime.env
|
||||
test -s /opt/govor/shared/deploy.env
|
||||
test -d /opt/govor/data/logs
|
||||
test -d /opt/govor/data/uploads
|
||||
printf 'GOVOR_IMAGE=%s\n' "$image" > "$release_dir/image.env"
|
||||
|
||||
compose=(docker compose --project-name govor
|
||||
--env-file /opt/govor/shared/deploy.env
|
||||
--env-file "$release_dir/image.env"
|
||||
-f "$release_dir/compose.yaml")
|
||||
|
||||
# Validate silently: rendered config contains runtime secrets.
|
||||
"${compose[@]}" config --quiet
|
||||
"${compose[@]}" pull
|
||||
# A migration failure leaves the existing API container running.
|
||||
"${compose[@]}" run --rm --no-deps api --migrate-only
|
||||
"${compose[@]}" up -d --wait --wait-timeout 180
|
||||
# Check readiness again, independently of container startup order.
|
||||
"${compose[@]}" exec -T api curl --fail --silent --show-error --max-time 5 http://127.0.0.1:8080/server/ready
|
||||
|
||||
# Keep successful release configuration for a manual rollback.
|
||||
ln -sfn "$release_dir" /opt/govor/current
|
||||
echo "Deployment ready: $image"
|
||||
Reference in New Issue
Block a user