-
Notifications
You must be signed in to change notification settings - Fork 183
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
136 lines (128 loc) · 3.72 KB
/
docker-compose.yml
File metadata and controls
136 lines (128 loc) · 3.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#
# 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