fc
This commit is contained in:
parent
0015585819
commit
b778d91196
88 changed files with 84184 additions and 0 deletions
160
deployment-configs-appaibuiltest/README.md
Normal file
160
deployment-configs-appaibuiltest/README.md
Normal file
|
|
@ -0,0 +1,160 @@
|
|||
# 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
|
||||
- **Port:** 5100
|
||||
- **Domain:** http://test-appaibuiltest.jarjarbinks
|
||||
- **Folder:** /opt/appaibuiltest-test/app
|
||||
- **Service:** appaibuiltest-test
|
||||
- **Deploy:** Automatic on `git push` to main
|
||||
|
||||
### PROD Environment
|
||||
- **Port:** 5200
|
||||
- **Domain:** http://appaibuiltest.jarjarbinks
|
||||
- **Folder:** /opt/appaibuiltest/app
|
||||
- **Service:** appaibuiltest
|
||||
- **Deploy:** Manual via workflow_dispatch
|
||||
|
||||
## 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
|
||||
|
||||
```bash
|
||||
# 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
|
||||
|
||||
```bash
|
||||
# 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
|
||||
|
||||
```bash
|
||||
git push origin main
|
||||
```
|
||||
|
||||
Check deployment:
|
||||
```bash
|
||||
# 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:
|
||||
```bash
|
||||
# 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
|
||||
|
||||
```bash
|
||||
# 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
|
||||
|
||||
```bash
|
||||
ss -lntp | grep 5100
|
||||
ss -lntp | grep 5200
|
||||
```
|
||||
|
||||
### Restart Services
|
||||
|
||||
```bash
|
||||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue