First
Some checks failed
Build All Docker Images / changes (push) Has been cancelled
Build and Push App Docker Image / build (push) Has been cancelled
Build and Push Node Docker Image / build (push) Has been cancelled
Test and Lint / test-app (push) Has been cancelled
Test and Lint / test-node (push) Has been cancelled
Test and Lint / lint-dockerfiles (push) Has been cancelled
Test and Lint / security-scan (push) Has been cancelled
Build All Docker Images / build-app (push) Has been cancelled
Build All Docker Images / build-node (push) Has been cancelled
Build All Docker Images / summary (push) Has been cancelled
Some checks failed
Build All Docker Images / changes (push) Has been cancelled
Build and Push App Docker Image / build (push) Has been cancelled
Build and Push Node Docker Image / build (push) Has been cancelled
Test and Lint / test-app (push) Has been cancelled
Test and Lint / test-node (push) Has been cancelled
Test and Lint / lint-dockerfiles (push) Has been cancelled
Test and Lint / security-scan (push) Has been cancelled
Build All Docker Images / build-app (push) Has been cancelled
Build All Docker Images / build-node (push) Has been cancelled
Build All Docker Images / summary (push) Has been cancelled
This commit is contained in:
commit
4169337dd0
68 changed files with 8726 additions and 0 deletions
157
.forgejo/workflows/deploy.yml
Normal file
157
.forgejo/workflows/deploy.yml
Normal file
|
|
@ -0,0 +1,157 @@
|
|||
name: Deploy to Production
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [ published ]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
environment:
|
||||
description: 'Environment to deploy to'
|
||||
required: true
|
||||
default: 'staging'
|
||||
type: choice
|
||||
options:
|
||||
- staging
|
||||
- production
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
environment: ${{ github.event.inputs.environment || 'production' }}
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set environment variables
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" == "release" ]; then
|
||||
echo "DEPLOY_ENV=production" >> $GITHUB_ENV
|
||||
echo "IMAGE_TAG=${{ github.ref_name }}" >> $GITHUB_ENV
|
||||
else
|
||||
echo "DEPLOY_ENV=${{ github.event.inputs.environment }}" >> $GITHUB_ENV
|
||||
echo "IMAGE_TAG=latest" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Create deployment package
|
||||
run: |
|
||||
mkdir -p deployment
|
||||
|
||||
# Copy docker-compose files
|
||||
cp app/docker-compose.yml deployment/docker-compose-app.yml
|
||||
cp node/docker-compose.yml deployment/docker-compose-node.yml
|
||||
|
||||
# Copy environment templates
|
||||
cp app/.env.example deployment/.env.app.example
|
||||
cp node/.env.example deployment/.env.node.example
|
||||
|
||||
# Create deployment script
|
||||
cat > deployment/deploy.sh << 'EOF'
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
REGISTRY="${{ env.REGISTRY }}"
|
||||
REPO="${{ github.repository }}"
|
||||
TAG="${{ env.IMAGE_TAG }}"
|
||||
|
||||
echo "Deploying FRP Manager to ${{ env.DEPLOY_ENV }}"
|
||||
echo "Using images: $REGISTRY/$REPO/frp-manager-app:$TAG and $REGISTRY/$REPO/home-server-agent:$TAG"
|
||||
|
||||
# Pull latest images
|
||||
docker pull $REGISTRY/$REPO/frp-manager-app:$TAG
|
||||
docker pull $REGISTRY/$REPO/home-server-agent:$TAG
|
||||
|
||||
# Update docker-compose files with new image references
|
||||
sed -i "s|build: \.|image: $REGISTRY/$REPO/frp-manager-app:$TAG|g" docker-compose-app.yml
|
||||
sed -i "s|build: \.|image: $REGISTRY/$REPO/home-server-agent:$TAG|g" docker-compose-node.yml
|
||||
|
||||
echo "Deployment package ready!"
|
||||
echo "1. Configure .env files based on .env.*.example"
|
||||
echo "2. Run: docker-compose -f docker-compose-app.yml up -d"
|
||||
echo "3. Run: docker-compose -f docker-compose-node.yml up -d (on home server)"
|
||||
EOF
|
||||
|
||||
chmod +x deployment/deploy.sh
|
||||
|
||||
- name: Create deployment documentation
|
||||
run: |
|
||||
cat > deployment/README.md << 'EOF'
|
||||
# FRP Manager Deployment Package
|
||||
|
||||
This package contains everything needed to deploy the FRP Manager application.
|
||||
|
||||
## Files
|
||||
|
||||
- `docker-compose-app.yml` - App deployment configuration
|
||||
- `docker-compose-node.yml` - Node deployment configuration
|
||||
- `.env.app.example` - App environment template
|
||||
- `.env.node.example` - Node environment template
|
||||
- `deploy.sh` - Deployment script
|
||||
|
||||
## Quick Start
|
||||
|
||||
### 1. App Server (VPS)
|
||||
```bash
|
||||
# Configure environment
|
||||
cp .env.app.example .env
|
||||
# Edit .env with your configuration
|
||||
|
||||
# Deploy
|
||||
docker-compose -f docker-compose-app.yml up -d
|
||||
```
|
||||
|
||||
### 2. Home Server
|
||||
```bash
|
||||
# Configure environment
|
||||
cp .env.node.example .env
|
||||
# Edit .env with your configuration
|
||||
|
||||
# Deploy
|
||||
docker-compose -f docker-compose-node.yml up -d
|
||||
```
|
||||
|
||||
## Environment Variables
|
||||
|
||||
See the `.env.*.example` files for required configuration.
|
||||
|
||||
**Important**: Set matching tokens for `NODE_TOKEN` (app) and `API_TOKEN` (node).
|
||||
|
||||
## Verification
|
||||
|
||||
1. Check app: `http://your-vps:3000`
|
||||
2. Check node: `http://your-home-server:3001/health`
|
||||
3. Test integration via the "Push to Node" button in the web interface
|
||||
|
||||
## Version
|
||||
|
||||
- App Image: `${{ env.REGISTRY }}/${{ github.repository }}/frp-manager-app:${{ env.IMAGE_TAG }}`
|
||||
- Node Image: `${{ env.REGISTRY }}/${{ github.repository }}/home-server-agent:${{ env.IMAGE_TAG }}`
|
||||
EOF
|
||||
|
||||
- name: Package deployment artifacts
|
||||
run: |
|
||||
tar -czf frp-manager-deployment-${{ env.IMAGE_TAG }}.tar.gz -C deployment .
|
||||
|
||||
- name: Upload deployment package
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: frp-manager-deployment-${{ env.DEPLOY_ENV }}-${{ env.IMAGE_TAG }}
|
||||
path: frp-manager-deployment-${{ env.IMAGE_TAG }}.tar.gz
|
||||
retention-days: 90
|
||||
|
||||
- name: Create deployment summary
|
||||
run: |
|
||||
echo "## Deployment Summary" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "**Environment:** ${{ env.DEPLOY_ENV }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "**Version:** ${{ env.IMAGE_TAG }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "### Images Built:" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- App: \`${{ env.REGISTRY }}/${{ github.repository }}/frp-manager-app:${{ env.IMAGE_TAG }}\`" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- Node: \`${{ env.REGISTRY }}/${{ github.repository }}/home-server-agent:${{ env.IMAGE_TAG }}\`" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "### Deployment Package:" >> $GITHUB_STEP_SUMMARY
|
||||
echo "Download the deployment artifact and follow the README.md instructions." >> $GITHUB_STEP_SUMMARY
|
||||
Loading…
Add table
Add a link
Reference in a new issue