Appearance
Docker Deployment Guide
Complete guide for deploying BrowserStack Code Quality using Docker containers with PostgreSQL database.
Prerequisites
System Requirements
- OS: Any Linux distribution with Docker support
- Docker: 20.10+
- Docker Compose: 2.0+
- Hardware: See System Requirements for sizing guidance
Verify Docker Installation
bash
# Check Docker versions
docker --version
docker-compose --version
# Ensure Docker daemon is running
sudo systemctl status dockerMethod 1: Docker Compose (Recommended)
Advantages:
- Automatic database setup and configuration
- Built-in health checks and dependency management
- Easy scaling and management
- Simplified backup and recovery
Step 1: Prepare Environment
bash
# Create project directory structure
mkdir -p BrowserStackCodeQuality/logs BrowserStackCodeQuality/gamma_data/tmp
cd BrowserStackCodeQuality
# Set proper permissions
chown -R 1001:1001 gamma_data/ logs/Step 2: Create docker-compose.yml
Create a docker-compose.yml file with this configuration:
yaml
version: '3.8'
services:
db:
image: "postgres:16.3-alpine"
container_name: BrowserStackCodeQuality-DB
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
volumes:
- ./gamma_pg_data:/var/lib/postgresql/data
app:
image: "browserstack/code-quality:1.9.36.0"
container_name: BrowserStackCodeQuality
environment:
- ACCEPT_EULA=Y
- gamma_ui_public_host=http://localhost:3000
- RISK_XMX=-Xmx1024m
- ANALYSER_XMX=-Xmx6072m
- PGHOST=db
- PGPORT=5432
- PGUSER=postgres
- PGPASSWORD=postgres
- GAMMA_DATABASE=gamma
- ANALYTICS_DATABASE=corona
depends_on:
db:
condition: service_healthy
ports:
- "3000:3000"
volumes:
- ./gamma_data:/opt/gamma_data
- ./logs:/opt/gamma/logs
- ./gamma_data/tmp:/tmpStep 3: Deploy and Verify
bash
# Start services
docker-compose up -d
# Check status
docker-compose ps
# View logs
docker logs -f aBrowserStackCodeQualityp
# Test access
curl -I http://localhost:3000Access your instance at: http://localhost:3000
Method 2: Separate Docker Containers
Use this method when you have an external PostgreSQL instance or need manual container control.
Step 1: Prepare Directories
bash
mkdir -p BrowserStackCodeQuality/{logs,gamma_data/tmp,gamma_pg_data}
cd BrowserStackCodeQuality
chown -R 1001:1001 gamma_data/ logs/Step 2: Start PostgreSQL (Skip if using external DB)
bash
docker run -d \
--name BrowserStackCodeQuality-DB \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=postgres \
-p 5432:5432 \
-v /home/${USER}/BrowserStackCodeQuality/gamma_pg_data:/var/lib/postgresql/data \
postgres:16.3-alpineStep 3: Start Application Container
bash
docker run -d \
--name BrowserStackCodeQuality \
-e ACCEPT_EULA=Y \
-e gamma_ui_public_host=http://localhost:3000 \
-e RISK_XMX=-Xmx1024m \
-e ANALYSER_XMX=-Xmx6072m \
-e PGHOST=localhost \
-e PGPORT=5432 \
-e PGUSER=postgres \
-e PGPASSWORD=postgres \
-e GAMMA_DATABASE=gamma \
-e ANALYTICS_DATABASE=corona \
-p 3000:3000 \
-v /home/${USER}/BrowserStackCodeQuality/gamma_data:/opt/gamma_data \
-v /home/${USER}/BrowserStackCodeQuality/logs:/opt/gamma/logs \
-v /home/${USER}/BrowserStackCodeQuality/gamma_data/tmp:/tmp \
--user 1001:1001 \
browserstack/code-quality:1.9.36.0Configuration Options
Essential Environment Variables
| Variable | Description | Default |
|---|---|---|
ACCEPT_EULA | Must be Y to accept license | Required |
gamma_ui_public_host | Public URL/IP for access | http://localhost:3000 |
ANALYSER_XMX | Memory for analysis engine | -Xmx6072m |
RISK_XMX | Memory for risk calculation | -Xmx1024m |
External Database Configuration
For external PostgreSQL instances, update these variables:
yaml
environment:
- PGHOST=your-db-server.com
- PGPORT=5432
- PGUSER=your_username
- PGPASSWORD=your_password
- GAMMA_DATABASE=gamma
- ANALYTICS_DATABASE=coronaPerformance Tuning
See Memory Settings Guide for:
- Memory allocation based on codebase size
- Multi-threading configuration
- Performance optimization
Post-Installation Configuration
1. Accept End-User License Agreement
The application requires explicit EULA acceptance before first use.
yaml
# Ensure this is set in docker-compose.yml
environment:
- ACCEPT_EULA=YIMPORTANT
The application will not start without ACCEPT_EULA=Y. This is mandatory for all deployments.
2. Access the Web Interface
After deployment, access the interface immediately:
bash
# Test connectivity
curl -I http://localhost:3000
# Or open in browser
http://localhost:30003. Configure Public Host URL
Set gamma_ui_public_host for correct URL redirection, especially when using SSO or external access:
yaml
environment:
- gamma_ui_public_host=http://<your-server-ip>:3000
# Or use domain name
- gamma_ui_public_host=https://cq.yourdomain.comTIP
If accessing via domain name or proxy, ensure this URL matches the actual external access point.
4. First-Time Login
- Navigate to
http://localhost:3000 - Complete the initial setup wizard
- Create admin account with strong credentials
- Configure organization name and settings
- Select authentication method:
- Local: Username/password authentication
- LDAP: Enterprise directory integration
- SSO: Single Sign-On (SAML 2.0)
5. Configure Initial Settings
In the Web Interface:
- Go to Settings → Users
- Create additional user accounts as needed
- Configure team access and permissions
- Set up authentication providers (LDAP/SSO) if required
- Configure integrations with version control systems
6. Verify Data Persistence
Ensure volume mapping prevents data loss:
bash
# Verify volume mount
docker inspect BrowserStackCodeQuality | grep -A 5 Mounts
# Should show:
# /home/${USER}/BrowserStackCodeQuality/gamma_data:/opt/gamma_dataTroubleshooting
Common Issues
Container startup fails:
bash
# Check logs
docker-compose logs app
docker logs BrowserStackCodeQuality
# Verify permissions
ls -la gamma_data/ logs/Database connection issues:
bash
# Test database connectivity
docker-compose exec app pg_isready -h db -U postgres
# Check database logs
docker-compose logs dbMemory issues:
- Review Memory Settings Guide
- Increase container memory limits
- Adjust
ANALYSER_XMXsetting
Health Checks
bash
# Container status
docker-compose ps
# Application health
curl http://localhost:3000/health
# Database connection
docker-compose exec db psql -U postgres -c "SELECT version();"Next Steps
Follow the Server Installation and Setup sequence:
- Installation Guide - Installation overview
- System Requirements - Hardware and software specs
- Docker Deployment (You are here) - Complete setup guide
- Importing Certificates - SSL certificate management
- Updates & Upgrades - Version management
Performance Optimization
- Memory Settings - Tune for your codebase size
- Multi-Threading Setup - Improve scan performance
