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
145
.forgejo/workflows/build-all.yml
Normal file
145
.forgejo/workflows/build-all.yml
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
name: Build All Docker Images
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, develop ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
release:
|
||||
types: [ published ]
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
|
||||
jobs:
|
||||
changes:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
app: ${{ steps.changes.outputs.app }}
|
||||
node: ${{ steps.changes.outputs.node }}
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Check for changes
|
||||
uses: dorny/paths-filter@v2
|
||||
id: changes
|
||||
with:
|
||||
filters: |
|
||||
app:
|
||||
- 'app/**'
|
||||
- '.forgejo/workflows/build-all.yml'
|
||||
node:
|
||||
- 'node/**'
|
||||
- '.forgejo/workflows/build-all.yml'
|
||||
|
||||
build-app:
|
||||
needs: changes
|
||||
if: ${{ needs.changes.outputs.app == 'true' || github.event_name == 'workflow_dispatch' || github.event_name == 'release' }}
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Extract metadata for App
|
||||
id: meta-app
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ github.repository }}/frp-manager-app
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
|
||||
- name: Build and push App Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ./app
|
||||
file: ./app/Dockerfile
|
||||
push: true
|
||||
tags: ${{ steps.meta-app.outputs.tags }}
|
||||
labels: ${{ steps.meta-app.outputs.labels }}
|
||||
cache-from: type=gha,scope=app
|
||||
cache-to: type=gha,mode=max,scope=app
|
||||
platforms: linux/amd64,linux/arm64
|
||||
|
||||
build-node:
|
||||
needs: changes
|
||||
if: ${{ needs.changes.outputs.node == 'true' || github.event_name == 'workflow_dispatch' || github.event_name == 'release' }}
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Extract metadata for Node
|
||||
id: meta-node
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ github.repository }}/home-server-agent
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
|
||||
- name: Build and push Node Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ./node
|
||||
file: ./node/Dockerfile
|
||||
push: true
|
||||
tags: ${{ steps.meta-node.outputs.tags }}
|
||||
labels: ${{ steps.meta-node.outputs.labels }}
|
||||
cache-from: type=gha,scope=node
|
||||
cache-to: type=gha,mode=max,scope=node
|
||||
platforms: linux/amd64,linux/arm64
|
||||
|
||||
summary:
|
||||
needs: [build-app, build-node]
|
||||
if: always()
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Summary
|
||||
run: |
|
||||
echo "## Build Summary" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
echo "### App Build: ${{ needs.build-app.result }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "### Node Build: ${{ needs.build-node.result }}" >> $GITHUB_STEP_SUMMARY
|
||||
echo "" >> $GITHUB_STEP_SUMMARY
|
||||
if [ "${{ github.event_name }}" == "release" ]; then
|
||||
echo "### Release Images:" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- App: \`${{ env.REGISTRY }}/${{ github.repository }}/frp-manager-app:${{ github.ref_name }}\`" >> $GITHUB_STEP_SUMMARY
|
||||
echo "- Node: \`${{ env.REGISTRY }}/${{ github.repository }}/home-server-agent:${{ github.ref_name }}\`" >> $GITHUB_STEP_SUMMARY
|
||||
fi
|
||||
69
.forgejo/workflows/build-app.yml
Normal file
69
.forgejo/workflows/build-app.yml
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
name: Build and Push App Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, develop ]
|
||||
paths:
|
||||
- 'app/**'
|
||||
- '.forgejo/workflows/build-app.yml'
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
paths:
|
||||
- 'app/**'
|
||||
release:
|
||||
types: [ published ]
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}/frp-manager-app
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Extract metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ./app
|
||||
file: ./app/Dockerfile
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
platforms: linux/amd64,linux/arm64
|
||||
|
||||
- name: Update Docker Compose with new image
|
||||
if: github.event_name == 'release'
|
||||
run: |
|
||||
echo "Built and pushed image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}"
|
||||
echo "Update your docker-compose.yml to use: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}"
|
||||
69
.forgejo/workflows/build-node.yml
Normal file
69
.forgejo/workflows/build-node.yml
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
name: Build and Push Node Docker Image
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, develop ]
|
||||
paths:
|
||||
- 'node/**'
|
||||
- '.forgejo/workflows/build-node.yml'
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
paths:
|
||||
- 'node/**'
|
||||
release:
|
||||
types: [ published ]
|
||||
|
||||
env:
|
||||
REGISTRY: ghcr.io
|
||||
IMAGE_NAME: ${{ github.repository }}/home-server-agent
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Extract metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=ref,event=pr
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ./node
|
||||
file: ./node/Dockerfile
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
platforms: linux/amd64,linux/arm64
|
||||
|
||||
- name: Update Docker Compose with new image
|
||||
if: github.event_name == 'release'
|
||||
run: |
|
||||
echo "Built and pushed image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}"
|
||||
echo "Update your docker-compose.yml to use: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.ref_name }}"
|
||||
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
|
||||
104
.forgejo/workflows/test.yml
Normal file
104
.forgejo/workflows/test.yml
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
name: Test and Lint
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ main, develop ]
|
||||
pull_request:
|
||||
branches: [ main ]
|
||||
|
||||
jobs:
|
||||
test-app:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./app
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Node.js
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '20'
|
||||
cache: 'npm'
|
||||
cache-dependency-path: './app/package-lock.json'
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Type check
|
||||
run: npx tsc --noEmit
|
||||
|
||||
- name: Build application
|
||||
run: npm run build
|
||||
|
||||
- name: Run tests (if available)
|
||||
run: npm test --if-present
|
||||
continue-on-error: true
|
||||
|
||||
test-node:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./node
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Bun
|
||||
uses: oven-sh/setup-bun@v1
|
||||
with:
|
||||
bun-version: latest
|
||||
|
||||
- name: Install dependencies
|
||||
run: bun install
|
||||
|
||||
- name: Type check
|
||||
run: bunx tsc --noEmit
|
||||
|
||||
- name: Build application
|
||||
run: bun run build
|
||||
|
||||
- name: Run tests (if available)
|
||||
run: bun test --if-present
|
||||
continue-on-error: true
|
||||
|
||||
lint-dockerfiles:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Lint App Dockerfile
|
||||
uses: hadolint/hadolint-action@v3.1.0
|
||||
with:
|
||||
dockerfile: ./app/Dockerfile
|
||||
failure-threshold: warning
|
||||
|
||||
- name: Lint Node Dockerfile
|
||||
uses: hadolint/hadolint-action@v3.1.0
|
||||
with:
|
||||
dockerfile: ./node/Dockerfile
|
||||
failure-threshold: warning
|
||||
|
||||
security-scan:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Run Trivy vulnerability scanner
|
||||
uses: aquasecurity/trivy-action@master
|
||||
with:
|
||||
scan-type: 'fs'
|
||||
scan-ref: '.'
|
||||
format: 'sarif'
|
||||
output: 'trivy-results.sarif'
|
||||
|
||||
- name: Upload Trivy scan results
|
||||
uses: github/codeql-action/upload-sarif@v2
|
||||
if: always()
|
||||
with:
|
||||
sarif_file: 'trivy-results.sarif'
|
||||
Loading…
Add table
Add a link
Reference in a new issue