Ansible playbook for deploying BRC Analytics backend services to TACC VMs.
This playbook deploys the BRC Analytics backend (nginx, FastAPI, Redis) to:
- Production:
brc-analytics-prod.tacc.utexas.edu→ https://platform.brc-analytics.org - Development:
brc-analytics-dev.tacc.utexas.edu→ https://platform-dev.brc-analytics.org
The playbook is designed for local execution on each VM. Since SSH access requires VPN + MFA, you:
- SSH into the VM manually
- Run the playbook locally with
ansible_connection: local - Use
--limit=$(hostname --fqdn)to target only the current host
- Development VM deploys the
mainbranch - Production VM deploys the
productionbranch
- SSH access to the TACC VMs (requires VPN)
- Python 3.8+ on the VM
- sudo privileges
# Install git, python, make if not present
sudo dnf install -y git python3 python3-pip make
# Clone this playbook repository
git clone https://github.com/galaxyproject/brc-analytics-playbook.git
cd brc-analytics-playbook
# Set up Python venv and install Ansible
make setup
# Create vault password file (store securely!)
echo "your-vault-password" > .vault-password.txt
chmod 600 .vault-password.txt
# Bootstrap the system (install Docker, Node.js, etc.)
make bootstrap
# Deploy the application
make deploycd brc-analytics-playbook
git pull
make update| Target | Description |
|---|---|
make setup |
First time: create .venv and install Ansible |
make bootstrap |
Initial system setup (Docker, Node.js, certbot) |
make deploy |
Full deployment (clone, build, SSL, start) |
make update |
Update deployment (pull, rebuild, restart) |
make status |
Check service status |
make restart |
Restart services (no rebuild) |
make cert-renew |
Force SSL certificate renewal |
make logs |
View container logs |
make shell |
Shell into backend container |
make vault-edit |
Edit encrypted secrets |
make check |
Syntax check all playbooks |
make help |
Show help message |
brc-analytics-playbook/
├── Makefile # Entry point for all operations
├── ansible.cfg # Ansible configuration
├── requirements.txt # Python dependencies
├── requirements.yaml # Ansible Galaxy collections
├── .vault-password.txt # Vault password (gitignored)
├── inventory/
│ └── hosts.yaml # Host definitions
├── group_vars/
│ ├── all/
│ │ ├── vars.yaml # Shared variables
│ │ └── vault.yaml # Shared secrets (encrypted)
│ ├── production/
│ │ └── vars.yaml # Production config
│ └── development/
│ └── vars.yaml # Development config
├── playbook-bootstrap.yaml # Initial setup
├── playbook-deploy.yaml # Full deployment
├── playbook-update.yaml # Update existing
├── playbook-restart.yaml # Restart services
├── playbook-status.yaml # Status checks
├── playbook-cert-renew.yaml # Certificate renewal
└── templates/
├── docker-compose.override.yml.j2
├── nginx-ssl.conf.j2
└── api.env.j2
Run once on a fresh VM to install:
- Docker and docker-compose plugin
- Node.js v20 (for catalog builds)
- Certbot (for SSL)
- Service user (
brc-analytics) - Deployment directory (
/opt/brc-analytics)
Full deployment:
- Clone the BRC Analytics repository
- Install npm dependencies
- Build catalog data (
npm run build-brc-db) - Set up SSL certificate (from vault, self-signed, or Let's Encrypt)
- Configure nginx with SSL
- Build and start Docker containers
- Set up automatic certificate renewal (Let's Encrypt mode)
Update existing deployment:
- Pull latest changes from repository
- Rebuild catalog if source files changed
- Update npm dependencies if package-lock changed
- Rebuild Docker images
- Restart services
- Verify health check
Quick restart without pulling changes or rebuilding:
- Restart Docker containers
- Verify health check
Check service status:
- Docker service health
- Container status
- API health endpoint
- SSL certificate expiry
- Disk usage
Edit group_vars/production/vars.yaml or group_vars/development/vars.yaml to customize:
brc_environment: production
brc_repo_branch: production # main for dev, production for prod
brc_domain: platform.brc-analytics.org
api_log_level: WARNING # INFO, DEBUG, etc.
ssl_mode: vault # vault, self_signed, or letsencryptThe playbook supports three SSL modes via ssl_mode:
- vault: Deploy certificates from Ansible Vault (recommended for production)
- self_signed: Generate self-signed certificates (for testing)
- letsencrypt: Obtain certificates via Let's Encrypt HTTP-01 challenge
For vault mode, generate certificates locally using DNS-01 challenge:
make cert-generate DOMAIN=platform.brc-analytics.orgThen add the output to your vault file and set ssl_mode: vault.
Sensitive values are stored encrypted in group_vars/*/vault.yaml.
To edit secrets:
make vault-editTo create new vault file:
ansible-vault create group_vars/production/vault.yamlmake logs
# Or for a specific service:
cd /opt/brc-analytics/backend && docker compose logs backendmake restartmake update
# Or manually:
cd /opt/brc-analytics/backend && docker compose up -d --build --force-recreateopenssl x509 -in /etc/letsencrypt/live/platform.brc-analytics.org/fullchain.pem -noout -datesmake cert-renew- Production: https://platform.brc-analytics.org
- Development: https://platform-dev.brc-analytics.org
- Health:
/api/v1/health - Documentation:
/api/docs - Version:
/api/v1/version