mirror of
https://github.com/m1ngsama/automa.git
synced 2026-03-25 18:23:49 +00:00
Add services/ directory with deploy scripts for system-level infrastructure
services. Each script reads INFRA_DIR pointing to the corresponding infra
module, sources its .env, substitutes config templates via envsubst, and
installs/enables systemd services. Zero hardcoded values — public-safe.
New scripts:
- services/email/deploy.sh (Postfix + Dovecot + OpenDKIM + SpamAssassin)
- services/nginx/deploy.sh (Nginx vhosts via envsubst)
- services/shadowsocks/server/deploy.sh (shadowsocks-rust server)
- services/shadowsocks/client/deploy.sh (sslocal + privoxy chain)
- services/frp/server/deploy.sh (frps)
- services/frp/client/deploy.sh (frpc)
README: add "Relationship with infra" section explaining the two-repo workflow
Makefile: add deploy-email, deploy-nginx, deploy-ss-{server,client},
deploy-frp-{server,client} targets
Closes #6
34 lines
1.2 KiB
Bash
Executable file
34 lines
1.2 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Deploys frps (FRP server) on VPS.
|
|
# Usage: INFRA_DIR=/path/to/infra/services/frp/server ./deploy.sh
|
|
|
|
set -euo pipefail
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
source "$SCRIPT_DIR/../../../bin/lib/common.sh"
|
|
|
|
ENV_FILE="${INFRA_DIR:-.}/.env"
|
|
[ -f "$ENV_FILE" ] || { log_error "No .env found at $ENV_FILE"; exit 1; }
|
|
source "$ENV_FILE"
|
|
|
|
require_env FRP_TOKEN FRP_WEB_PASSWORD FRP_BIND_PORT
|
|
|
|
log_info "Downloading FRP..."
|
|
VERSION=$(curl -s https://api.github.com/repos/fatedier/frp/releases/latest \
|
|
| python3 -c "import sys,json; print(json.load(sys.stdin)['tag_name'][1:])")
|
|
ARCHIVE="frp_${VERSION}_linux_amd64.tar.gz"
|
|
wget -q "https://github.com/fatedier/frp/releases/download/v${VERSION}/${ARCHIVE}"
|
|
tar -xf "$ARCHIVE"
|
|
mkdir -p /opt/frp
|
|
cp "frp_${VERSION}_linux_amd64/frps" /opt/frp/
|
|
chmod +x /opt/frp/frps
|
|
rm -rf "$ARCHIVE" "frp_${VERSION}_linux_amd64"
|
|
|
|
log_info "Deploying config..."
|
|
envsubst < "${INFRA_DIR}/frps.toml.example" > /opt/frp/frps.toml
|
|
|
|
log_info "Installing service..."
|
|
cp "${INFRA_DIR}/frps.service" /etc/systemd/system/
|
|
systemctl daemon-reload
|
|
systemctl enable --now frps
|
|
|
|
log_info "FRP server deployed on port ${FRP_BIND_PORT}"
|