Go templating to choose db type, healthcheck

This commit is contained in:
Josh Cox 2017-07-15 20:25:46 -05:00
parent f055006b3b
commit 55031fe6c3
4 changed files with 105 additions and 45 deletions

View File

@ -1,38 +0,0 @@
version: '2'
services:
drupal:
image: drupal:8.2-apache
labels:
io.rancher.sidekicks: postgres,drupal-datavolume
io.rancher.container.pull_image: always
ports:
- ${public_port}:80
links:
- postgres:postgres
volumes_from:
- drupal-datavolume
restart: always
postgres:
labels:
io.rancher.sidekicks: drupal-datavolume
io.rancher.container.pull_image: always
image: postgres:9.6
environment:
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASS}
POSTGRES_DB: ${DB_NAME}
volumes_from:
- drupal-datavolume
restart: always
drupal-datavolume:
image: "busybox"
volumes:
- /var/www/drupal
- /var/lib/postgresql
labels:
io.rancher.container.start_once: true
entrypoint: ["/bin/true"]

View File

@ -0,0 +1,59 @@
version: '2'
services:
drupal:
image: drupal:8.3.5-apache
labels:
io.rancher.container.hostname_override: container_name
links:
- db:db
volumes:
- drupal-modules:/var/www/html/modules
- drupal-profiles:/var/www/html/profiles
- drupal-themes:/var/www/html/themes
- drupal-sites:/var/www/html/sites
restart: always
drupal-lb:
image: rancher/lb-service-haproxy:v0.6.4
ports:
- ${PUBLIC_PORT}:${PUBLIC_PORT}
db:
labels:
io.rancher.container.hostname_override: container_name
{{- if eq .Values.DB_TYPE "postgres"}}
image: postgres:9.6.3-alpine
environment:
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASS}
POSTGRES_DB: ${DB_NAME}
{{- end}}
{{- if eq .Values.DB_TYPE "mysql"}}
image: mysql:5.7.18
environment:
MYSQL_DATABASE: ${DB_NAME}
MYSQL_ROOT_PASSWORD: ${DB_PASS}
MYSQL_USER: ${DB_USER}
MYSQL_PASSWORD: ${DB_PASS}
{{- end}}
volumes:
{{- if eq .Values.DB_TYPE "postgres"}}
- db-data:/var/lib/postgresql
{{- end}}
{{- if eq .Values.DB_TYPE "mysql"}}
- db-data:/var/lib/mysql
{{- end}}
restart: always
volumes:
drupal-modules:
driver: local
drupal-profiles:
driver: local
drupal-themes:
driver: local
drupal-sites:
driver: local
db-data:
driver: local

View File

@ -1,17 +1,28 @@
.catalog:
version: '2'
catalog:
name: "Drupal"
version: "v0.1-postgres"
version: "8.3.5-rancher1"
description: "Blog tool, publishing platform and CMS"
uuid: Drupal-0
minimum_rancher_version: v0.51.0
questions:
- variable: public_port
- variable: "PUBLIC_PORT"
description: "public port to access the drupal site"
label: "Public Port"
required: true
default: "15080"
type: "int"
- variable: "DB_TYPE"
description: "public port to access the drupal site"
label: "DB type"
required: true
default: "postgres"
type: "enum"
options:
- "mysql"
- "postgres"
- variable: "DB_NAME"
description: "Database Name to use for the server"
label: "DB Name"
@ -32,6 +43,34 @@
required: true
default: ""
type: "password"
drupal:
retain_ip: true
services:
drupal:
retain_ip: true
scale: 1
health_check:
healthy_threshold: 2
response_timeout: 5000
port: 80
unhealthy_threshold: 3
interval: 5000
strategy: recreate
request_line: GET / # HTTP/1.0
drupal-lb:
scale: 1
start_on_create: true
lb_config:
certs: []
port_rules:
- priority: 1
protocol: http
service: drupal
source_port: ${PUBLIC_PORT}
target_port: 80
health_check:
response_timeout: 2000
healthy_threshold: 2
port: 42
unhealthy_threshold: 3
initializing_timeout: 60000
interval: 2000
reinitializing_timeout: 60000

View File

@ -1,5 +1,5 @@
name: Drupal
description: |
Drupal is an open source CMS powering millions of websites and applications.
version: v0.1
version: "8.3.5-rancher1"
category: CMS