# Test docker-compose file for SocialBox service to setup two instances of the service: # 1. Teapot Service (teapot.com) # 2. Coffee Service (coffee.com) services: # Coffee Service (coffee.com test) coffee_socialbox: container_name: coffee_socialbox build: context: . dockerfile: Dockerfile ports: - "8086:8085" depends_on: coffee_mariadb: condition: service_healthy coffee_redis: condition: service_healthy networks: - coffee_network - shared_network restart: unless-stopped volumes: - ./coffee_socialbox/config:/etc/config - ./coffee_socialbox/data:/etc/socialbox environment: # No need to change these values LOG_LEVEL: ${LOG_LEVEL:-debug} CONFIGLIB_PATH: /etc/config LOGGING_DIRECTORY: /var/log SB_MODE: automated SB_STORAGE_PATH: /etc/socialbox # Change these values to match your environment or update the .env file SB_INSTANCE_NAME: ${SB_COFFEE_NAME:-coffee} # Instance name SB_COFFEE_NAME SB_INSTANCE_DOMAIN: ${SB_COFFEE_DOMAIN:-coffee.com} # Instance domain SB_COFFEE_DOMAIN SB_INSTANCE_RPC_ENDPOINT: ${SB_COFFEE_RPC_ENDPOINT:-http://coffee_socialbox:8085/} # Instance RPC endpoint SB_COFFEE_RPC_ENDPOINT SB_LOGGING_CONSOLE_ENABLED: ${SB_LOGGING_CONSOLE_ENABLED:-true} SB_LOGGING_CONSOLE_LEVEL: ${SB_LOGGING_CONSOLE_LEVEL:-debug} SB_LOGGING_FILE_ENABLED: ${SB_LOGGING_FILE_ENABLED:-true} SB_LOGGING_FILE_LEVEL: ${SB_LOGGING_FILE_LEVEL:-debug} SB_SECURITY_DISPLAY_INTERNAL_EXCEPTIONS: ${SB_SECURITY_DISPLAY_INTERNAL_EXCEPTIONS:-true} SB_CRYPTO_KEYPAIR_EXPIRES: ${SB_CRYPTO_KEYPAIR_EXPIRES} SB_CRYPTO_ENCRYPTION_KEYS_COUNT: ${SB_CRYPTO_ENCRYPTION_KEYS_COUNT:-10} SB_CRYPTO_ENCRYPTION_KEYS_ALGORITHM: ${SB_CRYPTO_ENCRYPTION_KEYS_ALGORITHM:-xchacha20} SB_CRYPTO_TRANSPORT_ENCRYPTION_ALGORITHM: ${SB_CRYPTO_TRANSPORT_ENCRYPTION_ALGORITHM:-chacha20} SB_DATABASE_HOST: coffee_mariadb SB_DATABASE_USERNAME: ${MYSQL_USER:-socialbox} SB_DATABASE_PASSWORD: ${MYSQL_PASSWORD:-socialbox} SB_DATABASE_NAME: ${MYSQL_DATABASE:-socialbox} SB_CACHE_ENABLED: ${SB_CACHE_ENABLED:-true} SB_CACHE_ENGINE: redis SB_CACHE_HOST: coffee_redis SB_CACHE_PORT: ${SB_CACHE_PORT:-6379} SB_CACHE_USERNAME: ${SB_CACHE_USERNAME:-root} SB_CACHE_PASSWORD: ${SB_CACHE_PASSWORD:-root} SB_CACHE_DATABASE: ${SB_CACHE_DATABASE:-0} # Mocking, required for testing without the need for configuring actual DNS records # Usage: SB_INSTANCE_DNS_MOCK_: # Environment Variable name is ignored, only the value is used with the prefix being used to detect # the instance name and the suffix being used to detect the TXT record SB_INSTANCE_DNS_MOCK_COFFEE: ${SB_INSTANCE_DNS_MOCK_COFFEE:-"coffee.com v=socialbox;sb-rpc=http://coffee_socialbox:8085/;sb-key=sig:g59Cf8j1wmQmRg1MkveYbpdiZ-1-_hFU9eRRJmQAwmc;sb-exp=0"} SB_INSTANCE_DNS_MOCK_TEAPOT: ${SB_INSTANCE_DNS_MOCK_TEAPOT:-"teapot.com v=socialbox;sb-rpc=http://teapot_socialbox:8085/;sb-key=sig:MDXUuripAo_IAv-EZTEoFhpIdhsXxfMLNunSnQzxYiY;sb-exp=0"} healthcheck: test: ["CMD", "curl", "-f", "-H", "Request-Type: ping", "${SB_INSTANCE_RPC_ENDPOINT-http://coffee_socialbox:8085/}"] interval: 30s timeout: 10s retries: 3 start_period: 40s coffee_mariadb: container_name: coffee_socialbox_mariadb image: mariadb:10.5 restart: unless-stopped environment: MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-sb_root} MYSQL_DATABASE: ${MYSQL_DATABASE:-socialbox} MYSQL_USER: ${MYSQL_USER:-socialbox} MYSQL_PASSWORD: ${MYSQL_PASSWORD:-socialbox} volumes: - coffee_mariadb_data:/var/lib/mysql networks: - coffee_network ports: - "3308:3306" expose: - "3306" healthcheck: test: ["CMD", "mysqladmin", "ping", "-h", "coffee_mariadb", "-u", "${MYSQL_USER:-socialbox}", "-p${MYSQL_PASSWORD:-socialbox}"] interval: 10s timeout: 5s retries: 3 start_period: 30s coffee_redis: container_name: coffee_socialbox_redis image: redis:alpine restart: unless-stopped command: redis-server /usr/local/etc/redis/redis.conf --appendonly yes volumes: - coffee_redis_data:/data - ./docker/redis.conf:/usr/local/etc/redis/redis.conf networks: - coffee_network expose: - "6379" healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 5s retries: 3 start_period: 5s # Teapot Service (teapot.com test) teapot_socialbox: container_name: teapot_socialbox build: context: . dockerfile: Dockerfile ports: - "8087:8085" # Unique port for Teapot instance depends_on: teapot_mariadb: condition: service_healthy teapot_redis: condition: service_healthy networks: - teapot_network - shared_network restart: unless-stopped volumes: - ./teapot_socialbox/config:/etc/config - ./teapot_socialbox/data:/etc/socialbox environment: # No need to change these values LOG_LEVEL: ${LOG_LEVEL:-debug} CONFIGLIB_PATH: /etc/config LOGGING_DIRECTORY: /var/log SB_MODE: automated SB_STORAGE_PATH: /etc/socialbox # Change these values to match your environment or update the .env file SB_INSTANCE_NAME: ${SB_TEAPOT_NAME:-teapot} # Instance name SB_TEAPOT_NAME SB_INSTANCE_DOMAIN: ${SB_TEAPOT_DOMAIN:-teapot.com} # Instance domain SB_TEAPOT_DOMAIN SB_INSTANCE_RPC_ENDPOINT: ${SB_TEAPOT_RPC_ENDPOINT:-http://teapot_socialbox:8085/} # Instance RPC endpoint SB_TEAPOT_RPC_ENDPOINT SB_LOGGING_CONSOLE_ENABLED: ${SB_LOGGING_CONSOLE_ENABLED:-true} SB_LOGGING_CONSOLE_LEVEL: ${SB_LOGGING_CONSOLE_LEVEL:-debug} SB_LOGGING_FILE_ENABLED: ${SB_LOGGING_FILE_ENABLED:-true} SB_LOGGING_FILE_LEVEL: ${SB_LOGGING_FILE_LEVEL:-debug} SB_SECURITY_DISPLAY_INTERNAL_EXCEPTIONS: ${SB_SECURITY_DISPLAY_INTERNAL_EXCEPTIONS:-true} SB_CRYPTO_KEYPAIR_EXPIRES: ${SB_CRYPTO_KEYPAIR_EXPIRES} SB_CRYPTO_ENCRYPTION_KEYS_COUNT: ${SB_CRYPTO_ENCRYPTION_KEYS_COUNT:-10} SB_CRYPTO_ENCRYPTION_KEYS_ALGORITHM: ${SB_CRYPTO_ENCRYPTION_KEYS_ALGORITHM:-xchacha20} SB_CRYPTO_TRANSPORT_ENCRYPTION_ALGORITHM: ${SB_CRYPTO_TRANSPORT_ENCRYPTION_ALGORITHM:-chacha20} SB_DATABASE_HOST: teapot_mariadb SB_DATABASE_USERNAME: ${MYSQL_USER:-socialbox} SB_DATABASE_PASSWORD: ${MYSQL_PASSWORD:-socialbox} SB_DATABASE_NAME: ${MYSQL_DATABASE:-socialbox} SB_CACHE_ENABLED: ${SB_CACHE_ENABLED:-true} SB_CACHE_ENGINE: redis SB_CACHE_HOST: teapot_redis SB_CACHE_PORT: ${SB_CACHE_PORT:-6379} SB_CACHE_USERNAME: ${SB_CACHE_USERNAME:-root} SB_CACHE_PASSWORD: ${SB_CACHE_PASSWORD:-root} SB_CACHE_DATABASE: ${SB_CACHE_DATABASE:-0} # Mocking, required for testing without the need for configuring actual DNS records # Usage: SB_INSTANCE_DNS_MOCK_: # Environment Variable name is ignored, only the value is used with the prefix being used to detect # the instance name and the suffix being used to detect the TXT record SB_INSTANCE_DNS_MOCK_COFFEE: ${SB_INSTANCE_DNS_MOCK_COFFEE:-"coffee.com v=socialbox;sb-rpc=http://coffee_socialbox:8085/;sb-key=sig:g59Cf8j1wmQmRg1MkveYbpdiZ-1-_hFU9eRRJmQAwmc;sb-exp=0"} SB_INSTANCE_DNS_MOCK_TEAPOT: ${SB_INSTANCE_DNS_MOCK_TEAPOT:-"teapot.com v=socialbox;sb-rpc=http://teapot_socialbox:8085/;sb-key=sig:MDXUuripAo_IAv-EZTEoFhpIdhsXxfMLNunSnQzxYiY;sb-exp=0"} healthcheck: test: ["CMD", "curl", "-f", "-H", "Request-Type: ping", "${SB_INSTANCE_RPC_ENDPOINT-http://teapot_socialbox:8085/}"] interval: 30s timeout: 10s retries: 3 start_period: 40s teapot_mariadb: container_name: teapot_socialbox_mariadb image: mariadb:10.5 restart: unless-stopped environment: MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD:-sb_root} MYSQL_DATABASE: ${MYSQL_DATABASE:-socialbox} MYSQL_USER: ${MYSQL_USER:-socialbox} MYSQL_PASSWORD: ${MYSQL_PASSWORD:-socialbox} volumes: - teapot_mariadb_data:/var/lib/mysql networks: - teapot_network ports: - "3307:3306" # Unique port for Teapot instance expose: - "3306" healthcheck: test: ["CMD", "mysqladmin", "ping", "-h", "teapot_mariadb", "-u", "${MYSQL_USER:-socialbox}", "-p${MYSQL_PASSWORD:-socialbox}"] interval: 10s timeout: 5s retries: 3 start_period: 30s teapot_redis: container_name: teapot_socialbox_redis image: redis:alpine restart: unless-stopped command: redis-server /usr/local/etc/redis/redis.conf --appendonly yes volumes: - teapot_redis_data:/data - ./docker/redis.conf:/usr/local/etc/redis/redis.conf networks: - teapot_network expose: - "6379" healthcheck: test: ["CMD", "redis-cli", "ping"] interval: 10s timeout: 5s retries: 3 start_period: 5s volumes: teapot_mariadb_data: driver: local teapot_redis_data: driver: local coffee_redis_data: driver: local coffee_mariadb_data: driver: local networks: teapot_network: driver: bridge name: teapot_network coffee_network: driver: bridge name: coffee_network shared_network: driver: bridge