feat: integrate Forgejo and Woodpecker CI services with updated AWS security group rules

This commit is contained in:
vickytechkey 2026-08-08 17:31:02 +05:30
parent 0696bd4044
commit d4b58497c4
5 changed files with 110 additions and 2 deletions

View file

@ -31,8 +31,12 @@ export class AwsCdkStack extends cdk.Stack {
securityGroup.addIngressRule(ec2.Peer.anyIpv4(), ec2.Port.udp(5010), 'Allow WireGuard VPN'); securityGroup.addIngressRule(ec2.Peer.anyIpv4(), ec2.Port.udp(5010), 'Allow WireGuard VPN');
securityGroup.addIngressRule(ec2.Peer.anyIpv4(), ec2.Port.tcp(51821), 'Allow WireGuard Web UI'); securityGroup.addIngressRule(ec2.Peer.anyIpv4(), ec2.Port.tcp(51821), 'Allow WireGuard Web UI');
// Woodpecker CI // Woodpecker CI (Port 8000 open to public; Nginx on EC2 handles path-based security)
securityGroup.addIngressRule(ec2.Peer.ipv4('16.113.57.0/24'), ec2.Port.tcp(8000), 'Allow Woodpecker Web UI'); securityGroup.addIngressRule(ec2.Peer.anyIpv4(), ec2.Port.tcp(8000), 'Allow Woodpecker Reverse Proxy');
// Forgejo Git Service (Port 3000 open to public)
securityGroup.addIngressRule(ec2.Peer.anyIpv4(), ec2.Port.tcp(3000), 'Allow Forgejo Web UI');
securityGroup.addIngressRule(ec2.Peer.anyIpv4(), ec2.Port.tcp(2222), 'Allow Forgejo SSH');
// Django App Backends (Prod and Beta) // Django App Backends (Prod and Beta)
securityGroup.addIngressRule(ec2.Peer.ipv4('16.113.57.0/24'), ec2.Port.tcp(8080), 'Allow Django Beta Backend'); securityGroup.addIngressRule(ec2.Peer.ipv4('16.113.57.0/24'), ec2.Port.tcp(8080), 'Allow Django Beta Backend');

8
forgejo/.env.example Normal file
View file

@ -0,0 +1,8 @@
# External URL for accessing your Forgejo instance (e.g. http://16.113.57.127:3000)
FORGEJO_ROOT_URL=http://localhost:3000/
# MySQL Database connection parameters
FORGEJO_DB_HOST=your_mysql_host:3306
FORGEJO_DB_NAME=your_mysql_db_name
FORGEJO_DB_USER=your_mysql_user
FORGEJO_DB_PASSWORD=your_mysql_password

8
forgejo/Dockerfile Normal file
View file

@ -0,0 +1,8 @@
# Use the official Forgejo base image
FROM codeberg.org/forgejo/forgejo:9
# Expose the default HTTP port and SSH port
EXPOSE 3000 22
# Define volume for persistent data
VOLUME ["/data"]

View file

@ -0,0 +1,32 @@
services:
forgejo:
image: codeberg.org/forgejo/forgejo:9
container_name: forgejo
restart: always
environment:
# General Server Settings
- FORGEJO__server__RUN_MODE=prod
- FORGEJO__server__ROOT_URL=${FORGEJO_ROOT_URL:-http://16.113.57.127:3000/}
- FORGEJO__server__HTTP_PORT=3000
- FORGEJO__server__DOMAIN=16.113.57.127
# Database Configuration (MySQL/MariaDB connection)
- FORGEJO__database__DB_TYPE=mysql
- FORGEJO__database__HOST=${FORGEJO_DB_HOST}
- FORGEJO__database__NAME=${FORGEJO_DB_NAME}
- FORGEJO__database__USER=${FORGEJO_DB_USER}
- FORGEJO__database__PASSWD=${FORGEJO_DB_PASSWORD}
# Disable installer screen since we configure via environment/app.ini
- FORGEJO__security__INSTALL_LOCK=true
ports:
# Expose Forgejo HTTP port publicly
- "3000:3000"
# Expose SSH port
- "2222:22"
volumes:
- forgejo-data:/data
volumes:
forgejo-data:
driver: local

View file

@ -0,0 +1,56 @@
version: '3.8'
services:
woodpecker-server:
image: woodpeckerci/woodpecker-server:v3
container_name: woodpecker-server
user: "0:0"
restart: always
ports:
# Bind only to localhost (127.0.0.1) on port 8001 so it's not publicly accessible directly
- "127.0.0.1:8001:8000"
environment:
# The public address of your Woodpecker CI instance (e.g. http://16.113.57.127:8000)
- WOODPECKER_HOST=http://16.113.57.127:8000
# Disable open registration (requires users to be explicitly allowed)
- WOODPECKER_OPEN=false
# Initial administrator account (e.g. your GitHub username)
- WOODPECKER_ADMIN=tripro-lab
# Restrict login to members of these GitHub organizations/users (comma-separated list)
- WOODPECKER_ORGS=tripro-lab
# Shared secret between server and agent (Generate one using: openssl rand -hex 32)
- WOODPECKER_AGENT_SECRET=ba33ff589a3b7f36ebb4b8c30eab29573d038adb2c64f3dab3ed5ae384d7f70e
# GitHub OAuth Configuration (Create app in Github -> Developer Settings -> OAuth Apps)
- WOODPECKER_GITHUB=true
- WOODPECKER_GITHUB_CLIENT=Ov23liXzCGU0K7rytPN2
- WOODPECKER_GITHUB_SECRET=b915489c7ed2e149517b712f969f386bd2e8b2b4
# Database Configuration (MySQL Option B)
- WOODPECKER_DATABASE_DRIVER=mysql
- WOODPECKER_DATABASE_DATASOURCE=your_mysql_user:your_mysql_password@tcp(your_mysql_host:3306)/your_mysql_db_name?parseTime=true
volumes:
- woodpecker-server-data:/var/lib/woodpecker
woodpecker-agent:
image: woodpeckerci/woodpecker-agent:v3
container_name: woodpecker-agent
restart: always
depends_on:
- woodpecker-server
environment:
- WOODPECKER_SERVER=woodpecker-server:9000
# Must match the exact same secret defined in woodpecker-server above
- WOODPECKER_AGENT_SECRET=ba33ff589a3b7f36ebb4b8c30eab29573d038adb2c64f3dab3ed5ae384d7f70e
# Let the agent run Docker builds
- WOODPECKER_BACKEND=docker
volumes:
- /var/run/docker.sock:/var/run/docker.sock
volumes:
woodpecker-server-data:
driver: local