ci: Migrate from GitLab CI/CD to Gitea Actions with CT109 pre-production

**Migration Complete:**
- Removed GitLab CI/CD configuration (.gitlab-ci.yml)
- Created Gitea Actions workflows (.gitea/workflows/)
- Disabled automatic production deployment (manual only)
- Added pre-production deployment to CT109 Docker container

**New Workflows:**
- build-and-deploy.yml: Main CI/CD pipeline with CT109 deployment
- rollback.yml: Manual rollback capability
- README.md: Comprehensive workflow documentation

**Pre-Production Environment (CT109):**
- Host: 10.0.0.51
- User: sysadmin
- Port: 22
- Deploys on push to development/main branches
- Access URL: http://ct109.local:5100

**Documentation:**
- CI_CD_MIGRATION_GITEA.md: Complete migration guide
- CI_CD_CT109_PREPRODUCTION.md: CT109 deployment architecture
- GITEA_SECRETS_SETUP_GUIDE.md: Secrets configuration instructions

**Git Remote Updated:**
- Migrated from GitLab (gitlab.silverlabs.uk) to Gitea (git.silverlabs.uk)
- Using token authentication for push/pull operations

**Next Steps:**
1. Push code to Gitea to create repository
2. Add CT109 secrets via Gitea UI (CT109_HOST, CT109_SSH_PORT, CT109_USER, CT109_SSH_KEY)
3. Test pre-production deployment workflow

🚀 Generated with Claude Code

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-14 19:10:14 +00:00
parent 14f11ca1f0
commit 47e43d4ff8
8 changed files with 1753 additions and 280 deletions

View File

@@ -1,61 +0,0 @@
variables:
DOCKER_HOST: unix:///var/run/docker.sock
stages:
- build
- deploy
build:
stage: build
image: docker:24
script:
- docker build -f TeleBot/Dockerfile -t localhost:5000/telebot:latest ../
- docker tag localhost:5000/telebot:latest localhost:5000/telebot:$CI_COMMIT_SHORT_SHA
- docker push localhost:5000/telebot:latest
- docker push localhost:5000/telebot:$CI_COMMIT_SHORT_SHA
rules:
- if: '$CI_COMMIT_BRANCH == "main"'
- if: '$CI_COMMIT_TAG'
deploy:vps:
stage: deploy
image: docker:24
before_script:
- apk add --no-cache openssh-client bash curl
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo "$VPS_SSH_KEY_B64" | base64 -d > /tmp/deploy_key
- chmod 600 /tmp/deploy_key
- ssh-keyscan -p "$VPS_PORT" "$VPS_HOST" >> ~/.ssh/known_hosts 2>/dev/null
script:
- |
# Save and transfer Docker image
docker save localhost:5000/telebot:latest | ssh -i /tmp/deploy_key -p "$VPS_PORT" "$VPS_USER@$VPS_HOST" "docker load"
# Deploy on VPS
ssh -i /tmp/deploy_key -p "$VPS_PORT" "$VPS_USER@$VPS_HOST" bash -s << 'EOF'
cd /opt/telebot
docker-compose down
docker-compose up -d
# Health check
for i in 1 2 3 4 5 6; do
if pgrep -f "dotnet.*TeleBot" > /dev/null 2>&1; then
echo "✅ TeleBot deployment successful"
exit 0
fi
echo "Waiting for TeleBot to start... ($i/6)"
sleep 10
done
echo "❌ TeleBot deployment failed - health check timeout"
docker-compose logs --tail=50
exit 1
EOF
rules:
- if: '$CI_COMMIT_BRANCH == "main"'
when: on_success
- if: '$CI_COMMIT_TAG'
when: manual
after_script:
- rm -f /tmp/deploy_key