Skip to main content

Installation

This guide walks you through installing OPBX using Docker Compose. This is the recommended method for production deployments and local development.

Prerequisites

Before you begin, ensure your system meets these requirements:

RequirementMinimumRecommended
RAM4 GB8 GB
Disk Space20 GB50 GB
Docker20.10+Latest
Docker Compose2.0+Latest
Git2.30+Latest

You also need these ports available on your host machine (all can be remapped via .env):

Default PortService
80Nginx reverse proxy
3000React frontend (Vite dev server)
6001Soketi WebSocket server
4040ngrok web interface
8081Dialer worker webhook listener

Installation Steps

1. Clone the Repository

Download the OPBX source code from GitHub:

git clone https://github.com/greenfieldtech-nirs/opbx.git
cd opbx

2. Configure Environment Variables

Copy the example environment file and customize it for your deployment:

cp .env.example .env
cp docker-compose.yml.example docker-compose.yml

Edit the .env file and set these required variables at minimum:

VariableDescriptionHow to Generate
APP_KEYLaravel encryption keyphp artisan key:generate
DB_PASSWORDMySQL opbx user passwordopenssl rand -base64 32
DB_ROOT_PASSWORDMySQL root passwordopenssl rand -base64 32
REDIS_PASSWORDRedis authentication passwordopenssl rand -base64 32
PUSHER_APP_SECRETSoketi application secretopenssl rand -base64 64
DIALER_WORKER_API_TOKENGo worker authentication tokenopenssl rand -hex 32
AMD_WORKER_API_TOKENAMD worker callback authentication tokenopenssl rand -hex 32
APP_URLYour domain or IP addresshttp://localhost for local use

Optional but commonly configured variables:

VariableDescriptionDefault
APP_PORTHost port for Nginx80
FRONTEND_PORTHost port for Vite dev server3000
NGROK_AUTHTOKENngrok authtoken for local webhook development(empty)
NGROK_DOMAINCustom ngrok domain (paid plans)(empty)
USERCHECK_API_TOKENUserCheck email validation token(empty)
Cloudonix Configuration

Cloudonix integration is configured through the web UI after your first login. Do not add Cloudonix credentials to the .env file.

Security Notice

Never commit .env or docker-compose.yml files to version control. The .env.example and docker-compose.yml.example templates are safe to commit because they contain no secrets.

3. Start the Services

Launch all OPBX services with Docker Compose:

docker compose up -d

This command builds images and starts the following services:

ServiceContainerPurposeExposed Port
appopbx_appLaravel PHP-FPM backend9000 (internal)
nginxopbx_nginxReverse proxy and static file serverAPP_PORT (default 80)
frontendopbx_frontendReact Vite dev serverFRONTEND_PORT (default 3000)
mysqlopbx_mysqlMySQL 8 database(internal by default)
redisopbx_redisCache, sessions, queues, locks(internal by default)
minioopbx_minioS3-compatible object storage(internal by default)
soketiopbx_websocketWebSocket server6001
queue-workeropbx_queue_workerLaravel queue worker
scheduleropbx_schedulerLaravel task scheduler
dialer-workeropbx_dialer_workerGo auto-dialer worker8081
amd-workeropbx_amd_workerJava/Vert.x AMD worker(internal)
ngrokopbx_ngrokWebhook tunnel (dev only)4040
First Boot

The PHP entrypoint runs migrations, seeds, and configuration validation on first startup. Wait 120 seconds after starting containers before testing.

4. Verify Installation

Check that all services are running:

docker compose ps

Test the public health endpoint:

curl http://localhost/api/health

You should receive a JSON response similar to:

{
"status": "ok",
"timestamp": "2026-06-22T12:00:00+00:00"
}

5. Access the Application

Open your browser and navigate to:

URLPurpose
http://localhost/uiOPBX web application
http://localhost/api/healthPublic health check
http://localhost:4040ngrok dashboard (when enabled)
Next Steps

Proceed to First Login to create your organization and admin account. If you are enabling Auth0 social login, also see Auth0 Setup.

Troubleshooting

Port Conflicts

If you see errors about ports already in use, change the corresponding variable in your .env file:

APP_PORT=8080        # Use port 8080 instead of 80
FRONTEND_PORT=3001 # Use port 3001 instead of 3000

MySQL Slow Start

MySQL may take longer to initialize on first boot. Wait up to 120 seconds after starting containers before testing:

docker compose logs -f mysql

Permission Denied

If you encounter permission errors, ensure your user is in the docker group:

sudo usermod -aG docker $USER
# Log out and back in for changes to take effect

Container Failures

Check individual service logs for errors:

docker compose logs -f [service-name]

Common service names: app, nginx, mysql, redis, queue-worker, dialer-worker, amd-worker.

Migrations Do Not Run

The app container runs migrations only when RUN_MIGRATIONS=true (the default). If you set it to false, run migrations manually:

docker compose exec app php artisan migrate

Webhooks Not Receiving in Local Development

For Cloudonix to reach your local instance, enable ngrok:

  1. Add your NGROK_AUTHTOKEN to .env.
  2. Restart the stack: docker compose up -d.
  3. Find your public HTTPS URL in the ngrok dashboard (http://localhost:4040) or logs.
  4. Enter that URL as the webhook base URL in Settings > Cloudonix.

Updating OPBX

To update to the latest version:

# Pull latest code
git pull

# Stop running containers
docker compose down

# Rebuild images without cache
docker compose build --no-cache

# Start updated services
docker compose up -d
Data Preservation

Database and object-storage data are persisted in ./volumes/ bind mounts. These survive docker compose down. Data will be lost if you run docker compose down -v or delete the volumes/ directory.

Production Deployment

For production environments, consider these additional steps:

  1. Use a reverse proxy (nginx, traefik) with SSL termination
  2. Configure automated backups for MySQL (./scripts/backup-database.sh) and MinIO data
  3. Set strong passwords for all services and rotate tokens regularly
  4. Do not expose MySQL, Redis, or MinIO ports publicly
  5. Enable Redis persistence (already enabled via AOF in the example compose file)
  6. Configure log aggregation
  7. Set up monitoring and alerting
  8. Set APP_ENV=production and APP_DEBUG=false
  9. Restrict SANCTUM_STATEFUL_DOMAINS to your actual domain
Security Notice

Never expose the MySQL, Redis, or MinIO ports to the public internet. Use Docker networks or private IPs for inter-service communication.