diff --git a/docker-compose-apisix.yml b/docker-compose-apisix.yml index dd01188..db5abee 100644 --- a/docker-compose-apisix.yml +++ b/docker-compose-apisix.yml @@ -20,22 +20,30 @@ version: "3.8" services: apisix-dashboard: image: apache/apisix-dashboard:latest - container_name: 'apisix-dashboard' hostname: 'apisix-dashboard' - restart: always volumes: - ./apisix/dashboard_conf/conf.yaml:/usr/local/apisix-dashboard/conf/conf.yaml ports: - "9000:9000" + deploy: + resources: + reservations: + cpus: '0.05' + memory: 100M + limits: + cpus: '0.30' + memory: 300M + update_config: + failure_action: rollback + placement: + constraints: + - 'node.role == manager' networks: - - apisix - diyue-network apisix: image: apache/apisix:latest - container_name: 'apisix' hostname: 'apisix' - restart: always volumes: - ./apisix/apisix_conf/config.yaml:/usr/local/apisix/conf/config.yaml:ro depends_on: @@ -47,15 +55,25 @@ services: - "9091:9091/tcp" - "9443:9443/tcp" - "9092:9092/tcp" + deploy: + resources: + reservations: + cpus: '0.10' + memory: 200M + limits: + cpus: '0.30' + memory: 400M + update_config: + failure_action: rollback + placement: + constraints: + - 'node.role == manager' networks: - - apisix - diyue-network etcd: image: bitnami/etcd:latest - container_name: 'apisix-etcd' hostname: 'apisix-etcd' - restart: always volumes: - etcd_data:/bitnami/etcd environment: @@ -65,41 +83,71 @@ services: ETCD_LISTEN_CLIENT_URLS: "http://0.0.0.0:2379" ports: - "2379:2379/tcp" + deploy: + resources: + reservations: + cpus: '0.05' + memory: 150M + limits: + cpus: '0.30' + memory: 300M + update_config: + failure_action: rollback + placement: + constraints: + - 'node.role == manager' networks: - - apisix - diyue-network prometheus: image: prom/prometheus:latest - container_name: 'apisix-prometheus' hostname: 'apisix-prometheus' - restart: always volumes: - ./apisix/prometheus_conf/prometheus.yml:/etc/prometheus/prometheus.yml ports: - "9093:9090" + deploy: + resources: + reservations: + cpus: '0.05' + memory: 150M + limits: + cpus: '0.30' + memory: 300M + update_config: + failure_action: rollback + placement: + constraints: + - 'node.role == manager' networks: - - apisix - diyue-network grafana: image: grafana/grafana:latest - container_name: 'apisix-grafana' hostname: 'apisix-grafana' - restart: always ports: - "3010:3000" volumes: - "./apisix/grafana_conf/provisioning:/etc/grafana/provisioning" - "./apisix/grafana_conf/dashboards:/var/lib/grafana/dashboards" - "./apisix/grafana_conf/config/grafana.ini:/etc/grafana/grafana.ini" + deploy: + resources: + reservations: + cpus: '0.05' + memory: 150M + limits: + cpus: '0.30' + memory: 300M + update_config: + failure_action: rollback + placement: + constraints: + - 'node.role == manager' networks: - - apisix - diyue-network networks: - apisix: - driver: bridge diyue-network: driver: overlay attachable: true