appaibuiltest/deployment-configs-appaibuiltest/README.md
Janus C. H. Knudsen b778d91196 fc
2026-01-30 22:56:31 +01:00

3.6 KiB

AppAIBuildTest - Deployment Configuration

Generated: 2026-01-30

Overview

This folder contains all configuration files needed to deploy AppAIBuildTest to your infrastructure:

  • Server: 192.168.1.43 (Ubuntu 24.04)
  • Forgejo: 192.168.1.63:3000
  • .NET Version: 9.0.x

Environments

TEST Environment

PROD Environment

Setup Instructions

1. Configure Forgejo Secrets

Go to your repository in Forgejo → Settings → Actions → Secrets

Required secrets (should already exist):

  • DEPLOY_HOST = 192.168.1.43
  • DEPLOY_USER = deploy
  • DEPLOY_SSH_KEY = SSH private key for deploy user

2. Copy Workflow to Repository

# In your repository
mkdir -p .forgejo/workflows
cp .forgejo/workflows/cicd.yml YOUR_REPO/.forgejo/workflows/
cd YOUR_REPO
git add .forgejo/workflows/cicd.yml
git commit -m "Add CI/CD workflow"
git push

3. Setup Server

# Copy files to server (via MobaXterm SFTP or scp)
# Upload: systemd, scripts folders to ~/appaibuiltest-setup/

# SSH to server
ssh your-user@192.168.1.43

# Create dotnet-service user (if not exists)
sudo useradd -r -s /bin/false dotnet-service

# Run setup script
cd ~/appaibuiltest-setup
chmod +x scripts/setup-server.sh
sudo ./scripts/setup-server.sh

# Setup script will automatically:
# - Install systemd services
# - Create app directories
# - Configure Caddy reverse proxy via API

Deployment

Deploy to TEST

git push origin main

Check deployment:

# On server
sudo systemctl status appaibuiltest-test
sudo journalctl -u appaibuiltest-test -n 50

# Test locally
curl http://127.0.0.1:5100

# Test via Caddy
curl http://test-appaibuiltest.jarjarbinks

Deploy to PROD

  1. Go to Forgejo → Repository → Actions
  2. Select the workflow
  3. Click Run workflow
  4. Confirm deployment

Check deployment:

# On server
sudo systemctl status appaibuiltest
sudo journalctl -u appaibuiltest -n 50

# Test locally
curl http://127.0.0.1:5200

# Test via Caddy
curl http://appaibuiltest.jarjarbinks

Troubleshooting

Service Issues

# TEST service
sudo systemctl status appaibuiltest-test
sudo journalctl -u appaibuiltest-test -n 100 -f

# PROD service
sudo systemctl status appaibuiltest
sudo journalctl -u appaibuiltest -n 100 -f

Check Ports

ss -lntp | grep 5100
ss -lntp | grep 5200

Restart Services

sudo systemctl restart appaibuiltest-test
sudo systemctl restart appaibuiltest
sudo systemctl reload caddy

File Structure

/opt/appaibuiltest-test/app/          # TEST deployment (owned by dotnet-service)
/opt/appaibuiltest/app/               # PROD deployment (owned by dotnet-service)
/etc/systemd/system/appaibuiltest-test.service
/etc/systemd/system/appaibuiltest.service
Caddy routes configured via API       # No manual Caddyfile editing needed

Technical Details

  • Service User: dotnet-service (restricted system user for running .NET apps)
  • Caddy Configuration: Via API (automatic, no manual file editing)
  • Deployment Method: rsync over SSH from Forgejo CI/CD
  • Process Manager: systemd with auto-restart