Farid Siddiqi 535512dd56
Some checks failed
Build and Deploy API Server / deploy (push) Blocked by required conditions
Build and Deploy API Server / build (push) Has been cancelled
update caching
2025-12-23 18:33:51 -08:00
..
2025-12-23 18:33:51 -08:00

Ansible Infrastructure Setup

This playbook sets up the complete Gitea + API server infrastructure on a fresh Ubuntu 24.04 VPS.

Quick Start

# 1. Copy and edit inventory
cp hosts.ini.example hosts.ini
# Edit hosts.ini with your VPS details

# 2. Set passwords
export POSTGRES_ADMIN_PASSWORD="your-strong-password"
export API_SERVER_DB_PASSWORD="your-api-db-password"

# 3. Run playbook
ansible-playbook -i hosts.ini site.yml

What This Deploys

Infrastructure

  • Gitea server (Git hosting + Actions)
  • PostgreSQL (separate databases for Gitea and API)
  • 5 Gitea Actions runners (self-hosted)
  • Nginx reverse proxy
  • UFW firewall

API Server Deployment System

  • /opt/api-artifacts/ directory structure
  • Blue-green deployment scripts
  • Systemd service configuration
  • Environment file template

Database Setup

  • gitea database (for Gitea)
  • apiserver database (for your application)
  • pgadmin user (admin access)
  • apiserver user (application access)

Configuration

Edit site.yml to customize:

vars:
  create_separate_apiserver_db: true  # false to share gitea DB
  runner_count: 5                     # Number of runners
  gitea_version: "1.23.3"            # Gitea version

Inventory File

Create hosts.ini:

[git]
your-vps-ip ansible_user=ubuntu ansible_ssh_private_key_file=~/.ssh/key.pem ansible_python_interpreter=/usr/bin/python3

After Ansible Runs

  1. Access Gitea at http://your-vps-ip
  2. Create admin account
  3. Create repository
  4. Push code to trigger builds

See main deployment README for full workflow.