DNMP Docker-Compose

DNMP(Docker + Nginx/Openresty + MySQL5,8 + PHP5,7,8 + Redis + ElasticSearch + MongoDB + RabbitMQ)是一款全功能的LNMP一键安装程序,支持Arm CPU。
DNMP

记录我自己的DNMP

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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
version: "3"
services:
nginx:
build:
context: ./services/nginx
args:
NGINX_VERSION: ${NGINX_VERSION}
CONTAINER_PACKAGE_URL: ${CONTAINER_PACKAGE_URL}
NGINX_INSTALL_APPS: ${NGINX_INSTALL_APPS}
container_name: nginx
ports:
- "${NGINX_HTTP_HOST_PORT}:80"
- "${NGINX_HTTPS_HOST_PORT}:443"
volumes:
- ${SOURCE_DIR}:/www/:rw
- ${NGINX_SSL_CERTIFICATE_DIR}:/ssl:rw
- ${NGINX_CONFD_DIR}:/etc/nginx/conf.d/:rw
- ${NGINX_CONF_FILE}:/etc/nginx/nginx.conf:ro
- ${NGINX_FASTCGI_PHP_CONF}:/etc/nginx/fastcgi-php.conf:ro
- ${NGINX_FASTCGI_PARAMS}:/etc/nginx/fastcgi_params:ro
- ${NGINX_LOG_DIR}:/var/log/nginx/:rw
environment:
TZ: "$TZ"
restart: always
networks:
- default

php:
build:
context: ./services/php
args:
PHP_VERSION: php:${PHP_VERSION}-fpm-alpine
CONTAINER_PACKAGE_URL: ${CONTAINER_PACKAGE_URL}
PHP_EXTENSIONS: ${PHP_EXTENSIONS}
TZ: "$TZ"
container_name: php
expose:
- 9501
extra_hosts:
- "www.site1.com:172.17.0.1"
ports:
- "8010:8010"
- "9501:9501"
- "9502:9502"
- "9503:9503"
- "9801:9801"
- "9802:9802"
volumes:
- ${SOURCE_DIR}:/www/:rw
- ${PHP_PHP_CONF_FILE}:/usr/local/etc/php/php.ini:ro
- ${PHP_FPM_CONF_FILE}:/usr/local/etc/php-fpm.d/www.conf:rw
- ${PHP_LOG_DIR}:/var/log/php
- ${DATA_DIR}/composer:/tmp/composer
restart: always
cap_add:
- SYS_PTRACE
networks:
- default

mysql:
image: mysql:${MYSQL_VERSION}
container_name: mysql
ports:
- "${MYSQL_HOST_PORT}:3306"
volumes:
- ${MYSQL_CONF_FILE}:/etc/mysql/conf.d/mysql.cnf:ro
- ${DATA_DIR}/mysql:/var/lib/mysql/:rw
restart: always
networks:
- default
environment:
MYSQL_ROOT_PASSWORD: "${MYSQL_ROOT_PASSWORD}"
TZ: "$TZ"

mysql5:
image: mysql:${MYSQL5_VERSION}
container_name: mysql5
ports:
- "${MYSQL5_HOST_PORT}:3306"
volumes:
- ${MYSQL5_CONF_FILE}:/etc/mysql/conf.d/mysql.cnf:ro
- ${DATA_DIR}/mysql5:/var/lib/mysql/:rw
restart: always
networks:
- default
environment:
MYSQL_ROOT_PASSWORD: "${MYSQL5_ROOT_PASSWORD}"
TZ: "$TZ"

redis:
image: redis:${REDIS_VERSION}
container_name: redis
ports:
- "${REDIS_HOST_PORT}:6379"
volumes:
- ${REDIS_CONF_FILE}:/etc/redis.conf:ro
- ${DATA_DIR}/redis:/data/:rw
restart: always
entrypoint: ["redis-server", "/etc/redis.conf"]
environment:
TZ: "$TZ"
networks:
- default

rabbitmq:
image: rabbitmq:${RABBITMQ_VERSION}
container_name: rabbitmq
restart: always
ports:
- "${RABBITMQ_HOST_PORT_C}:5672"
- "${RABBITMQ_HOST_PORT_S}:15672"
environment:
TZ: "$TZ"
RABBITMQ_DEFAULT_USER: "${RABBITMQ_DEFAULT_USER}"
RABBITMQ_DEFAULT_PASS: "${RABBITMQ_DEFAULT_PASS}"
networks:
- default

mongodb:
image: mongo:${MONGODB_VERSION}
container_name: mongodb
environment:
MONGO_INITDB_ROOT_USERNAME: "${MONGODB_INITDB_ROOT_USERNAME}"
MONGO_INITDB_ROOT_PASSWORD: "${MONGODB_INITDB_ROOT_PASSWORD}"
TZ: "$TZ"
volumes:
- ${DATA_DIR}/mongo:/data/db:rw
- ${DATA_DIR}/mongo_key:/mongo:rw
ports:
- "${MONGODB_HOST_PORT}:27017"
networks:
- default
command:
--auth

elasticsearch:
build:
context: ./services/elasticsearch
args:
ELASTICSEARCH_VERSION: ${ELASTICSEARCH_VERSION}
ELASTICSEARCH_PLUGINS: ${ELASTICSEARCH_PLUGINS}
container_name: elasticsearch
environment:
- TZ=$TZ
- discovery.type=single-node
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
volumes:
- ${DATA_DIR}/esdata:/usr/share/elasticsearch/data
- ${ELASTICSEARCH_CONF_FILE}:/usr/share/elasticsearch/config/elasticsearch.yml
hostname: elasticsearch
restart: always
ports:
- "${ELASTICSEARCH_HOST_PORT_C}:9200"
- "${ELASTICSEARCH_HOST_PORT_S}:9300"

kibana:
image: kibana:${KIBANA_VERSION}
container_name: kibana
environment:
TZ: "$TZ"
elasticsearch.hosts: http://elasticsearch:9200
I18N_LOCALE: "${KIBANA_I18N_LOCALE}"
hostname: kibana
depends_on:
- elasticsearch
restart: always
ports:
- "${KIBANA_HOST}:5601"

jenkins:
image: jenkins/jenkins:lts
volumes:
- ${DATA_DIR}/jenkins/:/var/jenkins_home
- /var/run/docker.sock:/var/run/docker.sock
- /usr/bin/docker:/usr/bin/docker
- /usr/lib/x86_64-linux-gnu/libltdl.so.7:/usr/lib/x86_64-linux-gnu/libltdl.so.7
ports:
- "8081:8080"
expose:
- "8081"
- "50000"
privileged: true
user: root
restart: always
container_name: jenkins
environment:
JAVA_OPTS: '-Djava.util.logging.config.file=/var/jenkins_home/log.properties'

zookeeper:
image: wurstmeister/zookeeper
ports:
- "2181:2181"
networks:
- default

kafka:
image: wurstmeister/kafka
ports:
- "9092:9092"
- "9999:9999"
environment:
TZ: "$TZ"
KAFKA_ADVERTISED_HOST_NAME: localhost
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
# 非必须,设置
KAFKA_MESSAGE_MAX_BYTES: 20000000
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "true"
KAFKA_ADVERTISED_PORT: ${KAFKA_HOST_PORT}
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://127.0.0.1:9092
KAFKA_LISTENERS: PLAINTEXT://:9092
KAFKA_HEAP_OPTS: "-Xms256m -Xmx256m"
KAFKA_JMX_PORT: 9999
depends_on:
- zookeeper
volumes:
- ./data/kafka:/kafka
- /var/run/docker.sock:/var/run/docker.sock
networks:
- default

kafka-manager:
image: sheepkiller/kafka-manager
ports:
- 9020:9000
environment:
ZK_HOSTS: zookeeper:2181
depends_on:
- zookeeper
- kafka
networks:
- default

node:
image: node:${NODE_VERSION}
environment:
- NODE_ENV=production
volumes:
- ${SOURCE_DIR}:/www/:rw
expose:
- "8082"
networks:
- default
stdin_open: true
tty: true

networks:
default:

Powered by Hexo and Hexo-theme-hiker

Copyright © 2017 - 2023 Keep It Simple And Stupid All Rights Reserved.

访客数 : | 访问量 :