feat(system): add systemd service and installation script

- Add gitks systemd service unit file with security sandboxing
- Create environment configuration template for gitks service
- Add logrotate configuration for gitks application logs
- Implement installation script with service user creation
- Set up proper directory permissions and file ownership
- Configure automatic service startup and systemd integration
This commit is contained in:
zhenyi
2026-06-08 21:27:54 +08:00
parent c2487ec0b6
commit eeb4d9f902
5 changed files with 248 additions and 225 deletions
+35
View File
@@ -0,0 +1,35 @@
# GitKS environment configuration
#
# This file is sourced by systemd via EnvironmentFile.
# Uncomment and adjust values as needed.
#
# Location: /etc/gitks/gitks.env
# Permissions: 0640 root:gitks
REPO_PREFIX_PATH=/data/repos
GITKS_HOST=0.0.0.0
GITKS_PORT=50051
# GITKS_ADVERTISE_ADDR=http://node1.example.com:50051
GITKS_METRICS_PORT=9100
GITKS_CLUSTER_PORT=4697
GITKS_CLUSTER_COOKIE=gitks-default-cookie
# GITKS_CLUSTER_HOSTNAME=node1.example.com
GITKS_ETCD_ENDPOINTS=http://localhost:2379
GITKS_ETCD_CONNECT_TIMEOUT=5000
GITKS_LEASE_TTL=15
GITKS_HEALTH_CHECK_INTERVAL=1
GITKS_MAX_HEALTH_FAILURES=10
GITKS_DISK_CACHE_ENABLED=false
GITKS_DISK_CACHE_MAX_AGE=300
GITKS_PACK_CACHE_ENABLED=false
GITKS_PACK_CACHE_BACKPRESSURE=true
GITKS_HOOKS_ENABLED=true
GITKS_HOOK_TIMEOUT=30
GITKS_ALLOW_CUSTOM_HOOKS=true
# GITKS_SERVER_HOOKS_DIR=/etc/gitks/hooks
# GITKS_HOOK_CALLBACK_ADDR=http://localhost:50052
GITKS_RATE_LIMIT_MAX_CONCURRENT=200
# === LOGGING ===
RUST_LOG=info