diff --git a/templates/docker-compose.template.yml b/templates/docker-compose.template.yml new file mode 100644 index 00000000..ee6604e8 --- /dev/null +++ b/templates/docker-compose.template.yml @@ -0,0 +1,142 @@ +#docker-compose.template.yml +version: '3.7' +services: + template-postgis: + environment: + - SECRET=admin + - DOCKER_ENV=DEVELOPMENT + - POSTGRES_PASSWORD=postgres + - POSTGRES_DB=template + - POSTGRES_USER=postgres + - POSTGIS_HOST=postgresql + - CONTAINER=template-postgis + - DOCKER_USER=template + container_name: template-postgis + image: docker.merkator.com/template/postgis:latest + volumes: + - type: volume + source: template-postgis + target: /var/lib/postgresql/data + - type: bind + source: d:\github\docker4gis\binds\secrets + target: /secrets + - type: bind + source: d:\github\docker4gis\binds\fileport + target: /fileport + - type: bind + source: d:\github\docker4gis\binds\certificates + target: /certificates + - type: bind + source: d:\github\docker4gis\binds\runner + target: /util/runner/log + ports: + - "5432:5432" + networks: + - default + - template-net + template-geoserver: + environment: + - GEOSERVER_HOST=geoserver.merkator.com + - GEOSERVER_USER=admin + - GEOSERVER_PASSWORD=geoserver + - DOCKER_USER=template + container_name: template-geoserver + image: docker.merkator.com/template/geoserver:latest + volumes: + - type: volume + source: template-geoserver + target: /geoserver/data/workspaces + - type: bind + source: d:\github\docker4gis\binds\secrets + target: /secrets + - type: bind + source: d:\github\docker4gis\binds\fileport + target: /fileport + - type: bind + source: d:\github\docker4gis\binds\certificates + target: /certificates + - type: bind + source: d:\github\docker4gis\binds\gwc + target: /geoserver/cache + - type: bind + source: d:\github\docker4gis\binds\runner + target: /util/runner/log + ports: + - "58080:8080" + networks: + - default + - template-net + depends_on: + - template-postgis + template-api: + environment: + - DOCKER_ENV=DEVELOPMENT + # - POSTGIS_HOST=template-postgis + # - POSTGIS_PORT=5432 + - DOCKER_USER=template + container_name: template-api + image: docker.merkator.com/template/api:latest + volumes: + - type: volume + source: template-api + target: /host + - type: bind + source: d:\github\docker4gis\binds\runner + target: /util/runner/log + - type: bind + source: d:\github\docker4gis\binds\secrets + target: /secrets + - type: bind + source: d:\github\docker4gis\binds\fileport + target: /fileport + ports: + - "9090:8080" + networks: + - default + - template-net + template-app: + container_name: template-app + image: docker.merkator.com/template/app:latest + networks: + - template-net + template-proxy: + environment: + - PROXY_HOST=localhost.merkator.com + - PROXY_PORT=7443 + - API=http://template-api:8080/ + - APP=http://template-app/ + - GEOSERVER=http://template-geoserver:8080/geoserver/ + - HOMEDEST=/template/app + - DOCKER_USER=template + container_name: template-proxy + image: docker.merkator.com/template/proxy:latest + volumes: + - type: bind + source: d:\github\docker4gis\binds\certificates + target: /certificates + - type: volume + source: template-proxy + target: /config + networks: + - default + - template-net + depends_on: + - template-postgis + - template-geoserver + - template-api + - template-app + ports: + - "7443:443" + - "82:80" + extra_hosts: + - "localhost.merkator.com:127.0.0.1" + +volumes: + template-postgis: {} + template-geoserver: {} + template-api: {} + template-proxy: {} + +networks: + template-net: + internal: true \ No newline at end of file diff --git a/templates/proxy/Dockerfile b/templates/proxy/Dockerfile index eaa16177..d501ca2b 100644 --- a/templates/proxy/Dockerfile +++ b/templates/proxy/Dockerfile @@ -9,3 +9,6 @@ ENV HOMEDEST="/${DOCKER_USER}/app/" # Where to ask for authorisation ENV AUTH_PATH="http://${DOCKER_USER}-api:8080/rpc/auth_path" + +# IF you don't want all the containers availible throught the proxy make your own config to limit to only the ones you want and add that config +# COPY conf/conf.sh /conf.sh \ No newline at end of file diff --git a/templates/proxy/conf/conf.sh b/templates/proxy/conf/conf.sh new file mode 100644 index 00000000..df6273b4 --- /dev/null +++ b/templates/proxy/conf/conf.sh @@ -0,0 +1,55 @@ +#!/bin/sh + +DOCKER_USER="${DOCKER_USER}" +SECRET="${SECRET}" +HOMEDEST="${HOMEDEST}" +API="${API}" +APP="${APP}" + +## all +# RESOURCES="http://${DOCKER_USER}-resources" +# GEOSERVER="http://${DOCKER_USER}-geoserver:8080/geoserver/" +# MAPFISH="http://${DOCKER_USER}-mapfish:8080" +# MAPSERVER="http://${DOCKER_USER}-mapserver" +# MAPPROXY="http://${DOCKER_USER}-mapproxy" +# SWAGGER="http://${DOCKER_USER}-swagger:8080" + +echo DOCKER_USER="${DOCKER_USER}" + +##all +# echo "secret=${SECRET} +# homedest=${HOMEDEST} +# api=${API} +# app=${APP} +# static=${APP}static/ +# favicon.ico=${APP}favicon.ico +# manifest.json=${APP}manifest.json +# service-worker.js=${APP}service-worker.js +# index.html=${APP}index.html +# index=${APP}index +# html=${APP}html/ +# geoserver=${GEOSERVER} +# mapfish=${MAPFISH} +# resources=${RESOURCES} +# mapserver=${MAPSERVER} +# mapproxy=${MAPPROXY} +# swagger=${SWAGGER} +# swagger-ui.css.map=${SWAGGER}/swagger-ui.css.map +# swagger-ui-bundle.js.map=${SWAGGER}/swagger-ui-bundle.js.map +# swagger-ui-standalone-preset.js.map=${SWAGGER}/swagger-ui-standalone-preset.js.map +# " > "/config/${DOCKER_USER}" + +## Limited +## make sure this file is added in the Docker file, otherwise the default conf.sh from base will be run +echo "api=${API} +app=${APP} +favicon.ico=${APP}favicon.ico +index.html=${APP}index.html +index=${APP}index +html=${APP}html/ +" > "/config/${DOCKER_USER}" + +for proxy in ${@} +do + echo "${proxy}" >> "/config/${DOCKER_USER}" +done