From 0f1c08d8ec6151c4e23bf3e62ebbc5ac8e8931d4 Mon Sep 17 00:00:00 2001 From: Konstantin Lebedev Date: Sun, 17 Jan 2021 18:33:14 +0500 Subject: [PATCH] docker-compose - prometheus - nginx --- docker/local-k8s-compose.yml | 41 +++++++++++++++++++++++++++----- docker/nginx/proxy.conf | 30 +++++++++++++++++++++++ docker/prometheus/prometheus.yml | 13 ++++++++++ docker/seaweedfs-compose.yml | 18 +++++++++++--- 4 files changed, 93 insertions(+), 9 deletions(-) create mode 100644 docker/nginx/proxy.conf create mode 100644 docker/prometheus/prometheus.yml diff --git a/docker/local-k8s-compose.yml b/docker/local-k8s-compose.yml index 0dda89ca4..9a25465c4 100644 --- a/docker/local-k8s-compose.yml +++ b/docker/local-k8s-compose.yml @@ -38,28 +38,57 @@ services: - WEED_MYSQL_USERNAME=seaweedfs - WEED_MYSQL_PASSWORD=secret - WEED_MYSQL_ENABLED=true + - WEED_MYSQL_CONNECTION_MAX_IDLE=5 + - WEED_MYSQL_CONNECTION_MAX_OPEN=75 + # "refresh" connection every 10 minutes, eliminating mysql closing "old" connections + - WEED_MYSQL_CONNECTION_MAX_LIFETIME_SECONDS=600 + # enable usage of memsql as filer backend + - WEED_MYSQL_INTERPOLATEPARAMS=true - WEED_LEVELDB2_ENABLED=false - command: 'filer -master="master:9333"' + command: '-v 9 filer -master="master:9333"' depends_on: - master - volume - mysql ingress: - image: jwilder/nginx-proxy + image: jwilder/nginx-proxy:alpine ports: - "80:80" volumes: - /var/run/docker.sock:/tmp/docker.sock:ro - - /tmp/nginx:/etc/nginx/conf.d + - ./nginx/proxy.conf:/etc/nginx/proxy.conf s3: image: chrislusf/seaweedfs:local ports: - 8333:8333 - command: 's3 -filer="filer:8888"' + command: '-v 9 s3 -filer="filer:8888"' depends_on: - master - volume - filer environment: - - VIRTUAL_HOST=s3 - - VIRTUAL_PORT=8333 \ No newline at end of file + - VIRTUAL_HOST=ingress + - VIRTUAL_PORT=8333 + registry: + image: registry:2 + environment: + REGISTRY_HTTP_ADDR: "0.0.0.0:5001" # seaweedfs s3 + REGISTRY_LOG_LEVEL: "debug" + REGISTRY_STORAGE: "s3" + REGISTRY_STORAGE_S3_REGION: "us-east-1" + REGISTRY_STORAGE_S3_REGIONENDPOINT: "http://ingress" + REGISTRY_STORAGE_S3_BUCKET: "registry" + REGISTRY_STORAGE_S3_ACCESSKEY: "some_access_key1" + REGISTRY_STORAGE_S3_SECRETKEY: "some_secret_key1" + REGISTRY_STORAGE_S3_V4AUTH: "true" + REGISTRY_STORAGE_S3_SECURE: "false" + REGISTRY_STORAGE_S3_SKIPVERIFY: "true" + REGISTRY_STORAGE_S3_ROOTDIRECTORY: "/" + REGISTRY_STORAGE_DELETE_ENABLED: "true" + REGISTRY_STORAGE_REDIRECT_DISABLE: "true" + REGISTRY_VALIDATION_DISABLED: "true" + ports: + - 5001:5001 + depends_on: + - s3 + - ingress \ No newline at end of file diff --git a/docker/nginx/proxy.conf b/docker/nginx/proxy.conf new file mode 100644 index 000000000..59ff30ce2 --- /dev/null +++ b/docker/nginx/proxy.conf @@ -0,0 +1,30 @@ +# HTTP 1.1 support +proxy_http_version 1.1; +#proxy_buffering off; +proxy_set_header Host $http_host; +proxy_set_header Upgrade $http_upgrade; +proxy_set_header Connection $proxy_connection; +proxy_set_header X-Real-IP $remote_addr; +proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; +proxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto; +proxy_set_header X-Forwarded-Ssl $proxy_x_forwarded_ssl; +proxy_set_header X-Forwarded-Port $proxy_x_forwarded_port; + +# Mitigate httpoxy attack (see README for details) +proxy_set_header Proxy ""; + +# aws default max_concurrent_requests 10 +# aws default multipart_threshold 8MB +proxy_buffering on; # GET buffering or “X-Accel-Buffering” enables or disables buffering of a response; +proxy_buffers 64 1m; # buffers used for reading a response from the proxied server, for a single connection +proxy_buffer_size 8k; # maximum size of the data that nginx can receive from the server at a time is set +proxy_busy_buffers_size 2m; + +proxy_request_buffering on; # PUT buffering +client_body_buffer_size 64m; # buffer size for reading client request body +client_max_body_size 64m; + +proxy_next_upstream error timeout non_idempotent http_500; # PUT request should be passed to the next server: +proxy_connect_timeout 200ms; +proxy_read_timeout 3s; #timeout is set only between two successive read operations +proxy_send_timeout 3s; #timeout is set only between two successive write operations diff --git a/docker/prometheus/prometheus.yml b/docker/prometheus/prometheus.yml new file mode 100644 index 000000000..34f669d56 --- /dev/null +++ b/docker/prometheus/prometheus.yml @@ -0,0 +1,13 @@ +global: + scrape_interval: 30s + scrape_timeout: 10s + +scrape_configs: + - job_name: services + metrics_path: /metrics + static_configs: + - targets: + - 'prometheus:9090' + - 'volume:9325' + - 'filer:9326' + - 's3:9327' \ No newline at end of file diff --git a/docker/seaweedfs-compose.yml b/docker/seaweedfs-compose.yml index 70d005017..3c8a8e3e3 100644 --- a/docker/seaweedfs-compose.yml +++ b/docker/seaweedfs-compose.yml @@ -12,7 +12,8 @@ services: ports: - 8080:8080 - 18080:18080 - command: 'volume -mserver="master:9333" -port=8080' + - 9325:9325 + command: 'volume -mserver="master:9333" -port=8080 -metricsPort=9325' depends_on: - master filer: @@ -20,7 +21,8 @@ services: ports: - 8888:8888 - 18888:18888 - command: 'filer -master="master:9333"' + - 9326:9326 + command: 'filer -master="master:9333" -metricsPort=9326' tty: true stdin_open: true depends_on: @@ -40,8 +42,18 @@ services: image: chrislusf/seaweedfs # use a remote image ports: - 8333:8333 - command: 's3 -filer="filer:8888"' + - 9327:9327 + command: 's3 -filer="filer:8888" -metricsPort=9327' depends_on: - master - volume - filer + prometheus: + image: prom/prometheus:v2.21.0 + ports: + - 9000:9090 + volumes: + - ./prometheus:/etc/prometheus + command: --web.enable-lifecycle --config.file=/etc/prometheus/prometheus.yml + depends_on: + - s3