| # |
| # Licensed to the Apache Software Foundation (ASF) under one or more |
| # contributor license agreements. See the NOTICE file distributed with |
| # this work for additional information regarding copyright ownership. |
| # The ASF licenses this file to You under the Apache License, Version 2.0 |
| # (the "License"); you may not use this file except in compliance with |
| # the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| # |
| |
| services: |
| # etcd service |
| etcd: |
| image: quay.io/coreos/etcd:v3.6.1 |
| container_name: pixiu_admin_etcd |
| environment: |
| - ETCD_LISTEN_PEER_URLS=http://0.0.0.0:2380 |
| - ETCD_LISTEN_CLIENT_URLS=http://0.0.0.0:2379 |
| - ETCD_ADVERTISE_CLIENT_URLS=http://pixiu_admin_etcd:2379 |
| - ETCD_DATA_DIR=/etcd-data |
| - ETCD_NAME=etcd-node-1 |
| - ALLOW_NONE_AUTHENTICATION=yes |
| volumes: |
| - ./etcd-data:/etcd-data |
| ports: |
| - "2379:2379" |
| - "2380:2380" |
| networks: |
| - app_network |
| |
| # OPA service |
| opa: |
| image: openpolicyagent/opa:1.13.1 |
| container_name: pixiu_admin_opa |
| ports: |
| - "8181:8181" |
| networks: |
| - app_network |
| command: |
| - "run" |
| - "--server" |
| - "--addr=:8181" |
| - "--log-level=info" |
| |
| mysql_pixiu: |
| image: mysql:8 |
| container_name: pixiu_admin_mysql |
| environment: |
| MYSQL_ROOT_PASSWORD: root_password |
| MYSQL_DATABASE: pixiu |
| MYSQL_USER: pixiu_user |
| MYSQL_PASSWORD: pixiu_password |
| ports: |
| - "3306:3306" |
| volumes: |
| - ./admin/resources/sql:/docker-entrypoint-initdb.d |
| networks: |
| - app_network |
| |
| # pixiu service |
| pixiu: |
| build: |
| context: . |
| dockerfile: Dockerfile |
| container_name: pixiu_admin_pixiu_gateway |
| ports: |
| - "8888:8888" |
| volumes: |
| - ./configs/pixiu_with_admin_config.yaml:/etc/pixiu/conf.yaml # Mount the custom config file |
| - ./configs/log.yml:/etc/pixiu/log.yml # Mount log configuration if needed |
| networks: |
| - app_network |
| depends_on: |
| - etcd # Ensure etcd is ready before starting the backend |
| - opa # Ensure opa is ready before starting the backend |
| - backend # backend is the xds server for pixiu |
| entrypoint: ["/bin/sh", "-c", "echo 'Waiting for backend to be ready on port 8081...' && \ |
| until nc -z pixiu_admin_go_backend 8081; do \ |
| sleep 3; \ |
| done && \ |
| echo 'Backend is ready!' && \ |
| /app/docker-entrypoint.sh"] |
| |
| # backend service(GO) |
| backend: |
| image: golang:1.25 |
| container_name: pixiu_admin_go_backend |
| working_dir: /app |
| volumes: |
| - .:/app |
| ports: |
| - "8081:8081" |
| command: > |
| sh -c " |
| curl -sS http://pixiu_admin_etcd:2379/health || exit 1 && |
| go mod tidy && |
| go run ./cmd/admin/admin.go -c ./configs/admin_docker_config.yaml |
| " |
| environment: |
| - GO111MODULE=on |
| - GOPROXY=https://goproxy.cn,direct |
| networks: |
| - app_network |
| depends_on: |
| - etcd # Ensure etcd is ready before starting the backend |
| |
| # frontend(Web) |
| frontend: |
| image: node:18.20.8 |
| container_name: pixiu_admin_frontend |
| working_dir: /app/web |
| volumes: |
| - ./admin/web:/app/web |
| ports: |
| - "8080:8080" |
| environment: |
| - VUE_APP_BACKEND_URL=http://pixiu_admin_go_backend:8081 |
| command: > |
| sh -c " |
| yarn install && |
| yarn run serve --host 0.0.0.0 |
| " |
| networks: |
| - app_network |
| |
| networks: |
| app_network: |
| driver: bridge |