cs131039
5 years ago
2 changed files with 233 additions and 0 deletions
@ -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 |
@ -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; |
|||
} |
|||
} |
Loading…
Reference in new issue