Skip to main content

Install with Standard Docker (docker run)

This guide shows how to run Daployi services using plain docker run commands. This method offers maximum control, but requires more steps.

Important: Docker secrets are not available with docker run. Use environment variables carefully and prefer a private host. For production, Docker Compose or the Installer is recommended.

  1. Create a user-defined network with IPAM (optional, for static IPs)
docker network create --driver bridge --subnet 10.99.0.0/24 daployi_net
  1. Prepare environment variables and secrets
export API_PORT=4000
export WEB_PORT=3000
export LOG_LEVEL=info
export MONGO_USER=admin
export MONGO_PASSWORD='[Strong password here]'

# URL-encode the Mongo password for use in the connection string
export MONGO_PASSWORD_ENC=$(python3 - <<'PY'
import os, urllib.parse
print(urllib.parse.quote(os.environ['MONGO_PASSWORD']))
PY
)

# Redis
export REDIS_PASSWORD='[Strong password here]'

# JWT secret (32-byte hex)
export JWT_SECRET=$(openssl rand -hex 32)

# Public bases (what the browser will use)
export PUBLIC_API_BASE=[Base api url e.g. https://api.daployi.yourdomain.com]
export PUBLIC_WS_BASE=[Base websocket url e.g. wss://api.daployi.yourdomain.com]

# WebAuthn (Passkeys)
export WEBAUTHN_RP_ID=[instance domain here e.g. daployi.yourdomain.com]
export WEBAUTHN_RP_NAME="Daployi"
export WEBAUTHN_ORIGIN=[Url to use for WebAuthn registration e.g. https://daployi.yourdomain.com]

# Master key for encryption (base64)
export MASTER_KEY_B64=$(openssl rand -base64 32)

# Public base for the web app (used by API for links)
export WEB_PUBLIC_BASE=[Base system url e.g. https://daployi.yourdomain.com]
  1. Start infrastructure containers
docker volume create redis_data
docker run -d \
--name daployi-redis --network daployi_net --ip 10.99.0.11 \
-p 6378:6379 \
-e TZ=Africa/Johannesburg \
-e REDIS_PASSWORD="$REDIS_PASSWORD" \
-v redis_data:/data \
redis:alpine sh -c 'redis-server --requirepass "$REDIS_PASSWORD"'
docker volume create mongodb_data
docker run -d \
--name daployi-mongodb \
--network daployi_net --ip 10.99.0.10 \
-p 27018:27017 \
-e MONGO_INITDB_ROOT_USERNAME=$MONGO_USER \
-e MONGO_INITDB_ROOT_PASSWORD=$MONGO_PASSWORD \
-v mongodb_data:/data/db \
mongo:8.0 mongod --bind_ip_all --auth
  1. Start Daployi services
docker run -d \
--name daployi-server \
--network daployi_net --ip 10.99.0.12 \
-p ${API_PORT}:${API_PORT} \
-e API_PORT=${API_PORT} \
-e HOST=0.0.0.0 \
-e NODE_ENV=development \
-e LOG_LEVEL=${LOG_LEVEL} \
-e MONGODB_URI="mongodb://${MONGO_USER}:${MONGO_PASSWORD_ENC}@daployi-mongodb:27017?authSource=admin" \
-e MONGODB_DB_NAME=daployi \
-e REDIS_HOST=daployi-redis \
-e REDIS_PORT=6379 \
-e REDIS_PASSWORD="${REDIS_PASSWORD}" \
-e REDIS_DATABASE=0 \
-e JWT_SECRET="${JWT_SECRET}" \
-e JWT_EXPIRES_IN=7d \
-e WEBAUTHN_RP_ID="${WEBAUTHN_RP_ID}" \
-e WEBAUTHN_RP_NAME="${WEBAUTHN_RP_NAME}" \
-e WEBAUTHN_ORIGIN="${WEBAUTHN_ORIGIN}" \
daployi/daployi-api:1.0.7
docker run -d \
--name daployi-worker \
--network daployi_net --ip 10.99.0.13 \
-e API_BASE=http://10.99.0.12:${API_PORT} \
-e MAX_DEVICE_CONNECTIONS=20 \
-e MONGODB_URI="mongodb://${MONGO_USER}:${MONGO_PASSWORD_ENC}@daployi-mongodb:27017?authSource=admin" \
-e MONGODB_DB_NAME=daployi \
-e REDIS_HOST=daployi-redis \
-e REDIS_PORT=6379 \
-e REDIS_PASSWORD="${REDIS_PASSWORD}" \
-e REDIS_DATABASE=0 \
-e LOG_LEVEL=${LOG_LEVEL} \
daployi/daployi-worker:1.0.7
docker run -d \
--name daployi-web \
--network daployi_net --ip 10.99.0.14 \
-p ${WEB_PORT}:${WEB_PORT} \
-e NUXT_PUBLIC_API_BASE=${PUBLIC_API_BASE} \
-e NUXT_PUBLIC_WS_BASE=${PUBLIC_WS_BASE} \
-e NUXT_PUBLIC_AGENT_VERSION=1.0.20 \
-e API_PORT=${WEB_PORT} \
daployi/daployi-web:1.0.9
  1. Verify
docker logs -f daployi-server
# Open the Web UI in your browser:
# http://${WEB_PUBLIC_BASE} OR https://${WEB_PUBLIC_BASE} if configured

Stopping and removing

docker rm -f daployi-web daployi-worker daployi-server daployi-mongodb daployi-redis
docker network rm daployi_net
docker volume rm mongodb_data redis_data

Notes

  • If you cannot or don’t want to use static IPs, omit --ip flags and use container names for inter-service references.
  • Ensure your shell doesn’t echo secrets into history; consider using an .env file and --env-file with docker run.