From da50ecbf037e7ab810755aeaf6fc1c183da38f4f Mon Sep 17 00:00:00 2001 From: cs131039 Date: Thu, 11 Jun 2020 22:07:18 +0000 Subject: [PATCH] Upload files to 'project' --- project/docker-compose.yml | 209 +++++++++++++++++++++++++++++++++++++ project/nginx.conf | 24 +++++ 2 files changed, 233 insertions(+) create mode 100644 project/docker-compose.yml create mode 100644 project/nginx.conf diff --git a/project/docker-compose.yml b/project/docker-compose.yml new file mode 100644 index 0000000..9d40373 --- /dev/null +++ b/project/docker-compose.yml @@ -0,0 +1,209 @@ +version: '3.7' + +services: + db: + image: mariadb + container_name: mariadb + volumes: + - db_data:/var/lib/mysql + ports: + - "3306:3306" + networks: + - wp-net + restart: always + environment: + MYSQL_ROOT_PASSWORD: wordpress + MYSQL_DATABASE: wordpress + MYSQL_USER: wordpress + MYSQL_PASSWORD: wordpress + deploy: + placement: + constraints: [node.role == worker] + replicas: 1 + update_config: + delay: 10s + restart_policy: + condition: on-failure + + wordpress: + depends_on: + - db + image: wordpress:latest + container_name: wordpress + ports: + - "9000:80" + restart: always + environment: + WORDPRESS_DB_HOST: db:3306 + WORDPRESS_DB_USER: wordpress + WORDPRESS_DB_PASSWORD: wordpress + WORDPRESS_DB_NAME: wordpress + volumes: + - wordpress:/var/www/html + networks: + - wp-net + deploy: + placement: + constraints: [node.role == worker] + replicas: 1 + resources: + limits: #max resources + cpus: '0.50' + memory: 50M + reservations: #default resources + cpus: '0.25' + memory: 20M + update_config: + delay: 10s + restart_policy: + condition: on-failure + + + nginx: + image: nginx + ports: + - 80:80 + - 443:443 + volumes: + - wordpress:/var/www/html + - ./nginx.conf:/etc/nginx/conf.conf + depends_on: + - wordpress + networks: + - wp-net + deploy: + mode: replicated + replicas: 1 + restart_policy: + condition: on-failure + + minio1: + image: minio/minio:RELEASE.2020-06-03T22-13-49Z + hostname: minio1 + volumes: + - minio1-data:/export + ports: + - "9005:9000" + networks: + - minio_distributed + deploy: + restart_policy: + delay: 10s + max_attempts: 10 + window: 60s + placement: + constraints: + - node.labels.minio1==true + command: server http://minio{1...4}/export + secrets: + - secret_key + - access_key + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] + interval: 30s + timeout: 20s + retries: 3 + + minio2: + image: minio/minio:RELEASE.2020-06-03T22-13-49Z + hostname: minio2 + volumes: + - minio2-data:/export + ports: + - "9006:9000" + networks: + - minio_distributed + deploy: + restart_policy: + delay: 10s + max_attempts: 10 + window: 60s + placement: + constraints: + - node.labels.minio2==true + command: server http://minio{1...4}/export + secrets: + - secret_key + - access_key + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] + interval: 30s + timeout: 20s + retries: 3 + + minio3: + image: minio/minio:RELEASE.2020-06-03T22-13-49Z + hostname: minio3 + volumes: + - minio3-data:/export + ports: + - "9007:9000" + networks: + - minio_distributed + deploy: + restart_policy: + delay: 10s + max_attempts: 10 + window: 60s + placement: + constraints: + - node.labels.minio3==true + command: server http://minio{1...4}/export + secrets: + - secret_key + - access_key + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] + interval: 30s + timeout: 20s + retries: 3 + + minio4: + image: minio/minio:RELEASE.2020-06-03T22-13-49Z + hostname: minio4 + volumes: + - minio4-data:/export + ports: + - "9008:9000" + networks: + - minio_distributed + deploy: + restart_policy: + delay: 10s + max_attempts: 10 + window: 60s + placement: + constraints: + - node.labels.minio4==true + command: server http://minio{1...4}/export + secrets: + - secret_key + - access_key + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] + interval: 30s + timeout: 20s + retries: 3 + +volumes: + minio1-data: + + minio2-data: + + minio3-data: + + minio4-data: + + db_data: + wordpress: + +networks: + wp-net: + minio_distributed: + driver: overlay + +secrets: + secret_key: + external: true + access_key: + external: true diff --git a/project/nginx.conf b/project/nginx.conf new file mode 100644 index 0000000..16f924f --- /dev/null +++ b/project/nginx.conf @@ -0,0 +1,24 @@ +server { + listen 80; + server_name localhost; + + root /var/www/html; + index index.php; + + access_log /var/log/nginx/wordpress-access.log; + error_log /var/log/nginx/wordpress-error.log; + + location / { + try_files $uri $uri/ /index.php?$args; + } + + location ~ \.php$ { + try_files $uri =404; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_pass wordpress:9000; + fastcgi_index index.php; + include fastcgi_params; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + fastcgi_param PATH_INFO $fastcgi_path_info; + } +} \ No newline at end of file