Docker installation
This guide shows how to run oneCRM on your own server with Docker Compose. You don't need to install PHP or set up a cron job: Docker runs everything oneCRM needs, including its MySQL database.
Requirements
| Requirement | Details |
|---|---|
| Docker | Docker Engine with Compose v2 (the docker compose command) |
| Architecture | amd64 (x86-64) or arm64 |
| Ports | 80 free on the server, or 80 and 443 (TCP and UDP) for automatic HTTPS |
| Domain | A domain or subdomain, such as crm.example.com, pointing at the server. Raw IP addresses are not supported |
Prepare the configuration
- Download the latest release from your licenses page on onecrm.example.com and extract it on your server.
- Open the
docker/production/folder of the extracted release. Run everydocker composecommand on this page from that folder. - Copy the example configuration:
cp .env.example .env- Edit
.envand fill in these settings:
| Setting | Description |
|---|---|
APP_URL | The address users open, for example https://crm.example.com. Include https:// when the site is served over HTTPS |
APP_NAME | The application name, oneCRM by default |
APP_PORT | The server port oneCRM serves plain HTTP on, 80 by default |
DB_DATABASE, DB_USERNAME | The database name and user, both onecrm by default |
DB_PASSWORD | Required. The password of the database user |
DB_ROOT_PASSWORD | Required. The MySQL root password |
MAIL_MAILER, MAIL_HOST, MAIL_PORT, MAIL_USERNAME, MAIL_PASSWORD | Your SMTP server for mail sent by the application |
MAIL_FROM_ADDRESS, MAIL_FROM_NAME | The sender of that mail |
The database is created from these settings on the first start. You don't set a database host.
The application key is generated on the first start. To use your own key, uncomment APP_KEY and set it. oneCRM does not start with an empty APP_KEY line.
To serve the site over HTTPS without a proxy of your own, also follow Automatic HTTPS before you start.
Start oneCRM
docker compose up -d --buildThe first start can take a few minutes. To follow it, run docker compose logs -f app.
Install oneCRM
Install from the browser or from the command line.
Web installer
- Open your
APP_URL, for examplehttps://crm.example.com. You are redirected to/install. - Pass the Requirements and Permissions checks.
- On Setup, enter the License key, Application Name, Country, and Currency, then click Continue. The App URL and the database come from
.env. - On User, enter the details of your admin account and click Install.
Skip the cron command on the finish page: scheduled tasks already run in Docker.
Command line
docker compose exec app php artisan installer:install --admin-name="Jane Doe" --admin-email=jane@example.com \
--country=US --currency=USD --timezone=America/New_York --license=<key>The command asks for the admin password. To pass it instead, add --admin-password=, which is required with --no-interaction. --timezone is UTC when omitted.
If the installation fails part way, run the command again with the same options.
HTTPS
oneCRM serves plain HTTP on APP_PORT. Serve it over HTTPS with the bundled HTTPS service, or with a proxy you already run.
Automatic HTTPS
The bundled HTTPS service takes ports 80 and 443 and gets a certificate for your domain automatically.
- In
.env, uncomment these three settings and setSERVER_NAMEto your domain:
SERVER_NAME=crm.example.com
APP_PORT=127.0.0.1:8080
TRUSTED_PROXIES=10.0.0.0/8,172.16.0.0/12,192.168.0.0/16- Make sure
APP_URLstarts withhttps://. - Start with the
httpsprofile, and keep passing it whenever you rundocker compose up -d:
docker compose --profile https up -d --buildYour own proxy
If a proxy or load balancer in front of oneCRM handles HTTPS:
- Point the proxy at
APP_PORTon the server. - Set
TRUSTED_PROXIESin.envto the proxy's address. - Make sure
APP_URLstarts withhttps://, then rundocker compose up -d.
Scheduled tasks and queue
Scheduled tasks and a queue worker run in Docker once oneCRM is installed, so emails, automations, webhooks, and other background work need no extra setup.
To see the application logs, run docker compose logs app.
Redis
The container runs its own Redis for the cache and sessions. It needs no setup.
| Setting | Description |
|---|---|
REDIS_MAXMEMORY | The memory Redis may use, 256mb by default. Raise it for a busy CRM |
REDIS_HOST | Set it, with REDIS_PASSWORD, to use your own Redis server instead |
Data and backups
Your data is kept in two Docker volumes:
| Volume | Holds |
|---|---|
onecrm_app | The installed oneCRM: its files, uploads, modules, translations and the generated application key |
onecrm_database | The database |
Back up both volumes, or a dump of the database instead of onecrm_database, together with your .env file.
CAUTION
Keep the app volume in your backups Encrypted data cannot be read without the application key, so never restore the database without the onecrm_app volume or the key.
Updates and patches
Update oneCRM and apply patches from Settings → System → Update, as on any other installation. See Updates & patches.
You can also update by starting a newer release:
- Back up the volumes and
.env. - Download and extract the new release.
- Copy your
.envinto the new release'sdocker/production/folder. Compare it with the new.env.examplefor new settings. - From the new
docker/production/folder, rundocker compose up -d --build, adding the profiles you use.
oneCRM updates itself to the new version on start and keeps your data and uploaded modules. If the update is interrupted, it runs again on the next start.
Next steps
Continue with the next steps of the installation guide, skipping the cron job.