Create the necessary directories and set the appropriate permissions using the following commands
mkdir BrowserStackCodeQuality cd BrowserStackCodeQuality mkdir -p logs gamma_data/tmp chown -R 1001:1001 gamma_data/ logs/
You can either connect to an external PostgreSQL database or use a PostgreSQL Docker container as specified below.
Option 1: Using Docker compose.
If using an external PostgreSQL, skip the db service and configure the database settings in the app service accordingly.
version: '2'
services:
db:
image: "postgres:16.3-alpine"
container_name: BrowserStackCodeQuality-DB
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
volumes:
- /home/${USER}/BrowserStackCodeQuality/gamma_pg_data:/var/lib/postgresql/data
app:
image: "browserstack/code-quality:1.9.33.0"
tty: true
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
deploy:
resources:
limits:
memory: 10G
ports:
- "3000:3000"
volumes:
- /home/${USER}/BrowserStackCodeQuality/gamma_data:/opt/gamma_data
- /home/${USER}/BrowserStackCodeQuality/logs:/opt/gamma/logs
- /home/${USER}/BrowserStackCodeQuality/gamma_data/tmp:/tmp
Option 2: Using Docker
If using an external PostgreSQL, skip the PostgreSQL container and provide the database configuration in the following Docker command.
- Run postgres 16.3 (if not using an external PostgreSQL)
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-alpine
Get IP address of BrowserStackCodeQuality-DB and use in below docker command in place of DB_HOST
- Run CodeQuality
docker run -d \
--name BrowserStackCodeQuality \
-e ACCEPT_EULA=Y \
-e gamma_ui_public_host=http://YOUR_IP_OR_SERVER:PORT \
-e RISK_XMX=-Xmx1024m \
-e ANALYSER_XMX=-Xmx6072m \
-e PGHOST=DB_HOST \
-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 \
--read-only \
browserstack/code-quality:1.9.33.0
