Skip to content

Instantly share code, notes, and snippets.

@Oschangkai
Last active April 28, 2024 07:58
Show Gist options
  • Save Oschangkai/744b65dd0ef6b7b20e1367444ffaa2df to your computer and use it in GitHub Desktop.
Save Oschangkai/744b65dd0ef6b7b20e1367444ffaa2df to your computer and use it in GitHub Desktop.
docker-compose --env-file apitable.env up -d
ENV_FILE=apitable.env
IMAGE_PULL_POLICY=always
IMAGE_REGISTRY=ghcr.io/oschangkai
IMAGE_BACKEND_SERVER=apitable/backend-server:latest
IMAGE_GATEWAY=apitable/openresty:latest
IMAGE_INIT_DB=apitable/init-db:latest
IMAGE_ROOM_SERVER=apitable/room-server:latest
IMAGE_WEB_SERVER=apitable/web-server:latest
IMAGE_DATABUS_SERVER=apitable/databus-server:latest
IMAGE_IMAGEPROXY_SERVER=apitable/imageproxy-server:latest
IMAGE_INIT_APPDATA=apitable/init-appdata:latest
IMAGE_MINIO=minio/minio:RELEASE.2023-01-25T00-19-54Z
IMAGE_MYSQL=mysql:8.0.32
IMAGE_RABBITMQ=rabbitmq:3.11.9-management
IMAGE_REDIS=redis:7.0.8
NGINX_HTTPS_PORT=443
NGINX_HTTP_PORT=80
### SERVER
BACKEND_BASE_URL=http://backend-server:8081/api/v1/
DATABUS_SERVER_BASE_URL=http://databus-server:8625
ROOM_GRPC_URL=room-server:3334
SOCKET_GRPC_URL=room-server:3007
### NEST CONST
OSS_CACHE_TYPE=minio
OSS_HOST=assets
OSS_TYPE=QNY1
### MINIO
MINIO_ACCESS_KEY=apitable
MINIO_SECRET_KEY=apitable@com
### MYSQL
DATABASE_TABLE_PREFIX=apitable_
MYSQL_DATABASE=apitable
MYSQL_HOST=mysql
MYSQL_PASSWORD=apitable@com
MYSQL_PORT=3306
MYSQL_ROOT_PASSWORD=apitable@com
MYSQL_USERNAME=root
### init-db
DB_HOST=mysql
DB_NAME=apitable
DB_PASSWORD=apitable@com
DB_PORT=3306
DB_USERNAME=root
### REDIS
REDIS_DB=0
REDIS_HOST=redis
REDIS_PASSWORD=apitable@com
REDIS_PORT=6379
### RabbitMQ
RABBITMQ_HOST=rabbitmq
RABBITMQ_PASSWORD=apitable@com
RABBITMQ_PORT=5672
RABBITMQ_USERNAME=apitable
RABBITMQ_VHOST=/
TIMEZONE=Asia/Taipei
ENV=apitable
API_PROXY=http://backend-server:8081
BACKEND_INFO_URL=http://backend-server:8081/api/v1/client/info
PUBLIC_URL=
TEMPLATE_PATH=./static/web_build/index.html
USE_CUSTOM_PUBLIC_FILES=true
NEST_GRPC_ADDRESS=static://room-server:3334
### apitable const
CALLBACK_DOMAIN=
CORS_ORIGINS=*
SERVER_DOMAIN=
SOCKET_DOMAIN=http://room-server:3333/socket
SKIP_REGISTER_VALIDATE=true
TEMPLATE_SPACE=spcNTxlv8Drra
### apitable starter
SOCKET_RECONNECTION_ATTEMPTS=10
SOCKET_RECONNECTION_DELAY=500
SOCKET_TIMEOUT=5000
SOCKET_URL=http://room-server:3002
SMS_ENABLED=false
MAIL_ENABLED=false
MAIL_FROM=
MAIL_HOST=
MAIL_PASSWORD=
MAIL_PORT=
MAIL_SSL_ENABLE=true
MAIL_TYPE=smtp
MAIL_USERNAME=
OSS_CLIENT_TYPE=aws
OSS_ENABLED=true
AWS_ACCESS_KEY=apitable
AWS_ACCESS_SECRET=apitable@com
AWS_ENDPOINT=http://minio:9000
AWS_REGION=us-east-1
HUAWEICLOUD_OBS_ACCESS_KEY=apitable
HUAWEICLOUD_OBS_ENDPOINT=obs.cn-south-1.myhuaweicloud.com
HUAWEICLOUD_OBS_SECRET_KEY=apitable@com
ASSETS_BUCKET=assets
ASSETS_URL=assets
OSS_BUCKET_NAME=assets
DATA_PATH=.
USE_NATIVE_MODULE=0
version: "3.9"
services:
web-server:
image: ${IMAGE_REGISTRY}/${IMAGE_WEB_SERVER}
pull_policy: always
restart: always
expose:
- "8080"
env_file:
- "${ENV_FILE:-apitable.env}"
networks:
- apitable
imageproxy-server:
image: docker.io/${IMAGE_IMAGEPROXY_SERVER}
pull_policy: ${IMAGE_PULL_POLICY:-if_not_present}
restart: always
env_file:
- "${ENV_FILE:-apitable.env}"
expose:
- "8080"
environment:
- TZ=${TIMEZONE}
- BASEURL=${AWS_ENDPOINT}
networks:
- apitable
backend-server:
image: ${IMAGE_REGISTRY}/${IMAGE_BACKEND_SERVER}
pull_policy: always
restart: always
env_file:
- "${ENV_FILE:-apitable.env}"
expose:
- "8081"
environment:
- TZ=${TIMEZONE}
- DEFAULT_TIME_ZONE=${TIMEZONE}
networks:
- apitable
depends_on:
init-db:
condition: service_completed_successfully
healthcheck:
test: ["CMD-SHELL", "curl -sS 'http://localhost:8081' || exit 1"]
interval: 5s
timeout: 5s
start_period: 30s
retries: 60
room-server:
image: ${IMAGE_REGISTRY}/${IMAGE_ROOM_SERVER}
pull_policy: ${IMAGE_PULL_POLICY:-if_not_present}
restart: always
expose:
- "3333"
- "3334"
- "3001"
- "3002"
- "3006"
- "3005"
- "3007"
env_file:
- "${ENV_FILE:-apitable.env}"
environment:
- TZ=${TIMEZONE}
- NODE_ENV=${ENV}
- NODE_OPTIONS=--max-old-space-size=2048 --max-http-header-size=80000
- API_MAX_MODIFY_RECORD_COUNTS=${API_MAX_MODIFY_RECORD_COUNTS:-30}
- INSTANCE_MAX_MEMORY=4096M
- ENABLE_SOCKET=true
networks:
- apitable
depends_on:
mysql:
condition: service_healthy
databus-server:
image: docker.io/${IMAGE_DATABUS_SERVER}
pull_policy: ${IMAGE_PULL_POLICY:-if_not_present}
restart: always
expose:
- "8625"
env_file:
- "${ENV_FILE:-apitable.env}"
environment:
- TZ=${TIMEZONE}
networks:
- apitable
depends_on:
mysql:
condition: service_healthy
# Third Party Dockers
gateway:
image: ${IMAGE_REGISTRY}/${IMAGE_GATEWAY}
pull_policy: ${IMAGE_PULL_POLICY:-if_not_present}
restart: always
env_file:
- "${ENV_FILE:-apitable.env}"
ports:
- ${NGINX_HTTP_PORT:-80}:80
- ${NGINX_HTTPS_PORT:-443}:443
environment:
- TZ=${TIMEZONE}
networks:
- apitable
depends_on:
web-server:
condition: service_started
imageproxy-server:
condition: service_started
backend-server:
condition: service_healthy
room-server:
condition: service_started
init-appdata:
condition: service_completed_successfully
minio:
container_name: minio
image: ${IMAGE_MINIO}
pull_policy: ${IMAGE_PULL_POLICY:-if_not_present}
restart: always
env_file:
- "${ENV_FILE:-apitable.env}"
command: server --console-address ":9001" /data
expose:
- "9000"
- "9001"
volumes:
- ${DATA_PATH}/.data/minio/data:/data
- ${DATA_PATH}/.data/minio/config:/root/.minio
environment:
- MINIO_ACCESS_KEY=${MINIO_ACCESS_KEY}
- MINIO_SECRET_KEY=${MINIO_SECRET_KEY}
- MINIO_ROOT_USER=${MINIO_ACCESS_KEY}
- MINIO_ROOT_PASSWORD=${MINIO_SECRET_KEY}
- TZ=${TIMEZONE}
networks:
- apitable
healthcheck:
test: ["CMD-SHELL", "curl -sS 'http://localhost:9000' || exit 1"]
interval: 5s
timeout: 5s
retries: 30
redis:
container_name: redis
image: ${IMAGE_REDIS}
pull_policy: ${IMAGE_PULL_POLICY:-if_not_present}
restart: always
env_file:
- "${ENV_FILE:-apitable.env}"
command:
[
"redis-server",
"--appendonly",
"yes",
"--requirepass",
"${REDIS_PASSWORD}",
]
expose:
- "6379"
volumes:
- ${DATA_PATH}/.data/redis:/data
environment:
- TZ=${TIMEZONE}
networks:
- apitable
mysql:
container_name: mysql
image: ${IMAGE_MYSQL}
pull_policy: ${IMAGE_PULL_POLICY:-if_not_present}
restart: always
env_file:
- "${ENV_FILE:-apitable.env}"
volumes:
- ${DATA_PATH}/.data/mysql:/var/lib/mysql
expose:
- "3306"
environment:
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
- MYSQL_DATABASE=${MYSQL_DATABASE}
- TZ=${TIMEZONE}
command: --default-authentication-plugin=mysql_native_password
--character-set-server=utf8mb4
--collation-server=utf8mb4_general_ci
--sql_mode=IGNORE_SPACE,NO_ENGINE_SUBSTITUTION
--lower_case_table_names=2
healthcheck:
test: "mysql ${MYSQL_DATABASE} -u${MYSQL_USERNAME} -p${MYSQL_PASSWORD} -e 'SELECT 1;'"
interval: 5s
timeout: 5s
start_period: 30s
retries: 60
networks:
- apitable
rabbitmq:
container_name: rabbitmq
image: ${IMAGE_RABBITMQ}
pull_policy: ${IMAGE_PULL_POLICY:-if_not_present}
restart: always
env_file:
- "${ENV_FILE:-apitable.env}"
volumes:
- ${DATA_PATH}/.data/rabbitmq:/var/lib/rabbitmq
expose:
- "5671"
- "5672"
- "15672"
environment:
- RABBITMQ_DEFAULT_USER=${RABBITMQ_USERNAME}
- RABBITMQ_DEFAULT_PASS=${RABBITMQ_PASSWORD}
networks:
- apitable
# init data
init-db:
image: ${IMAGE_REGISTRY}/${IMAGE_INIT_DB}
pull_policy: ${IMAGE_PULL_POLICY:-if_not_present}
env_file:
- "${ENV_FILE:-apitable.env}"
environment:
- TZ=${TIMEZONE}
- DB_HOST=${MYSQL_HOST}
- DB_PORT=${MYSQL_PORT}
- DB_NAME=${MYSQL_DATABASE}
- DB_USERNAME=${MYSQL_USERNAME}
- DB_PASSWORD=${MYSQL_PASSWORD}
- DATABASE_TABLE_PREFIX=${DATABASE_TABLE_PREFIX}
- ACTION=update
networks:
- apitable
depends_on:
mysql:
condition: service_healthy
# init-appdata
init-appdata:
image: docker.io/${IMAGE_INIT_APPDATA}
pull_policy: ${IMAGE_PULL_POLICY:-if_not_present}
env_file:
- "${ENV_FILE:-apitable.env}"
networks:
- apitable
depends_on:
mysql:
condition: service_healthy
init-db:
condition: service_completed_successfully
phpmyadmin:
image: phpmyadmin/phpmyadmin
restart: always
ports:
- "8282:80"
environment:
- PMA_HOST=${MYSQL_HOST}
- PMA_PORT=${MYSQL_PORT}
- PMA_USER=${MYSQL_USERNAME}
- PMA_PASSWORD=${MYSQL_PASSWORD}
volumes:
- ${DATA_PATH}/.data/pma:/etc/phpmyadmin/config.user.inc.php
networks:
- apitable
depends_on:
mysql:
condition: service_healthy
networks:
apitable:
name: apitable_default
driver: bridge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment