Restructure repository to manage both server2 and caddy-vps
Deploy / security (push) Failing after 11m14s
Deploy / lint (push) Failing after 12m3s
Deploy / deploy (push) Has been skipped

- Create server2/ directory and migrate Xray proxy config, Clash config, and utility scripts
- Create caddy-vps/ directory and add Caddyfile reverse proxy configuration
- Update .gitea/workflows/deploy.yml CI/CD pipeline to validate JSON/YAML and check Caddyfile formatting/syntax
- Deploy configurations sequentially to both servers
- Update README.md to document multi-server topology and CI/CD behavior

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Gan, Jimmy
2026-06-03 03:19:18 +08:00
parent 55a8dbc457
commit 4a91c7a186
11 changed files with 158 additions and 66 deletions
+23 -8
View File
@@ -14,10 +14,18 @@ jobs:
run: |
git clone http://gitea:3000/jimmy/vps-oracle-jp.git .
git checkout ${{ github.sha }}
- name: Validate JSON
run: python3 -c "import json; json.load(open('xray-config.json'))"
- name: Validate YAML
run: pip install pyyaml -q --break-system-packages && python3 -c "import yaml; yaml.safe_load(open('clash-meta.yaml'))"
- name: Validate JSON (Xray)
run: python3 -c "import json; json.load(open('server2/xray-config.json'))"
- name: Validate YAML (Clash Meta)
run: pip install pyyaml -q --break-system-packages && python3 -c "import yaml; yaml.safe_load(open('server2/clash-meta.yaml'))"
- name: Install Caddy for validation
run: |
curl -L -o caddy "https://caddyserver.com/api/download?os=linux&arch=amd64"
chmod +x caddy
- name: Validate Caddyfile formatting
run: ./caddy fmt --check caddy-vps/Caddyfile
- name: Validate Caddyfile syntax
run: ./caddy validate --config caddy-vps/Caddyfile --adapter caddyfile
security:
runs-on: ubuntu-latest
@@ -32,7 +40,7 @@ jobs:
- name: Check for secrets
run: |
FOUND=0
if grep -rE '-----BEGIN (RSA |EC |OPENSSH )?PRIVATE KEY-----' --include='*.json' --include='*.yaml' --include='*.yml' --include='*.md' .; then
if grep -rE '-----BEGIN (RSA |EC |OPENSSH )?PRIVATE KEY-----' --include='*.json' --include='*.yaml' --include='*.yml' --include='*.md' --include='Caddyfile' .; then
echo "ERROR: Private key found in repo"
FOUND=1
fi
@@ -49,7 +57,7 @@ jobs:
run: |
git clone http://gitea:3000/jimmy/vps-oracle-jp.git .
git checkout ${{ github.sha }}
- name: Deploy xray config
- name: Setup SSH
env:
VPS_SSH_KEY: ${{ secrets.VPS_SSH_KEY }}
run: |
@@ -57,5 +65,12 @@ jobs:
echo "$VPS_SSH_KEY" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
ssh-keyscan -H 158.101.140.85 >> ~/.ssh/known_hosts 2>/dev/null
scp xray-config.json jimmyg@158.101.140.85:/tmp/xray-config.json
ssh jimmyg@158.101.140.85 "sudo cp /tmp/xray-config.json /usr/local/etc/xray/config.json && sudo chmod 644 /usr/local/etc/xray/config.json && sudo systemctl restart xray"
ssh-keyscan -H 161.33.182.109 >> ~/.ssh/known_hosts 2>/dev/null
- name: Deploy Xray config to server2
run: |
scp server2/xray-config.json jimmyg@158.101.140.85:/tmp/xray-config.json
ssh jimmyg@158.101.140.85 "sudo cp /tmp/xray-config.json /usr/local/etc/xray/config.json && sudo chmod 600 /usr/local/etc/xray/config.json && sudo systemctl restart xray"
- name: Deploy Caddy config to caddy-vps
run: |
scp caddy-vps/Caddyfile ubuntu@161.33.182.109:/tmp/Caddyfile
ssh ubuntu@161.33.182.109 "sudo cp /tmp/Caddyfile /etc/caddy/Caddyfile && sudo chmod 644 /etc/caddy/Caddyfile && sudo systemctl reload caddy"