From 65fa0410620d8f4df942ad77429976272e437b48 Mon Sep 17 00:00:00 2001 From: WilliamMiceli Date: Sat, 17 Nov 2018 00:00:30 -0500 Subject: [PATCH 1/6] Initial testing version --- templates/WordPress/0/README.md | 1 + templates/WordPress/0/docker-compose.yml | 61 +++++++++++++++++++++ templates/WordPress/0/rancher-compose.yml | 64 +++++++++++++++++++++++ templates/WordPress/config.yml | 8 +++ 4 files changed, 134 insertions(+) create mode 100644 templates/WordPress/0/README.md create mode 100644 templates/WordPress/0/docker-compose.yml create mode 100644 templates/WordPress/0/rancher-compose.yml create mode 100644 templates/WordPress/config.yml diff --git a/templates/WordPress/0/README.md b/templates/WordPress/0/README.md new file mode 100644 index 0000000..c2a2e73 --- /dev/null +++ b/templates/WordPress/0/README.md @@ -0,0 +1 @@ +# WordPress \ No newline at end of file diff --git a/templates/WordPress/0/docker-compose.yml b/templates/WordPress/0/docker-compose.yml new file mode 100644 index 0000000..d280c94 --- /dev/null +++ b/templates/WordPress/0/docker-compose.yml @@ -0,0 +1,61 @@ +version: '2' + +services: + nextcloud: + image: wordpress:latest + dns: + - 1.1.1.1 + - 1.0.0.1 + environment: + WORDPRESS_DB_HOST: mysql + WORDPRESS_DB_USER: wordpress_user + WORDPRESS_DB_PASSWORD: ${DB_USER_PASS} + WORDPRESS_DB_NAME: wordpress + labels: + io.rancher.container.pull_image: always + {{- if .Values.HOST_LABEL}} + io.rancher.scheduler.affinity:host_label: ${HOST_LABEL} + {{- end}} + {{- if .Values.TRAEFIK_HOST}} + traefik.enable: true + traefik.frontend.rule: Host:${TRAEFIK_HOST} + traefik.frontend.entryPoints: http #,https + # traefik.frontend.headers.forceSTSHeader: true + # traefik.frontend.headers.SSLRedirect: true + # traefik.frontend.headers.STSPreload: true + # traefik.frontend.headers.STSSeconds: 15552000 + traefik.port: "80" + {{- else}} + traefik.enable: false + {{- end}} + links: + - mysql + networks: + - public-proxy + ports: + - "${WEB_PORT}:80" + restart: on-failure + volumes: + - /RancherCattleData/${DATA_DIR}/Application:/var/www/html + mysql: + image: mysql:5 + dns: + - 1.1.1.1 + - 1.0.0.1 + environment: + MYSQL_DATABASE: wordpress + MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASS} + MYSQL_USER: wordpress_user + MYSQL_PASSWORD: ${DB_USER_PASS} + labels: + io.rancher.container.pull_image: always + {{- if .Values.HOST_LABEL}} + io.rancher.scheduler.affinity:host_label: ${HOST_LABEL} + {{- end}} + restart: on-failure + volumes: + - /RancherCattleData/${DATA_DIR}/Database:/var/lib/mysql + +networks: + public-proxy: + external: true \ No newline at end of file diff --git a/templates/WordPress/0/rancher-compose.yml b/templates/WordPress/0/rancher-compose.yml new file mode 100644 index 0000000..4bd2961 --- /dev/null +++ b/templates/WordPress/0/rancher-compose.yml @@ -0,0 +1,64 @@ +version: '2' +catalog: + name: WordPress + version: latest + # description: + # minimum_rancher_version: + # maximum_rancher_version: + # upgrade_from: + questions: + + - variable: "HOST_LABEL" + label: "Host Label Key/Value Pair" + description: | + The Label Key/Value pair on the host which containers should be deployed + default: "host.id=Host1" + required: false + type: string + + - variable: "TRAEFIK_HOST" + label: "Public Host Domain" + description: | + The host that Traefik will use to provide public access. + Leaving this empty will disable Traefik on this stack. + default: "subdomain.domain.tld" + required: false + type: string + + - variable: "WEB_PORT" + label: "Web Port" + description: | + The port to locally access the web interface on. + default: "10600" + required: true + type: string + + - variable: "DB_ROOT_PASS" + label: "MySQL Root Password" + description: | + A secure password to be used by the "root" MySQL user. + # default: + required: true + type: password + + - variable: "DB_USER_PASS" + label: "MySQL User Password" + description: | + A secure password to be used by the "wordpress_user" MySQL user. + # default: + required: true + type: password + + - variable: "DATA_DIR" + label: "Data Directory" + description: | + The directory to store persistent data for the stack. + default: "Personal/Wordpress" + required: true + type: string + +services: + wordpress: + scale: 1 + mysql: + scale: 1 \ No newline at end of file diff --git a/templates/WordPress/config.yml b/templates/WordPress/config.yml new file mode 100644 index 0000000..20330bb --- /dev/null +++ b/templates/WordPress/config.yml @@ -0,0 +1,8 @@ +name: WordPress +description: | + Status: EXPERIMENTAL +version: latest +# category: +maintainer: WilliamMiceli +# license: +# projectURL: \ No newline at end of file From 08890568807ce01c548a27ececd11b6aebb756a4 Mon Sep 17 00:00:00 2001 From: WilliamMiceli Date: Sat, 17 Nov 2018 00:21:16 -0500 Subject: [PATCH 2/6] Changed service name --- templates/WordPress/0/docker-compose.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/WordPress/0/docker-compose.yml b/templates/WordPress/0/docker-compose.yml index d280c94..1b5a257 100644 --- a/templates/WordPress/0/docker-compose.yml +++ b/templates/WordPress/0/docker-compose.yml @@ -1,7 +1,7 @@ version: '2' services: - nextcloud: + wordpress: image: wordpress:latest dns: - 1.1.1.1 From be0bdbb013147cc1ccf3122f7dc1cfef2b7aff6b Mon Sep 17 00:00:00 2001 From: WilliamMiceli Date: Sat, 17 Nov 2018 00:47:27 -0500 Subject: [PATCH 3/6] Added HTTPS --- templates/WordPress/0/docker-compose.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/WordPress/0/docker-compose.yml b/templates/WordPress/0/docker-compose.yml index 1b5a257..ef937d3 100644 --- a/templates/WordPress/0/docker-compose.yml +++ b/templates/WordPress/0/docker-compose.yml @@ -19,9 +19,9 @@ services: {{- if .Values.TRAEFIK_HOST}} traefik.enable: true traefik.frontend.rule: Host:${TRAEFIK_HOST} - traefik.frontend.entryPoints: http #,https + traefik.frontend.entryPoints: http,https # traefik.frontend.headers.forceSTSHeader: true - # traefik.frontend.headers.SSLRedirect: true + traefik.frontend.headers.SSLRedirect: true # traefik.frontend.headers.STSPreload: true # traefik.frontend.headers.STSSeconds: 15552000 traefik.port: "80" From d7f0512b093651d334536e808a06e4bde567d5b4 Mon Sep 17 00:00:00 2001 From: WilliamMiceli Date: Sat, 17 Nov 2018 01:07:29 -0500 Subject: [PATCH 4/6] Added STS headers --- templates/WordPress/0/docker-compose.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/WordPress/0/docker-compose.yml b/templates/WordPress/0/docker-compose.yml index ef937d3..7c077d6 100644 --- a/templates/WordPress/0/docker-compose.yml +++ b/templates/WordPress/0/docker-compose.yml @@ -20,10 +20,10 @@ services: traefik.enable: true traefik.frontend.rule: Host:${TRAEFIK_HOST} traefik.frontend.entryPoints: http,https - # traefik.frontend.headers.forceSTSHeader: true + traefik.frontend.headers.forceSTSHeader: true traefik.frontend.headers.SSLRedirect: true - # traefik.frontend.headers.STSPreload: true - # traefik.frontend.headers.STSSeconds: 15552000 + traefik.frontend.headers.STSPreload: true + traefik.frontend.headers.STSSeconds: 15552000 traefik.port: "80" {{- else}} traefik.enable: false From c8de0ea099fb0ae490b09ba78ad5b389ad6b76fd Mon Sep 17 00:00:00 2001 From: WilliamMiceli Date: Wed, 5 Dec 2018 22:37:19 -0500 Subject: [PATCH 5/6] Sync time and timezone with host --- templates/WordPress/0/docker-compose.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/WordPress/0/docker-compose.yml b/templates/WordPress/0/docker-compose.yml index 7c077d6..223b839 100644 --- a/templates/WordPress/0/docker-compose.yml +++ b/templates/WordPress/0/docker-compose.yml @@ -54,6 +54,8 @@ services: {{- end}} restart: on-failure volumes: + - /etc/localtime:/etc/localtime:ro # Syncronize time of container with the host system + - /etc/timezone:/etc/timezone:ro # Syncronize timezone of container with the host system - /RancherCattleData/${DATA_DIR}/Database:/var/lib/mysql networks: From 5ac76de4338d6e6f51d415d3f4c6b24e400c217d Mon Sep 17 00:00:00 2001 From: WilliamMiceli Date: Tue, 18 Dec 2018 23:23:57 -0500 Subject: [PATCH 6/6] Bringing it up to standards, ready for master --- templates/WordPress/0/docker-compose.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/templates/WordPress/0/docker-compose.yml b/templates/WordPress/0/docker-compose.yml index 223b839..9a44587 100644 --- a/templates/WordPress/0/docker-compose.yml +++ b/templates/WordPress/0/docker-compose.yml @@ -10,7 +10,7 @@ services: WORDPRESS_DB_HOST: mysql WORDPRESS_DB_USER: wordpress_user WORDPRESS_DB_PASSWORD: ${DB_USER_PASS} - WORDPRESS_DB_NAME: wordpress + WORDPRESS_DB_NAME: wordpress # Will eventually rename this to "wordpress_db" labels: io.rancher.container.pull_image: always {{- if .Values.HOST_LABEL}} @@ -32,18 +32,22 @@ services: - mysql networks: - public-proxy + {{- if .Values.WEB_PORT}} ports: - "${WEB_PORT}:80" + {{- end}} restart: on-failure volumes: - - /RancherCattleData/${DATA_DIR}/Application:/var/www/html + - /etc/localtime:/etc/localtime:ro # Syncronize time of container with the host system + - /etc/timezone:/etc/timezone:ro # Syncronize timezone of container with the host system + - /RancherCattle/${DATA_DIR}/Application:/var/www/html mysql: image: mysql:5 dns: - 1.1.1.1 - 1.0.0.1 environment: - MYSQL_DATABASE: wordpress + MYSQL_DATABASE: wordpress # Will eventually rename this to "wordpress_db" MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASS} MYSQL_USER: wordpress_user MYSQL_PASSWORD: ${DB_USER_PASS} @@ -52,12 +56,18 @@ services: {{- if .Values.HOST_LABEL}} io.rancher.scheduler.affinity:host_label: ${HOST_LABEL} {{- end}} + networks: + db-admin: + aliases: + - wordpress restart: on-failure volumes: - /etc/localtime:/etc/localtime:ro # Syncronize time of container with the host system - /etc/timezone:/etc/timezone:ro # Syncronize timezone of container with the host system - - /RancherCattleData/${DATA_DIR}/Database:/var/lib/mysql + - /RancherCattle/${DATA_DIR}/Database:/var/lib/mysql networks: + db-admin: + external: true public-proxy: external: true \ No newline at end of file