use healthcheck for postgres container, some minor structure changes
parent
7c07652237
commit
8db4a361b6
|
|
@ -1,6 +1,6 @@
|
|||
IMAGE_INIT=${BUILD_ORGANIZATION}/${BUILD_PREFIX}-init:${BUILD_TAG}
|
||||
IMAGE_CHE=${BUILD_ORGANIZATION}/${BUILD_PREFIX}-server:${BUILD_TAG}
|
||||
IMAGE_COMPOSE=docker/compose:1.8.1
|
||||
IMAGE_COMPOSE=docker/compose:1.10.1
|
||||
IMAGE_TRAEFIK=traefik:v1.3.0-rc3
|
||||
IMAGE_POSTGRES=postgres:9.6
|
||||
IMAGE_KEYCLOACK=jboss/keycloak-postgres:3.1.0.Final
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ node default {
|
|||
###############################
|
||||
# Small group
|
||||
#
|
||||
$che_small_group = getValue("CHE_SMALL_GROUP","false")
|
||||
$che_for_small_groups = getValue("CHE_FOR_SMALL_GROUPS","true")
|
||||
|
||||
|
||||
################################
|
||||
|
|
|
|||
|
|
@ -14,4 +14,5 @@ class base {
|
|||
include che
|
||||
include compose
|
||||
include traefik
|
||||
include postgres
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
class che {
|
||||
|
||||
file { "/opt/che/config/che":
|
||||
ensure => "directory",
|
||||
mode => "755",
|
||||
} ->
|
||||
# creating che.env
|
||||
file { "/opt/che/config/che.env":
|
||||
file { "/opt/che/config/che/che.env":
|
||||
ensure => "present",
|
||||
content => template("che/che.env.erb"),
|
||||
mode => "644",
|
||||
|
|
@ -16,13 +19,13 @@ class che {
|
|||
}
|
||||
|
||||
# JMX
|
||||
file { "/opt/che/config/jmxremote.access":
|
||||
file { "/opt/che/config/che/jmxremote.access":
|
||||
ensure => "present",
|
||||
content => "$che_jmx_username readwrite",
|
||||
mode => "644",
|
||||
}
|
||||
|
||||
file { "/opt/che/config/jmxremote.password":
|
||||
file { "/opt/che/config/che/jmxremote.password":
|
||||
ensure => "present",
|
||||
content => "$che_jmx_username $che_jmx_password",
|
||||
mode => "644",
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@
|
|||
# PLEASE DON'T MODIFY BY HAND
|
||||
# ###################################
|
||||
|
||||
<% if scope.lookupvar('che::che_small_group') == 'true' -%>
|
||||
version: '2'
|
||||
<% if scope.lookupvar('che::che_for_small_groups') == 'true' -%>
|
||||
version: '2.1'
|
||||
services:
|
||||
<% end -%>
|
||||
|
||||
|
|
@ -15,7 +15,7 @@ services:
|
|||
image: <%= ENV["IMAGE_CHE"] %>
|
||||
env_file:
|
||||
<% if @compose_file_for_containers == true -%>
|
||||
- '<%= ENV["CHE_CONTAINER_ROOT"] %>/instance/config/che.env'
|
||||
- '<%= ENV["CHE_CONTAINER_ROOT"] %>/instance/config/che/che.env'
|
||||
<% else -%>
|
||||
- '<%= ENV["CHE_ENV_FILE"] %>'
|
||||
<% end -%>
|
||||
|
|
@ -23,7 +23,7 @@ services:
|
|||
- '/var/run/docker.sock:/var/run/docker.sock'
|
||||
- '<%= scope.lookupvar('che::che_instance') -%>/data:/data'
|
||||
- '<%= scope.lookupvar('che::che_instance') -%>/logs:/logs'
|
||||
- '<%= scope.lookupvar('che::che_instance') -%>/config:/conf'
|
||||
- '<%= scope.lookupvar('che::che_instance') -%>/config/che:/conf'
|
||||
<% if scope.lookupvar('che::che_dev_env') == 'on' -%>
|
||||
- '<%= scope.lookupvar('che::che_assembly') -%>:/assembly'
|
||||
<% end -%>
|
||||
|
|
@ -78,10 +78,10 @@ services:
|
|||
<% end -%>
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- '<%= scope.lookupvar('che::che_instance') -%>/config/traefik.toml:/etc/traefik/traefik.toml'
|
||||
- '<%= scope.lookupvar('che::che_instance') -%>/config/traefik/traefik.toml:/etc/traefik/traefik.toml'
|
||||
<% end -%>
|
||||
|
||||
<% if scope.lookupvar('che::che_small_group') == 'true' -%>
|
||||
<% if scope.lookupvar('che::che_for_small_groups') == 'true' -%>
|
||||
########################
|
||||
# POSTGRES
|
||||
########################
|
||||
|
|
@ -90,17 +90,27 @@ services:
|
|||
environment:
|
||||
- POSTGRES_USER=keycloak
|
||||
- POSTGRES_PASSWORD=keycloak
|
||||
- POSTGRES_DB=keycloak
|
||||
volumes:
|
||||
- '<%= scope.lookupvar('che::che_instance') -%>/config/postgres/docker-healthcheck.sh:/docker-healthcheck.sh'
|
||||
- '<%= scope.lookupvar('che::che_instance') -%>/data/postgres:/var/lib/postgresql/data'
|
||||
ports:
|
||||
- '5432:5432'
|
||||
restart: always
|
||||
healthcheck:
|
||||
test: ["CMD", "/docker-healthcheck.sh"]
|
||||
interval: 10s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
|
||||
########################
|
||||
# KEYCLOAK
|
||||
########################
|
||||
keycloak:
|
||||
image: <%= ENV["IMAGE_KEYCLOACK"] %>
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
ports:
|
||||
- '5050:8080'
|
||||
environment:
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
class postgres {
|
||||
file { "/opt/che/config/postgres":
|
||||
ensure => "directory",
|
||||
mode => "755",
|
||||
} ->
|
||||
file { "/opt/che/config/postgres/docker-healthcheck.sh":
|
||||
content => template('postgres/docker-healthcheck.sh.erb'),
|
||||
ensure => file,
|
||||
mode => "755",
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
#!/bin/sh
|
||||
# Copyright (c) 2016 Codenvy, S.A.
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
# are made available under the terms of the Eclipse Public License v1.0
|
||||
# which accompanies this distribution, and is available at
|
||||
# http://www.eclipse.org/legal/epl-v10.html
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
export PGUSER=${POSTGRES_USER}
|
||||
|
||||
psql -h localhost -d template1 -c '\l'
|
||||
ret_code=$?
|
||||
|
||||
# Docker healthcheck requires we only over exit 0 or 1 so this captures the
|
||||
# other exit codes and coverts them all to a simple exit 1
|
||||
if [ $ret_code != 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
|
@ -1,10 +1,12 @@
|
|||
class traefik {
|
||||
|
||||
file { "/opt/che/config/traefik":
|
||||
ensure => "directory",
|
||||
mode => "755",
|
||||
} ->
|
||||
# creating traefik.toml
|
||||
file { "/opt/che/config/traefik.toml":
|
||||
file { "/opt/che/config/traefik/traefik.toml":
|
||||
ensure => "present",
|
||||
content => template("traefik/traefik.toml.erb"),
|
||||
mode => "644",
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue