tiancheng91 / collection

笔记
https://github.com/tiancheng91/collection/issues
22 stars 1 forks source link

apps #55

Open tiancheng91 opened 3 years ago

tiancheng91 commented 3 years ago
docker network create -d overlay --ipv6=false --attachable backend 

# port 
docker run -d --name=metrics -v data-metrics:/victoria-metrics-data --network backend -p 8428:8428 victoriametrics/victoria-metrics -selfScrapeInstance 60s 
  // -promscrape.config /victoria-metrics-data/scrape_jobs.yaml

# port 3000
docker run -d --name=grafana --network backend grafana/grafana
docker run -d --name=alert --network backend  bitnami/alertmanager:latest

docker run -d --name nginx -v /opt/nginx:/opt/nginx --network backend -p 80:80 -p 443:443 nginx:alpine nginx -g 'daemon off; master_process on;' -c /opt/nginx/nginx.conf
tiancheng91 commented 3 years ago

https://laradock.io/

tiancheng91 commented 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
tiancheng91 commented 3 years ago
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
tiancheng91 commented 3 years ago
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
tiancheng91 commented 3 years ago
# 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