diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..afb9197 --- /dev/null +++ b/.env.example @@ -0,0 +1,23 @@ +IMAGE_BASE=opencode.jsaix.cn/chenc + +################ Net Congfig ###################### +NET_SUBNET=10.12.25 + +################ Elasticsearch ###################### +ELK_VERSION=7.17.22 +ELASTICSEARCH_HOST_HTTP_PORT=9200 +ELK_ELASTIC_PASSWD=hello321 + +JAVAGATEWAY_VERSION=1.0.1 +NODEJS_VERSION=18.18.2 +OPENRESTY_VERSION=1.25.3.1 +REDIS_VERSION=7.2.5 +PHP73_VERSION=7.3.33 +PHP74_VERSION=7.4.33 +PHP81_VERSION=8.1.29 +PHP83_VERSION=8.3.8 + +WWWROOT_PATH="./www" + +################# Redis ################## +REDIS_PASSWORD=hello321 diff --git a/docker-compose.yaml.example b/docker-compose.yaml.example new file mode 100644 index 0000000..0639f86 --- /dev/null +++ b/docker-compose.yaml.example @@ -0,0 +1,245 @@ +version: '3.5' + +networks: + aix-docker-cc: + name: aix-docker-cc + driver: bridge + ipam: + driver: default + config: + - subnet: ${NET_SUBNET:-10.12.25}.0/24 + gateway: ${NET_SUBNET:-10.12.25}.1 + driver_opts: + com.docker.network.bridge.name: aix-docker-cc + +services: + nodejs: + image: ${IMAGE_BASE}/nodejs:${NODEJS_VERSION:-18.18.2} + container_name: nodejs + environment: + - PACKAGE_PATH=${PACKAGE_PATH} + volumes: + - "${WWWROOT_PATH}:/data/wwwroot" + working_dir: /data/wwwroot/ + extra_hosts: + - "host.docker.internal:host-gateway" + privileged: true + networks: + aix-docker-cc: + ipv4_address: ${NET_SUBNET:-10.12.25}.200 + + java-gateway: + image: ${IMAGE_BASE}/java_gateway:${JAVAGATEWAY_VERSION:-1.0.1} + container_name: java-gateway + restart: always + volumes: + - "./java_gateway:/app" + extra_hosts: + - "host.docker.internal:host-gateway" + networks: + aix-docker-cc: + ipv4_address: ${NET_SUBNET:-10.12.25}.201 + + elasticsearch: + image: ${IMAGE_BASE}/elasticsearch:${ELK_VERSION:-7.17.22} + container_name: elasticsearch + restart: always + environment: + - cluster.name=cc-docker-cluster + - node.name=cc-docker-node + - bootstrap.memory_lock=true + - http.cors.enabled=true + - http.cors.allow-origin="*" + # - xpack.security.transport.ssl.enabled=false + - xpack.security.enabled=true + - xpack.security.authc.api_key.enabled=true + - "ES_JAVA_OPTS=-Xms512m -Xmx1024m" + # - discovery.seed_hosts= + # - cluster.initial_master_nodes=cc-docker-node + - discovery.type=single-node + - ELASTIC_PASSWORD=${ELK_ELASTIC_PASSWD:-qq1458513} + volumes: + - "./elasticsearch/data/${ELK_VERSION:-7.17.7}:/usr/share/elasticsearch/data:rw" + - "./elasticsearch/plugins/${ELK_VERSION:-7.17.7}:/usr/share/elasticsearch/plugins" + ulimits: + memlock: + soft: -1 + hard: -1 + nofile: + soft: 65536 + hard: 65536 + extra_hosts: + - "host.docker.internal:host-gateway" + networks: + aix-docker-cc: + ipv4_address: ${NET_SUBNET:-10.12.25}.10 + depends_on: + - redis + + openresty: + image: ${IMAGE_BASE}/openresty:${OPENRESTY_VERSION:-1.25.3.1} + container_name: openresty + restart: always + ports: + - 80:80 + - 443:443 + volumes: + - "${WWWROOT_PATH}:/data/wwwroot" + - "./logs/wwwlogs:/data/wwwlogs" + - "./logs/nginx:/usr/local/openresty/nginx/logs" + - "./openresty/config/conf:/usr/local/openresty/nginx/conf" + - "./openresty/config/vhost:/usr/local/openresty/nginx/conf/vhost" + - "./openresty/config/rewrite:/usr/local/openresty/nginx/conf/rewrite" + extra_hosts: + - "host.docker.internal:host-gateway" + networks: + aix-docker-cc: + ipv4_address: ${NET_SUBNET:-10.12.25}.2 + depends_on: + - php74 + - php73 + - php81 + cap_add: + - net_raw + + redis: + image: ${IMAGE_BASE}/redis:${REDIS_VERSION:-7.2.5} + container_name: redis + restart: always + environment: + - REDIS_PASSWORD=${REDIS_PASSWORD:-qq1458513} + volumes: + - "./redis/redis.conf:/etc/redis/redis.conf" + - "./redis/data:/data/db" + - "./logs/redis:/data/logs" + command: [ "redis-server", "/etc/redis/redis.conf", "--requirepass ${REDIS_PASSWORD:-qq1458513}" ] + healthcheck: + test: [ "CMD", "redis-cli", "ping" ] + interval: 1s + timeout: 3s + retries: 30 + start_period: 30s + extra_hosts: + - "host.docker.internal:host-gateway" + networks: + aix-docker-cc: + ipv4_address: ${NET_SUBNET:-10.12.25}.3 + + php73: + image: ${IMAGE_BASE}/php:${PHP73_VERSION:-7.3.33} + container_name: php73 + restart: always + volumes: + - "${WWWROOT_PATH}:/data/wwwroot:rw" + - "./php/php73/etc:/usr/local/etc" + - "./php/php73/supervisord.d:/etc/supervisord.d" + working_dir: /data/wwwroot/ + networks: + aix-docker-cc: + ipv4_address: ${NET_SUBNET:-10.12.25}.73 + healthcheck: + test: + [ + "CMD", + "curl", + "--fail", + "http://${NET_SUBNET:-10.12.25}.1/ping_73" + ] + interval: 1s + timeout: 3s + retries: 30 + start_period: 30s + extra_hosts: + - "host.docker.internal:host-gateway" + depends_on: + - elasticsearch + - redis + + php74: + image: ${IMAGE_BASE}/php:${PHP74_VERSION:-7.4.33} + container_name: php74 + restart: always + volumes: + - "${WWWROOT_PATH}:/data/wwwroot:rw" + - "./php/php74/etc:/usr/local/etc" + working_dir: /data/wwwroot/ + networks: + aix-docker-cc: + ipv4_address: ${NET_SUBNET:-10.12.25}.74 + healthcheck: + test: + [ + "CMD", + "curl", + "--fail", + "http://${NET_SUBNET:-10.12.25}.1/ping_74" + ] + interval: 1s + timeout: 3s + retries: 30 + start_period: 30s + extra_hosts: + - "host.docker.internal:host-gateway" + depends_on: + - elasticsearch + - redis + + php81: + image: ${IMAGE_BASE}/php:${PHP81_VERSION:-8.1.29} + container_name: php81 + restart: always + volumes: + - "${WWWROOT_PATH}:/data/wwwroot" + - "./php/php81/etc:/usr/local/etc" + - "./php/php81/supervisord.d:/etc/supervisord.d" + working_dir: /data/wwwroot/ + networks: + aix-docker-cc: + ipv4_address: ${NET_SUBNET:-10.12.25}.81 + healthcheck: + test: + [ + "CMD", + "curl", + "--fail", + "http://${NET_SUBNET:-10.12.25}.1/ping_81" + ] + interval: 1s + timeout: 3s + retries: 30 + start_period: 30s + extra_hosts: + - "host.docker.internal:host-gateway" + depends_on: + redis: + condition: service_healthy + + php83: + image: ${IMAGE_BASE}/php:${PHP81_VERSION:-8.3.8} + container_name: php83 + restart: always + volumes: + - "${WWWROOT_PATH}:/data/wwwroot" + - "./php/php83/etc:/usr/local/etc" + - "./php/php83/supervisord.d:/etc/supervisord.d" + working_dir: /data/wwwroot/ + networks: + aix-docker-cc: + ipv4_address: ${NET_SUBNET:-10.12.25}.83 + healthcheck: + test: + [ + "CMD", + "curl", + "--fail", + "http://${NET_SUBNET:-10.12.25}.1/ping_83" + ] + interval: 1s + timeout: 3s + retries: 30 + start_period: 30s + extra_hosts: + - "host.docker.internal:host-gateway" + depends_on: + redis: + condition: service_healthy