Open tiancheng91 opened 3 years ago
docker network create -d overlay --attachable core
## db
docker run -d --name db-redis --network=core -v redis:/data redis:5 redis-server --appendonly yes
docker run -d --name db-pgsql --network=core -v pgsql:/var/lib/postgresql/data -e POSTGRES_PASSWORD=123456 postgres:13
docker run -d --name db-mysql --network=core -v mysql:/var/lib/mysql -e MYSQL_ROOT_PASSWORD=123456 mariadb:10.6
docker run -d --name db-scylla --network core -v db_scylla:/var/lib/scylla -cpus=0.3 --hostname db-scylla1 scylladb/scylla --memory 150M
docker run -d --name db-metrics --network core -v data-metrics:/victoria-metrics-data -cpus=0.3 -p 8428:8428 victoriametrics/victoria-metrics -selfScrapeInstance 60s
## dev
docker run -d --name prom-loki --network core -v db_loki:/loki -p 3100:3100 grafana/loki
docker run -d --name prom-tail --network core -v /var/log:/var/log grafana/promtail -config.file=/etc/promtail/config.yml
docker run -d --name prom-grafana --network core -e GF_SECURITY_ADMIN_USER=admin -e GF_SECURITY_ADMIN_PASSWORD=admin grafana/grafana
## gateway
docker run -d --name nginx -v /opt/nginx:/opt/nginx --network frontend -p 80:80 nginx:alpine nginx -g 'daemon off; master_process on;' -c /opt/nginx/nginx.conf
## test
docker run -dt --name debug --network=core alpine /bin/sh
version: "3"
networks:
default:
external:
name: core
services:
metrics:
image: victoriametrics/victoria-metrics
container_name: metrics
command:
- '-selfScrapeInstance 60s'
ports:
- 8428:8428
volumes:
- data-metrics:/victoria-metrics-data
deploy:
placement:
constraints: [node.role == manager]
grafana:
image: grafana/grafana
container_name: grafana
ports:
- 3000:3000
restart: unless-stopped
environment:
- GF_SECURITY_ADMIN_USER=admin
- GF_SECURITY_ADMIN_PASSWORD=grafana
volumes:
- ./grafana:/etc/grafana/provisioning/datasources
deploy:
placement:
constraints: [node.role == manager]
loki:
image: grafana/loki
ports:
- "3100:3100"
command: -config.file=/etc/loki/local-config.yaml
deploy:
placement:
constraints: [node.role == manager]
promtail:
image: grafana/promtail
volumes:
- /var/log:/var/log
command: -config.file=/etc/promtail/config.yml
deploy:
mode: global
version: '3'
networks:
frontend:
external: true
driver: overlay
backend:
external: true
driver: overlay
volumes:
redis:
pgdata:
mysql:
mongo:
services:
redis:
image: "redis:5"
volumes:
- redis:/data
networks:
- backend
deploy:
placement:
constraints: [node.role == manager]
command: redis-server --appendonly yes
cache:
image: "redis:5"
networks:
- backend
deploy:
placement:
constraints: [node.role == manager]
pgsql:
image: "postgres:13"
networks:
- backend
deploy:
placement:
constraints: [node.role == manager]
environment:
POSTGRES_PASSWORD: 123456
volumes:
- pgdata:/var/lib/postgresql/data
mysql:
image: "mariadb:10.5"
networks:
- backend
deploy:
placement:
constraints: [node.role == manager]
environment:
MYSQL_ROOT_PASSWORD: 123456
volumes:
- mysql:/var/lib/mysql
mongo:
image: "mongo:4"
networks:
- backend
deploy:
placement:
constraints: [node.role == manager]
volumes:
- mongo:/data/db
adminer:
image: adminer
deploy:
replicas: 1
# db arm64
docker run --name consul --net=host -v consul:/consul arm64v8/consul agent -server -ui -bootstrap-expect=1 -bind=192.168.0.11 -client=192.168.0.11
# docker run --name mysql --net=host -v mysql:/var/lib/mysql -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -d arm64v8/mariadb:10.3
docker run --name mysql --net=host -v mysql:/var/lib/mysql -e MYSQL_ALLOW_EMPTY_PASSWORD=yes -d tiancheng91/mysql
docker run --name mongo --net=host -v mongo:/data/db -d arm64v8/mongo:4.2
# redis arm64
docker run --name cache --net=host -d arm64v8/redis:5 --port 6380
docker run --name redis --net=host -v redis:/data -d tiancheng91/redisbloom redis-server --appendonly yes