This commit is contained in:
pader.zhang 2019-05-22 16:18:41 +08:00
commit 600ce0509a
18 changed files with 680 additions and 0 deletions

99
README.md Normal file
View File

@ -0,0 +1,99 @@
# Nacos Docker
![Docker Pulls](https://img.shields.io/docker/pulls/nacos/nacos-server.svg?maxAge=60480)
This project contains a Docker image meant to facilitate the deployment of [Nacos](https://github.com/alibaba/nacos).
## Project directory
* buildNacos makes the source code of the docker image
* env: Environment variable file for compose yaml
* example: Docker compose example for Nacos server
## Quick Start
Run the following command
* Clone project
```powershell
git clone https://github.com/nacos-group/nacos-docker.git
cd nacos-docker
```
* Standalone Derby
```powershell
docker-compose -f example/standalone-derby.yaml up
```
* Standalone Mysql
```powershell
docker-compose -f example/standalone-mysql.yaml up
```
* Cluster
```powershell
docker-compose -f example/cluster-hostname.yaml up
```
* Service registration
```powershell
curl -X PUT 'http://127.0.0.1:8848/nacos/v1/ns/instance?serviceName=nacos.naming.serviceName&ip=20.18.7.10&port=8080'
```
* Service discovery
```powershell
curl -X GET 'http://127.0.0.1:8848/nacos/v1/ns/instances?serviceName=nacos.naming.serviceName'
```
* Publish config
```powershell
curl -X POST "http://127.0.0.1:8848/nacos/v1/cs/configs?dataId=nacos.cfg.dataId&group=test&content=helloWorld"
```
* Get config
```powershell
curl -X GET "http://127.0.0.1:8848/nacos/v1/cs/configs?dataId=nacos.cfg.dataId&group=test"
```
* Open the Nacos console in your browser
linkhttp://127.0.0.1:8848/nacos/
## Common property configuration
| name | description | option |
| ----------------------------- | -------------------------------------- | -------------------------------------- |
| MODE | cluster/standalone | cluster/standalone default **cluster** |
| PREFER_HOST_MODE | Whether hostname are supported | hostname/ip default **ip** |
| NACOS_SERVER_PORT | nacos server port | default **8848** |
| NACOS_SERVER_IP | custom nacos server ip when network was mutil-network | |
| SPRING_DATASOURCE_PLATFORM | standalone support mysql | mysql / empty default empty |
| MYSQL_MASTER_SERVICE_HOST | mysql master host | |
| MYSQL_MASTER_SERVICE_PORT | mysql master database port | default : **3306** |
| MYSQL_MASTER_SERVICE_DB_NAME | mysql master database name | |
| MYSQL_MASTER_SERVICE_USER | username of master database | |
| MYSQL_MASTER_SERVICE_PASSWORD | password of master database | |
| MYSQL_SLAVE_SERVICE_HOST | mysql slave host | |
| MYSQL_SLAVE_SERVICE_PORT | mysql slave database port | default :3306 |
## Nacos + Grafana + Prometheus
Usage reference[Nacos monitor-guide](https://nacos.io/zh-cn/docs/monitor-guide.html)
**Note**: When Grafana creates a new data source, the data source address must be **http://prometheus:9090**

47
build/Dockerfile Normal file
View File

@ -0,0 +1,47 @@
FROM centos:7.5.1804
MAINTAINER pader "huangmnlove@163.com"
# set environment
ENV MODE="cluster" \
PREFER_HOST_MODE="ip"\
BASE_DIR="/home/nacos" \
CLASSPATH=".:/home/nacos/conf:$CLASSPATH" \
CLUSTER_CONF="/home/nacos/conf/cluster.conf" \
FUNCTION_MODE="all" \
JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk" \
NACOS_USER="nacos" \
JAVA="/usr/lib/jvm/java-1.8.0-openjdk/bin/java" \
TIME_ZONE="Asia/Shanghai"
ARG NACOS_VERSION=1.0.0
WORKDIR /$BASE_DIR
RUN set -x \
&& yum update -y \
&& yum install -y java-1.8.0-openjdk java-1.8.0-openjdk-devel wget iputils nc vim libcurl\
&& wget https://github.com/alibaba/nacos/releases/download/${NACOS_VERSION}/nacos-server-${NACOS_VERSION}.tar.gz -P /home \
&& tar -xzvf /home/nacos-server-${NACOS_VERSION}.tar.gz -C /home \
&& rm -rf /home/nacos-server-${NACOS_VERSION}.tar.gz /home/nacos/bin/* /home/nacos/conf/*.properties /home/nacos/conf/*.example /home/nacos/conf/nacos-mysql.sql \
&& yum autoremove -y wget \
&& ln -snf /usr/share/zoneinfo/$TIME_ZONE /etc/localtime && echo '$TIME_ZONE' > /etc/timezone \
&& yum clean all
ADD bin/docker-startup.sh bin/docker-startup.sh
ADD conf/application.properties conf/application.properties
ADD init.d/custom.properties init.d/custom.properties
# set startup log dir
RUN mkdir -p logs \
&& cd logs \
&& touch start.out \
&& ln -sf /dev/stdout start.out \
&& ln -sf /dev/stderr start.out
RUN chmod +x bin/docker-startup.sh
EXPOSE 8848
ENTRYPOINT ["bin/docker-startup.sh"]

95
build/bin/docker-startup.sh Executable file
View File

@ -0,0 +1,95 @@
#!/bin/bash
# Copyright 1999-2018 Alibaba Group Holding Ltd.
# Licensed 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.
set -x
export DEFAULT_SEARCH_LOCATIONS="classpath:/,classpath:/config/,file:./,file:./config/"
export CUSTOM_SEARCH_LOCATIONS=${DEFAULT_SEARCH_LOCATIONS},file:${BASE_DIR}/conf/,${BASE_DIR}/init.d/
export CUSTOM_SEARCH_NAMES="application,custom"
PLUGINS_DIR="/home/nacos/plugins/peer-finder"
function print_servers(){
if [[ ! -d "${PLUGINS_DIR}" ]]; then
echo "" > "$CLUSTER_CONF"
for server in ${NACOS_SERVERS}; do
echo "$server" >> "$CLUSTER_CONF"
done
else
bash $PLUGINS_DIR/plugin.sh
sleep 30
fi
}
#===========================================================================================
# JVM Configuration
#===========================================================================================
if [[ "${MODE}" == "standalone" ]]; then
JAVA_OPT="${JAVA_OPT} -Xms512m -Xmx512m -Xmn256m"
JAVA_OPT="${JAVA_OPT} -Dnacos.standalone=true"
else
JAVA_OPT="${JAVA_OPT} -server -Xms2g -Xmx2g -Xmn1g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"
JAVA_OPT="${JAVA_OPT} -Xdebug -Xrunjdwp:transport=dt_socket,address=9555,server=y,suspend=n"
JAVA_OPT="${JAVA_OPT} -XX:-OmitStackTraceInFastThrow -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=${BASE_DIR}/logs/java_heapdump.hprof"
JAVA_OPT="${JAVA_OPT} -XX:-UseLargePages"
print_servers
fi
#===========================================================================================
# Setting system properties
#===========================================================================================
# set mode that Nacos Server function of split
if [[ "${FUNCTION_MODE}" == "config" ]]; then
JAVA_OPT="${JAVA_OPT} -Dnacos.functionMode=config"
elif [[ "${FUNCTION_MODE}" == "naming" ]]; then
JAVA_OPT="${JAVA_OPT} -Dnacos.functionMode=naming"
fi
# set nacos server ip
if [[ ! -z "${NACOS_SERVER_IP}" ]]; then
JAVA_OPT="${JAVA_OPT} -Dnacos.server.ip=${NACOS_SERVER_IP}"
fi
if [[ ! -z "${USE_ONLY_SITE_INTERFACES}" ]]; then
JAVA_OPT="${JAVA_OPT} -Dnacos.inetutils.use-only-site-local-interfaces=${USE_ONLY_SITE_INTERFACES}"
fi
if [[ ! -z "${PREFERRED_NETWORKS}" ]]; then
JAVA_OPT="${JAVA_OPT} -Dnacos.inetutils.preferred-networks=${PREFERRED_NETWORKS}"
fi
if [[ ! -z "${IGNORED_INTERFACES}" ]]; then
JAVA_OPT="${JAVA_OPT} -Dnacos.inetutils.ignored-interfaces=${IGNORED_INTERFACES}"
fi
if [[ "${PREFER_HOST_MODE}" == "hostname" ]]; then
JAVA_OPT="${JAVA_OPT} -Dnacos.preferHostnameOverIp=true"
fi
JAVA_MAJOR_VERSION=$($JAVA -version 2>&1 | sed -E -n 's/.* version "([0-9]*).*$/\1/p')
if [[ "$JAVA_MAJOR_VERSION" -ge "9" ]] ; then
JAVA_OPT="${JAVA_OPT} -Xlog:gc*:file=${BASE_DIR}/logs/nacos_gc.log:time,tags:filecount=10,filesize=102400"
else
JAVA_OPT="${JAVA_OPT} -Djava.ext.dirs=${JAVA_HOME}/jre/lib/ext:${JAVA_HOME}/lib/ext:${BASE_DIR}/plugins/cmdb"
JAVA_OPT="${JAVA_OPT} -Xloggc:${BASE_DIR}/logs/nacos_gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M"
fi
JAVA_OPT="${JAVA_OPT} -Dnacos.home=${BASE_DIR}"
JAVA_OPT="${JAVA_OPT} -jar ${BASE_DIR}/target/nacos-server.jar"
JAVA_OPT="${JAVA_OPT} ${JAVA_OPT_EXT}"
JAVA_OPT="${JAVA_OPT} --spring.config.location=${CUSTOM_SEARCH_LOCATIONS}"
JAVA_OPT="${JAVA_OPT} --spring.config.name=${CUSTOM_SEARCH_NAMES}"
JAVA_OPT="${JAVA_OPT} --logging.config=${BASE_DIR}/conf/nacos-logback.xml"
echo "nacos is starting,you can check the ${BASE_DIR}/logs/start.out"
echo "$JAVA ${JAVA_OPT}" > ${BASE_DIR}/logs/start.out 2>&1 &
nohup $JAVA ${JAVA_OPT} > ${BASE_DIR}/logs/start.out 2>&1 < /dev/null

View File

@ -0,0 +1,33 @@
# spring
server.servlet.contextPath=${SERVER_SERVLET_CONTEXTPATH:/nacos}
server.contextPath=/nacos
server.port=${NACOS_SERVER_PORT:8848}
spring.datasource.platform=${SPRING_DATASOURCE_PLATFORM:""}
nacos.cmdb.dumpTaskInterval=3600
nacos.cmdb.eventTaskInterval=10
nacos.cmdb.labelTaskInterval=300
nacos.cmdb.loadDataAtStart=false
db.num=2
db.url.0=jdbc:mysql://${MYSQL_MASTER_SERVICE_HOST}:${MYSQL_MASTER_SERVICE_PORT:3306}/${MYSQL_MASTER_SERVICE_DB_NAME}?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true
db.url.1=jdbc:mysql://${MYSQL_SLAVE_SERVICE_HOST}:${MYSQL_SLAVE_SERVICE_PORT:3306}/${MYSQL_MASTER_SERVICE_DB_NAME}?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true
db.user=${MYSQL_MASTER_SERVICE_USER}
db.password=${MYSQL_MASTER_SERVICE_PASSWORD}
server.tomcat.accesslog.enabled=true
server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D
# default current work dir
server.tomcat.basedir=
## spring security config
### turn off security
nacos.security.ignore.urls=/,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-fe/public/**,/v1/auth/login,/v1/console/health/**,/v1/cs/**,/v1/ns/**,/v1/cmdb/**,/actuator/**,/v1/console/server/**
# metrics for elastic search
management.metrics.export.elastic.enabled=fasle
management.metrics.export.influx.enabled=false
nacos.naming.distro.taskDispatchThreadCount=10
nacos.naming.distro.taskDispatchPeriod=200
nacos.naming.distro.batchSyncKeyCount=1000
nacos.naming.distro.initDataRatio=0.9
nacos.naming.distro.syncRetryDelay=5000
nacos.naming.data.warmup=true

View File

@ -0,0 +1,19 @@
#spring.security.enabled=false
#management.security=false
#security.basic.enabled=false
#nacos.security.ignore.urls=/**
#management.metrics.export.elastic.host=http://localhost:9200
# metrics for prometheus
#management.endpoints.web.exposure.include=*
# metrics for elastic search
#management.metrics.export.elastic.enabled=false
#management.metrics.export.elastic.host=http://localhost:9200
# metrics for influx
#management.metrics.export.influx.enabled=false
#management.metrics.export.influx.db=springboot
#management.metrics.export.influx.uri=http://localhost:8086
#management.metrics.export.influx.auto-create-db=true
#management.metrics.export.influx.consistency=one
#management.metrics.export.influx.compressed=true

3
changlog Normal file
View File

@ -0,0 +1,3 @@
version:1.0.0
1.构建nacos 1.0.0 最新镜像
2.增加多网卡环境变量支持

4
env/mysql-common.env vendored Normal file
View File

@ -0,0 +1,4 @@
# mysql template env
MYSQL_ROOT_PASSWORD=root
MYSQL_REPLICATION_USER=nacos_ru
MYSQL_REPLICATION_PASSWORD=nacos_ru

3
env/mysql-master.env vendored Normal file
View File

@ -0,0 +1,3 @@
MYSQL_DATABASE=nacos_devtest
MYSQL_USER=nacos
MYSQL_PASSWORD=nacos

1
env/mysql-slave.env vendored Normal file
View File

@ -0,0 +1 @@
MYSQL_MASTER_SERVICE_HOST=mysql-master

10
env/nacos-hostname.env vendored Normal file
View File

@ -0,0 +1,10 @@
#nacos dev env
PREFER_HOST_MODE=hostname
NACOS_SERVERS=nacos1:8848 nacos2:8848 nacos3:8848
MYSQL_MASTER_SERVICE_HOST=mysql-master
MYSQL_MASTER_SERVICE_DB_NAME=nacos_devtest
MYSQL_MASTER_SERVICE_PORT=3306
MYSQL_SLAVE_SERVICE_HOST=mysql-slave
MYSQL_SLAVE_SERVICE_PORT=3306
MYSQL_MASTER_SERVICE_USER=nacos
MYSQL_MASTER_SERVICE_PASSWORD=nacos

10
env/nacos-ip.env vendored Normal file
View File

@ -0,0 +1,10 @@
#nacos dev env
PREFER_HOST_MODE=hostname
NACOS_SERVERS=172.16.238.10:8848 172.16.238.11:8848 172.16.238.12:8848
MYSQL_MASTER_SERVICE_HOST=mysql-master
MYSQL_MASTER_SERVICE_DB_NAME=nacos_devtest
MYSQL_MASTER_SERVICE_PORT=3306
MYSQL_SLAVE_SERVICE_HOST=mysql-slave
MYSQL_SLAVE_SERVICE_PORT=3306
MYSQL_MASTER_SERVICE_USER=nacos
MYSQL_MASTER_SERVICE_PASSWORD=nacos

View File

@ -0,0 +1,89 @@
version: "3"
services:
nacos1:
hostname: nacos1
container_name: nacos1
image: nacos/nacos-server:latest
volumes:
- ./cluster-logs/nacos1:/home/nacos/logs
- ./init.d/custom.properties:/home/nacos/init.d/custom.properties
ports:
- "8848:8848"
- "9555:9555"
env_file:
- ../env/nacos-hostname.env
restart: on-failure
depends_on:
- mysql-master
- mysql-slave
nacos2:
hostname: nacos2
image: nacos/nacos-server:latest
container_name: nacos2
volumes:
- ./cluster-logs/nacos2:/home/nacos/logs
- ./init.d/custom.properties:/home/nacos/init.d/custom.properties
ports:
- "8849:8848"
env_file:
- ../env/nacos-hostname.env
restart: on-failure
depends_on:
- mysql-master
- mysql-slave
nacos3:
hostname: nacos3
image: nacos/nacos-server:latest
container_name: nacos3
volumes:
- ./cluster-logs/nacos3:/home/nacos/logs
- ./init.d/custom.properties:/home/nacos/init.d/custom.properties
ports:
- "8850:8848"
env_file:
- ../env/nacos-hostname.env
restart: on-failure
depends_on:
- mysql-master
- mysql-slave
mysql-master:
container_name: mysql-master
image: nacos/nacos-mysql-master:latest
env_file:
- ../env/mysql-common.env
- ../env/mysql-master.env
volumes:
- ./mysql-master:/var/lib/mysql
ports:
- "3306:3306"
mysql-slave:
container_name: mysql-slave
image: nacos/nacos-mysql-slave:latest
env_file:
- ../env/mysql-common.env
- ../env/mysql-slave.env
volumes:
- ./mysql-slave:/var/lib/mysql
ports:
- "3305:3306"
depends_on:
- mysql-master
prometheus:
container_name: prometheus
image: prom/prometheus:latest
volumes:
- ./prometheus/prometheus-cluster.yaml:/etc/prometheus/prometheus.yml
ports:
- "9090:9090"
depends_on:
- nacos1
- nacos2
- nacos3
restart: on-failure
grafana:
container_name: grafana
image: grafana/grafana:latest
ports:
- 3000:3000
restart: on-failure

87
example/cluster-ip.yaml Normal file
View File

@ -0,0 +1,87 @@
version: "2"
services:
nacos1:
image: nacos/nacos-server:latest
container_name: nacos1
networks:
nacos_net:
ipv4_address: 172.16.238.10
volumes:
- ./cluster-logs/nacos1:/home/nacos/logs
ports:
- "8848:8848"
- "9555:9555"
env_file:
- ../env/nacos-ip.env
restart: on-failure
depends_on:
- mysql-master
- mysql-slave
nacos2:
image: nacos/nacos-server:latest
container_name: nacos2
networks:
nacos_net:
ipv4_address: 172.16.238.11
volumes:
- ./cluster-logs/nacos2:/home/nacos/logs
ports:
- "8849:8848"
env_file:
- ../env/nacos-ip.env
restart: always
depends_on:
- mysql-master
- mysql-slave
nacos3:
image: nacos/nacos-server:latest
container_name: nacos3
networks:
nacos_net:
ipv4_address: 172.16.238.12
volumes:
- ./cluster-logs/nacos2:/home/nacos/logs
ports:
- "8850:8848"
env_file:
- ../env/nacos-ip.env
restart: always
depends_on:
- mysql-master
- mysql-slave
mysql-master:
container_name: mysql-master
image: nacos/nacos-mysql-master:latest
networks:
nacos_net:
ipv4_address: 172.16.238.13
env_file:
- ../env/mysql-common.env
- ../env/mysql-master.env
volumes:
- ./mysql-master:/var/lib/mysql
ports:
- "3306:3306"
mysql-slave:
container_name: mysql-slave
image: nacos/nacos-mysql-slave:latest
networks:
nacos_net:
ipv4_address: 172.16.238.14
env_file:
- ../env/mysql-common.env
- ../env/mysql-slave.env
volumes:
- ./mysql-slave:/var/lib/mysql
ports:
- "3305:3306"
depends_on:
- mysql-master
networks:
nacos_net:
driver: bridge
ipam:
driver: default
config:
- subnet: 172.16.238.0/24

View File

@ -0,0 +1,19 @@
#spring.security.enabled=false
#management.security=false
#security.basic.enabled=false
#nacos.security.ignore.urls=/**
#management.metrics.export.elastic.host=http://localhost:9200
# metrics for prometheus
management.endpoints.web.exposure.include=*
# metrics for elastic search
#management.metrics.export.elastic.enabled=false
#management.metrics.export.elastic.host=http://localhost:9200
# metrics for influx
#management.metrics.export.influx.enabled=false
#management.metrics.export.influx.db=springboot
#management.metrics.export.influx.uri=http://localhost:8086
#management.metrics.export.influx.auto-create-db=true
#management.metrics.export.influx.consistency=one
#management.metrics.export.influx.compressed=true

View File

@ -0,0 +1,34 @@
# my global config
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).
# Alertmanager configuration
alerting:
alertmanagers:
- static_configs:
- targets:
# - alertmanager:9093
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
# - "first_rules.yml"
# - "second_rules.yml"
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: 'prometheus'
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
- targets: ['localhost:9090']
- job_name: 'nacos'
metrics_path: '/nacos/actuator/prometheus'
static_configs:
- targets: ["nacos1:8848","nacos2:8848","nacos3:8848"]

View File

@ -0,0 +1,34 @@
# my global config
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).
# Alertmanager configuration
alerting:
alertmanagers:
- static_configs:
- targets:
# - alertmanager:9093
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
# - "first_rules.yml"
# - "second_rules.yml"
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: 'prometheus'
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
- targets: ['localhost:9090']
- job_name: 'nacos'
metrics_path: '/nacos/actuator/prometheus'
static_configs:
- targets: ['nacos:8848']

View File

@ -0,0 +1,29 @@
version: "2"
services:
nacos:
image: nacos/nacos-server:latest
container_name: nacos-standalone
environment:
- PREFER_HOST_MODE=hostname
- MODE=standalone
volumes:
- ./standalone-logs/:/home/nacos/logs
- ./init.d/custom.properties:/home/nacos/init.d/custom.properties
ports:
- "8848:8848"
prometheus:
container_name: prometheus
image: prom/prometheus:latest
volumes:
- ./prometheus/prometheus-standalone.yaml:/etc/prometheus/prometheus.yml
ports:
- "9090:9090"
depends_on:
- nacos
restart: on-failure
grafana:
container_name: grafana
image: grafana/grafana:latest
ports:
- 3000:3000
restart: on-failure

View File

@ -0,0 +1,64 @@
version: "2"
services:
nacos:
image: nacos/nacos-server:latest
container_name: nacos-standalone-mysql
environment:
- PREFER_HOST_MODE=hostname
- MODE=standalone
- SPRING_DATASOURCE_PLATFORM=mysql
- MYSQL_MASTER_SERVICE_HOST=mysql-master
- MYSQL_MASTER_SERVICE_DB_NAME=nacos_devtest
- MYSQL_MASTER_SERVICE_PORT=3306
- MYSQL_SLAVE_SERVICE_HOST=mysql-slave
- MYSQL_SLAVE_SERVICE_PORT=3306
- MYSQL_MASTER_SERVICE_USER=nacos
- MYSQL_MASTER_SERVICE_PASSWORD=nacos
volumes:
- ./standalone-logs/:/home/nacos/logs
- ./init.d/custom.properties:/home/nacos/init.d/custom.properties
ports:
- "8848:8848"
- "9555:9555"
depends_on:
- mysql-slave
restart: on-failure
mysql-master:
container_name: mysql-master
image: nacos/nacos-mysql-master:latest
env_file:
- ../env/mysql-common.env
- ../env/mysql-master.env
volumes:
- ./mysql-master:/var/lib/mysql
ports:
- "3306:3306"
mysql-slave:
container_name: mysql-slave
image: nacos/nacos-mysql-slave:latest
env_file:
- ../env/mysql-common.env
- ../env/mysql-slave.env
volumes:
- ./mysql-slave:/var/lib/mysql
ports:
- "3305:3306"
depends_on:
- mysql-master
prometheus:
container_name: prometheus
image: prom/prometheus:latest
volumes:
- ./prometheus/prometheus-standalone.yaml:/etc/prometheus/prometheus.yml
ports:
- "9090:9090"
depends_on:
- nacos
restart: on-failure
grafana:
container_name: grafana
image: grafana/grafana:latest
ports:
- 3000:3000
restart: on-failure