diff --git a/.travis.yml b/.travis.yml index 1980d59..e73007e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,6 +27,7 @@ before_install: - export IP=$(/sbin/ifconfig eth0 | awk '/inet addr:/{gsub(/.*:/,"",$2);print $2;exit}') - echo $IP - export START_DNSMASQ=false +- export START_TRAEFIK=true - export ZOOKEEPER_HOSTS=${IP}:2181 - "./generate_yml.sh" - cat docker-compose.yml diff --git a/README.md b/README.md index b4aa6e1..f137a35 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![Build Status](https://travis-ci.org/eBayClassifiedsGroup/PanteraS.svg?branch=master)](https://travis-ci.org/eBayClassifiedsGroup/PanteraS) [![Docker Hub](https://img.shields.io/badge/docker-ready-blue.svg)](https://hub.docker.com/r/panteras/paas-in-a-box/) -[![Current Release](https://img.shields.io/badge/release-0.4.1-blue.svg)](https://github.com/eBayClassifiedsGroup/PanteraS/releases/tag/v0.4.1) +[![Current Release](https://img.shields.io/badge/release-0.4.2-blue.svg)](https://github.com/eBayClassifiedsGroup/PanteraS/releases/tag/v0.4.2) # PanteraS
_entire_ Platform as a Service, in a box _"One container to rule them all"_ @@ -57,11 +57,11 @@ Depending on `MASTER` and `SLAVE` you can define role of the container Mesos Slave | x | - | x Registrator | x | - | x Fabio | x | - | x + Traefik | - | - | x Dnsmasq | - | - | - Netdata | - | - | - -Last two require manual override like `START_FABIO=true` -Enabling `Fabio` require stop the other concurent service `START_CONSUL_TEMPLATE=false` +Optional services (disabled by default) require manual override like `START_TRAEFIK=true` ## Requirements: @@ -71,7 +71,7 @@ Enabling `Fabio` require stop the other concurent service `START_CONSUL_TEMPLATE ## Usage: Clone it ``` -git clone -b 0.4.1 https://github.com/eBayClassifiedsGroup/PanteraS.git +git clone -b 0.4.2 https://github.com/eBayClassifiedsGroup/PanteraS.git cd PanteraS ``` #### Default: Stand alone mode diff --git a/docker-compose.yml.tpl b/docker-compose.yml.tpl index 7722ffa..2226bc6 100644 --- a/docker-compose.yml.tpl +++ b/docker-compose.yml.tpl @@ -1,11 +1,14 @@ panteras: image: ${PANTERAS_DOCKER_IMAGE} +# net: bridge net: host privileged: true pid: host restart: "${PANTERAS_RESTART}" - ${PORTS} + ports: + - "9000:9000" ${FABIO_UI_PORTS} + ${TRAEFIK_UI_PORTS} ${CONSUL_UI_PORTS} ${MARATHON_PORTS} ${MESOS_PORTS} @@ -18,8 +21,8 @@ panteras: FQDN: "${FQDN}" GOMAXPROCS: "${GOMAXPROCS}" - SERVICE_81_NAME: fabio-ui - SERVICE_81_TAGS: paas-fabio.ui.service.consul/ + SERVICE_81_NAME: router-ui + SERVICE_81_TAGS: paas-router.ui.service.consul/ SERVICE_81_CHECK_HTTP: /routes SERVICE_8500_NAME: consul-ui @@ -46,6 +49,7 @@ panteras: START_REGISTRATOR: "${START_REGISTRATOR}" START_ZOOKEEPER: "${START_ZOOKEEPER}" START_FABIO: "${START_FABIO}" + START_TRAEFIK: "${START_TRAEFIK}" START_NETDATA: "${START_NETDATA}" CONSUL_APP_PARAMS: "${CONSUL_APP_PARAMS}" @@ -60,6 +64,7 @@ panteras: ZOOKEEPER_HOSTS: "${ZOOKEEPER_HOSTS}" ZOOKEEPER_ID: "${ZOOKEEPER_ID}" FABIO_APP_PARAMS: "${FABIO_APP_PARAMS}" + TRAEFIK_APP_PARAMS: "${TRAEFIK_APP_PARAMS}" NETDATA_APP_PARAMS: "${NETDATA_APP_PARAMS}" HOSTNAME: "${PANTERAS_HOSTNAME}" @@ -69,7 +74,6 @@ panteras: volumes: - "/etc/resolv.conf:/etc/resolv.conf.orig" - - "/var/spool/marathon/artifacts/store:/var/spool/store" - "/var/run/docker.sock:/tmp/docker.sock" - "/var/run/docker.sock:/var/run/docker.sock" - "/var/lib/docker:/var/lib/docker" diff --git a/examples/SimpleWebappPython/deploy0_marathon.json b/examples/SimpleWebappPython/deploy0_marathon.json index 1bc2782..f6593e1 100644 --- a/examples/SimpleWebappPython/deploy0_marathon.json +++ b/examples/SimpleWebappPython/deploy0_marathon.json @@ -16,7 +16,7 @@ } }, "env": { - "SERVICE_TAGS" : "paas-python.service.consul/", + "SERVICE_TAGS" : "paas-python.service.consul/,paas.enable=true,paas.backend.loadbalancer.method=drr,paas.frontends.service.rule=Host:python.service.consul", "SERVICE_NAME" : "python", "SERVICE_8080_CHECK_HTTP" : "/index.html" }, diff --git a/examples/SimpleWebappPython/start_with_marathon.sh b/examples/SimpleWebappPython/start_with_marathon.sh index 7421f8e..320ca99 100755 --- a/examples/SimpleWebappPython/start_with_marathon.sh +++ b/examples/SimpleWebappPython/start_with_marathon.sh @@ -4,7 +4,7 @@ # boot2docker [ -n "${DOCKER_HOST}" ] && IP=${IP:-$(echo $DOCKER_HOST | sed 's;.*//\(.*\):.*;\1;')} # outside vagrant -which vagrant && IP=${IP:-$(vagrant ssh -c ifconfig 2>/dev/null| grep -oh "\w*192.168.10.10\w*")} +#which vagrant && IP=${IP:-$(vagrant ssh -c ifconfig 2>/dev/null| grep -oh "\w*192.168.10.10\w*")} # inside vagrant [ "$HOSTNAME" == "standalone" ] && IP=${IP:-192.168.10.10} # try to guess diff --git a/examples/SmoothWebappPython/deploy0_marathon.json b/examples/SmoothWebappPython/deploy0_marathon.json index 93373a0..d6cbd54 100644 --- a/examples/SmoothWebappPython/deploy0_marathon.json +++ b/examples/SmoothWebappPython/deploy0_marathon.json @@ -17,7 +17,7 @@ "mem": 64.0, "instances": 2, "env": { - "SERVICE_TAGS" : "paas-python-smooth.service.consul/", + "SERVICE_TAGS" : "paas-python-smooth.service.consul/,paas.enable=true,paas.backend.loadbalancer.method=drr,paas.frontends.service.rule=Host:python-smooth.service.consul", "SERVICE_NAME" : "python-smooth", "SERVICE_8000_CHECK_HTTP" : "/cgi-bin/index" }, diff --git a/generate_yml.sh b/generate_yml.sh index 1dcbee7..9fe8680 100755 --- a/generate_yml.sh +++ b/generate_yml.sh @@ -44,6 +44,8 @@ PANTERAS_DOCKER_IMAGE=${PANTERAS_DOCKER_IMAGE:-${REGISTRY}panteras/paas-in-a-box #COMMON START_CONSUL=${START_CONSUL:-"true"} START_FABIO=${START_FABIO:-"true"} +START_TRAEFIK=${START_TRAEFIK:-"false"} +[ "${START_TRAEFIK,,}" == "true" ] && START_FABIO="false" #MASTER START_MESOS_MASTER=${START_MESOS_MASTER:-${MASTER}} @@ -88,18 +90,19 @@ FQDN=${FQDN:-${HOSTNAME}} ZOOKEEPER_JAVA_OPTS=${ZOOKEEPER_JAVA_OPTS:-"-Xmx512m"} # Disable dnsmasq address re-mapping on non slaves -[ "${SLAVE}" == "false" ] && DNSMASQ_ADDRESS=${DNSMASQ_ADDRESS:-' '} +[ "${SLAVE,,}" == "false" ] && DNSMASQ_ADDRESS=${DNSMASQ_ADDRESS:-' '} # dnsmaq cannot be set to listen on 0.0.0.0 - it causes lot of issues # and by default it works on all addresses DNSMASQ_ADDRESS=${DNSMASQ_ADDRESS:-"--address=/consul/${CONSUL_IP}"} [ ${LISTEN_IP} != "0.0.0.0" ] && DNSMASQ_BIND_INTERFACES="--bind-interfaces --listen-address=${LISTEN_IP}" # Expose ports depends on which service has been mark to start -[ "${START_FABIO}" == "true" ] && PORTS="ports:" && FABIO_UI_PORTS='- "81:81"' -[ "${START_CONSUL}" == "true" ] && PORTS="ports:" && CONSUL_UI_PORTS='- "8500:8500"' -[ "${START_MARATHON}" == "true" ] && PORTS="ports:" && MARATHON_PORTS='- "8080:8080"' -[ "${START_MESOS_MASTER}" == "true" ] && PORTS="ports:" && MESOS_PORTS='- "5050:5050"' -[ "${START_NETDATA}" == "true" ] && PORTS="ports:" && NETDATA_PORTS='- "19999:19999"' +[ "${START_FABIO,,}" == "true" ] && FABIO_UI_PORTS='- "81:81"' +[ "${START_TRAEFIK,,}" == "true" ] && TRAEFIK_UI_PORTS='- "81:81"' +[ "${START_CONSUL,,}" == "true" ] && CONSUL_UI_PORTS='- "8500:8500"' +[ "${START_MARATHON,,}" == "true" ] && MARATHON_PORTS='- "8080:8080"' +[ "${START_MESOS_MASTER,,}" == "true" ] && MESOS_PORTS='- "5050:5050"' +[ "${START_NETDATA,,}" == "true" ] && NETDATA_PORTS='- "19999:19999"' # Override docker with local binary [ "${HOST_DOCKER}" == "true" ] && VOLUME_DOCKER=${VOLUME_DOCKER:-'- "/usr/local/bin/docker:/usr/local/bin/docker"'} @@ -164,6 +167,8 @@ ZOOKEEPER_PARAMS="start-foreground" # FABIO_PARAMS="-cfg ./fabio.properties" # +TRAEFIK_PARAMS="-c ./traefik.toml" +# NETDATA_PARAMS="-nd -ch /host" CONSUL_APP_PARAMS=${CONSUL_APP_PARAMS:-$CONSUL_PARAMS} @@ -174,6 +179,7 @@ MESOS_SLAVE_APP_PARAMS=${MESOS_SLAVE_APP_PARAMS:-$MESOS_SLAVE_PARAMS} REGISTRATOR_APP_PARAMS=${REGISTRATOR_APP_PARAMS:-$REGISTRATOR_PARAMS} ZOOKEEPER_APP_PARAMS=${ZOOKEEPER_APP_PARAMS:-$ZOOKEEPER_PARAMS} FABIO_APP_PARAMS=${FABIO_APP_PARAMS:-$FABIO_PARAMS} +TRAEFIK_APP_PARAMS=${TRAEFIK_APP_PARAMS:-$TRAEFIK_PARAMS} NETDATA_APP_PARAMS=${NETDATA_APP_PARAMS:-$NETDATA_PARAMS} PANTERAS_HOSTNAME=${PANTERAS_HOSTNAME:-${HOSTNAME}} diff --git a/infrastructure/Dockerfile b/infrastructure/Dockerfile index afa2604..cd552dd 100644 --- a/infrastructure/Dockerfile +++ b/infrastructure/Dockerfile @@ -32,16 +32,19 @@ ENV TERM xterm ENV HOME /root ENV GOPATH ${HOME}/go -ENV SUPERVISORD_APP_VERSION 4.0.0 -ENV DOCKER_APP_VERSION 5:18.09.3~3-0~ubuntu-xenial -ENV CONSUL_APP_VERSION 1.4.2 -ENV MESOS_APP_VERSION 1.7.2-2.0.1 +ENV SUPERVISORD_APP_VERSION 4.0.4 +ENV DOCKER_APP_VERSION 5:19.03.1~3-0~ubuntu-xenial +ENV CONSUL_APP_VERSION 1.5.3 +ENV MESOS_APP_VERSION 1.8.0-2.0.6.ubuntu1604 #ENV MARATHON_APP_VERSION 1.7.189-0.1.20190125223314.ubuntu1604 ENV MARATHON_APP_VERSION 1.7.189-48bfd6000 ENV REGISTRATOR_APP_VERSION v7 ENV FABIO_APP_VERSION 1.5.11 ENV FABIO_GO_APP_VERSION go1.11.5 -ENV NETDATA_APP_VERSION 1.12.2 +ENV NETDATA_APP_VERSION 1.16.1 +#ENV TRAEFIK_APP_VERSION v2.0.0-beta1 +ENV TRAEFIK_APP_VERSION v1.7.12 + ENV DOCKER_HOST unix:///tmp/docker.sock @@ -135,8 +138,23 @@ RUN wget https://github.com/eBay/fabio/releases/download/v${FABIO_APP_VERSION}/f && chown -R fabio:fabio /opt/fabio \ && setcap 'cap_net_bind_service=+ep' ./fabio -# NETDATA +# TRAEFIK +# +RUN mkdir /opt/traefik \ + && groupadd -g 3002 traefik \ + && useradd -g 3002 -u 3002 -d /opt/traefik -s /bin/false traefik +ENV PATH ${PATH}:/opt/traefik +WORKDIR /opt/traefik +#RUN wget https://github.com/containous/traefik/releases/download/${TRAEFIK_APP_VERSION}/traefik_${TRAEFIK_APP_VERSION}_linux_amd64.tar.gz -O traefik.tar.gz \ +RUN wget https://github.com/containous/traefik/releases/download/${TRAEFIK_APP_VERSION}/traefik_linux-amd64 -O traefik \ +# && tar zxf traefik.tar.gz \ + && chmod a+x traefik \ + && chown -R traefik:traefik /opt/traefik \ + && setcap 'cap_net_bind_service=+ep' ./traefik +ADD traefik.toml /opt/traefik +# NETDATA +# RUN apt-get update \ && apt-get -y install \ zlib1g-dev \ diff --git a/infrastructure/supervisord.conf b/infrastructure/supervisord.conf index 6556597..03b5a80 100644 --- a/infrastructure/supervisord.conf +++ b/infrastructure/supervisord.conf @@ -1,4 +1,5 @@ [supervisord] +root=true nodaemon=true childlogdir=/tmp/supervisord logfile=/tmp/supervisord/supervisord.log @@ -40,6 +41,15 @@ user=root stdout_events_enabled = true stderr_events_enabled = true +[program:zookeeper] +priority=8 +command=/opt/zkStart.sh %(ENV_ZOOKEEPER_APP_PARAMS)s +autorestart=true +autostart=%(ENV_START_ZOOKEEPER)s +user=zookeeper +stdout_events_enabled = true +stderr_events_enabled = true + [program:fabio] priority=16 directory=/opt/fabio @@ -50,15 +60,17 @@ user=fabio stdout_events_enabled = true stderr_events_enabled = true -[program:zookeeper] -priority=8 -command=/opt/zkStart.sh %(ENV_ZOOKEEPER_APP_PARAMS)s +[program:traefik] +priority=16 +directory=/opt/traefik +command=traefik %(ENV_TRAEFIK_APP_PARAMS)s autorestart=true -autostart=%(ENV_START_ZOOKEEPER)s -user=zookeeper +autostart=%(ENV_START_TRAEFIK)s +user=traefik stdout_events_enabled = true stderr_events_enabled = true + [program:mesos-master] priority=32 command=mesos-master %(ENV_MESOS_MASTER_APP_PARAMS)s diff --git a/infrastructure/traefik.toml b/infrastructure/traefik.toml new file mode 100644 index 0000000..f97655a --- /dev/null +++ b/infrastructure/traefik.toml @@ -0,0 +1,25 @@ +# +debug = true +logLevel = "INFO" + +[entryPoints] + [entryPoints.http] + address = ":80" + [entryPoints.api] + address = ":81" + +[consulCatalog] + endpoint = "127.0.0.1:8500" + exposedByDefault = false + stale = false + prefix = "paas" + frontEndRule = "Host:{{.ServiceName}}.service" + +[api] + entryPoint = "api" + dashboard = true + +[metrics] + [metrics.prometheus] + entryPoint = "api" + buckets = [0.1,0.3,1.2,5.0] diff --git a/infrastructure/version b/infrastructure/version index 267577d..2b7c5ae 100644 --- a/infrastructure/version +++ b/infrastructure/version @@ -1 +1 @@ -0.4.1 +0.4.2