Running the platform in a Docker container
The Altcraft image is a monolithic image that runs all the necessary processes in one container.
Databases (MongoDB, SSDB, ClickHouse) and RabbitMQ must be installed separately on the host or in Docker containers.
If the host will run an NGFW/firewall or an antivirus, review the port requirements and antivirus exclusions before deployment.
Installation
Minimum requirements
The table contains the minimum software versions that must be installed on the target host to run the platform.
| Software | Version | Description |
|---|---|---|
| Docker Engine | >= 25.x | See the Docker Engine documentation for installation instructions |
| Docker Compose | >= 1.25.0 | See the Docker Compose documentation for installation instructions |
Volume locations
The Altcraft container uses volumes to store persistent data. You can customize their location according to your requirements.
| Location in Docker container | Description |
|---|---|
| /altcraft/account_files | Message previews and task files (export, import) inside accounts. By default, an anonymous volume will be used. |
| /altcraft/data | Temporary files, storage and cache of various jobs |
| /altcraft/logs | Logs Note: the output of logs to the STDOUT of the container is configured by the LOG_STDOUT environment variable. Set it to true if you need it. |
Minimal main.json configuration
Before starting the platform, you need to configure the minimum configuration $ALTCRAFT_HOME/config/main.json. Configuration example:
Please generate a stronger password. Do not use abcdefghijklmnopqrstuvwxyzABCDEF from the example.
{
"BASEDIR": "/altcraft",
"DEFAULT_LOG_LEVEL": "WARN",
"WEBAPI_PRIVATE_KEY": "abcdefghijklmnopqrstuvwxyzABCDEF",
"WEBCONTROL_HOSTNAME": "altcraft.example.com",
"WEBCONTROL_PUBLIC_IP": "0.0.0.0",
"WEBCONTROL_PUBLIC_PORT": 8080,
"TRACKING_CRYPT_KEY": "abcdefghijklmnopqrstuvwxyzABCDEF",
"TRACKING_HOSTNAME": "click.example.com",
"TRACKING_PUBLIC_IP": "0.0.0.0",
"TRACKING_PUBLIC_PORT": 80,
"COOKIESAVER_PUBLIC_HOSTNAME": "pixel.altcraft.example.com",
"COOKIESAVER_PUBLIC_IP": "0.0.0.0",
"COOKIESAVER_PUBLIC_PORT": 8090,
"COOKIESAVER_SSL_ON": false,
"CONTROLDB_IP": "192.168.20.1",
"CONTROLDB_NAME": "control",
"CONTROLDB_PASS": "abcdefghijklmnopqrstuvwxyzABCDEF",
"CONTROLDB_PORT": 27017,
"CONTROLDB_USER": "altcraft",
"CLICKHOUSE_SYSTEM": {
"HOST": "192.168.20.1",
"PORT": 9000,
"USER": "altcraft",
"MAX_CONNECTION": 100,
"CONN_TIMEOUT": 15,
"PASSWORD": "abcdefghijklmnopqrstuvwxyzABCDEF",
"IS_DEBUG": false
},
"SYSTEM_REDIS": {
"MODE": "standalone",
"PASSWORD": "abcdefghijklmnopqrstuvwxyzABCDEF",
"NODES": [
{
"HOST": "192.168.20.1",
"PORT": 6666
}
]
},
"RABBITMQ_HOST": "192.168.20.1",
"RABBITMQ_PASS": "abcdefghijklmnopqrstuvwxyzABCDEF",
"RABBITMQ_USER": "altcraft",
"SSDB_HBSUPP_IP": "192.168.20.1",
"SSDB_HBSUPP_PASS": "abcdefghijklmnopqrstuvwxyzABCDEF",
"SSDB_HBSUPP_PORT": 4420,
"SSDB_NOTIFY_IP": "192.168.20.1",
"SSDB_NOTIFY_PASS": "abcdefghijklmnopqrstuvwxyzABCDEF",
"SSDB_NOTIFY_PORT": 4430,
"PRIVATE_KEY": "abcdefghijklmnopqrstuvwxyzABCDEF",
"PRODUCT_NAME": "Altcraft Marketing Platform",
"NOREPLY_MAILER": {
"server": "mail.example.com",
"port": 587,
"email": "altcraft@example.com",
"login": "altcraft@example.com",
"pass": "abcdefghijklmnopqrstuvwxyzABCDEF"
}
}
Running the platform using Docker Engine
After preparing the directories according to your requirements, you can run the image:
sudo docker run --detach \
--name altcraft \
--publish <WEBCONTROL_PUBLIC_PORT>:<WEBCONTROL_PUBLIC_PORT> \
--publish <TRACKING_PUBLIC_PORT>:<TRACKING_PUBLIC_PORT> \
--publish <COOKIESAVER_PUBLIC_PORT>:<COOKIESAVER_PUBLIC_PORT> \
--volume $ALTCRAFT_HOME/config/main.json:/altcraft/config/main.json \
--ulimit nofile=256000:256000 \
--restart always \
altcraft:<TAG>
If you are using SELinux, run this instead:
sudo docker run --detach \
--name altcraft \
--publish <WEBCONTROL_PUBLIC_PORT>:<WEBCONTROL_PUBLIC_PORT> \
--publish <TRACKING_PUBLIC_PORT>:<TRACKING_PUBLIC_PORT> \
--publish <COOKIESAVER_PUBLIC_PORT>:<COOKIESAVER_PUBLIC_PORT> \
--volume $ALTCRAFT_HOME/config/main.json:/altcraft/config/main.json:Z \
--ulimit nofile=256000:256000 \
--restart always \
altcraft:<TAG>
This will ensure that the Docker process has sufficient rights to create files on the mounted volumes.
Optional: If you want to collect logs from the container's STDOUT, set the LOG_STDOUT environment variable to true.
sudo docker run --detach \
--name altcraft \
--publish <WEBCONTROL_PUBLIC_PORT>:<WEBCONTROL_PUBLIC_PORT> \
--publish <TRACKING_PUBLIC_PORT>:<TRACKING_PUBLIC_PORT> \
--publish <COOKIESAVER_PUBLIC_PORT>:<COOKIESAVER_PUBLIC_PORT> \
--volume $ALTCRAFT_HOME/config/main.json:/altcraft/config/main.json:Z \
--env LOG_STDOUT=true \
--ulimit nofile=256000:256000 \
--restart always \
altcraft:<TAG>
Starting with Docker Engine 29, the default limit of open file descriptors (ulimit -n) for containers has been lowered from 1048576 to 1024. Altcraft requires higher limits, so the run commands use --ulimit nofile=256000:256000 and the docker-compose.yml example uses the ulimits block. Without this setting, on Docker Engine 29 and later the container may fail to start or run unstably.
Running the platform using Docker Compose
-
Install Docker Compose following the instructions from the minimum requirements section.
-
Prepare
docker-compose.ymlfile, example:
services:
altcraft:
image: altcraft:<TAG>
container_name: altcraft
restart: always
environment:
- GIN_MODE=release
- LOG_STDOUT=true
volumes:
- /opt/altcraft/account_files:/altcraft/account_files:Z
- /opt/altcraft/data:/altcraft/data:Z
- /opt/altcraft/logs:/altcraft/logs:Z
- /opt/altcraft/config/main.json:/altcraft/config/main.json:Z
networks:
altcraft:
aliases:
- altcraft
ulimits:
nofile:
soft: 256000
hard: 256000
expose:
- <WEBCONTROL_PUBLIC_PORT>
- <TRACKING_PUBLIC_PORT>
- <COOKIESAVER_PUBLIC_PORT>
ports:
- <WEBCONTROL_PUBLIC_PORT>:<WEBCONTROL_PUBLIC_PORT>
- <TRACKING_PUBLIC_PORT>:<TRACKING_PUBLIC_PORT>
- <COOKIESAVER_PUBLIC_PORT>:<COOKIESAVER_PUBLIC_PORT>
networks:
altcraft:
driver: bridge
- Run Altcraft Platform:
sudo docker-compose up --detach
Changing main.json configuration
After making the necessary changes, you must restart the container to reconfigure Altcraft Platform:
sudo docker restart altcraft
Update
Update using Docker Engine
- Download the new version of the image:
sudo docker load --input altcraft*.tar.gz
- Remove the existing container:
sudo docker rm altcraft
- Create the container again with the parameters specified earlier:
sudo docker run --detach \
--name altcraft \
--publish <WEBCONTROL_PUBLIC_PORT>:<WEBCONTROL_PUBLIC_PORT> \
--publish <TRACKING_PUBLIC_PORT>:<TRACKING_PUBLIC_PORT> \
--publish <COOKIESAVER_PUBLIC_PORT>:<COOKIESAVER_PUBLIC_PORT> \
--volume $ALTCRAFT_HOME/config/main.json:/altcraft/config/main.json:Z \
--ulimit nofile=256000:256000 \
--restart always \
altcraft:<NEW_TAG>
Update using Docker Compose
- Download the new version of the image:
sudo docker load --input altcraft*.tar.gz
- Remove the previous container:
sudo docker-compose down
- In the
docker-compose.ymlfile set the new version of the image:
version: '3.4'
services: altcraft:
image: altcraft:<NEW_TAG>
container_name: altcraft
...
- Restart Altcraft Platform:
sudo docker-compose up --detach