Skip to content

Commit

Permalink
Merge pull request #290 from eBayClassifiedsGroup/0.4.0
Browse files Browse the repository at this point in the history
0.4.0
  • Loading branch information
sielaq authored Jun 21, 2018
2 parents d4cabfe + 5f39808 commit efd093e
Show file tree
Hide file tree
Showing 31 changed files with 196 additions and 609 deletions.
88 changes: 43 additions & 45 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,50 @@
language: bash

sudo: required
services: docker

services: docker
env:
global:
- DOCKER_APP_VERSION=17.05.0~ce-0~ubuntu-trusty

- DOCKER_APP_VERSION=17.05.0~ce-0~ubuntu-trusty
notifications:
slack: ebayclassifiedsgroup:tFHOcsnmbj9SKmfquoJJKjSb

slack:
rooms:
secure: DThvgzkCwCBt5JlDGU6Po6sWM5nAJubUkcn2H90qRsCARL1kLgbv8KHLkMhv0SnGJfULGr5qVGcGNUzMghBkGwEbyHp6goLp8mPpohp/OGB8pV4CUKWjh20nR/2Dedq+y2clEY3fNNFIBua5Or6XTa7CoedZocR6RwTtbttA+IZCcM3pvLlZwEBsz9xbXverS7qaXH/dQ7rInOJEYxEXmlxSU2Yej2rlMIHEJVeyNoN30lw8oJjd6OLlXXAndr4t6AuZ1FABkmuEycfxDHuZL+fOmqSaGU2R77guPyOdJrQzcGfYSP1RA9ZpEsfFmftAJbcA1bqdbyHouVhMdfR/CFwqRUekymkgAAYqLrt/a0U57SGbR0dZ4upNzjEyO22dc1L1ughJTzPPgWXUeI1ENYi5xkEdFZHiBy8kSKgePusEcfdU16bQ9ZXCurbswBJfDoT2UG7mY9k3lyQQSSu1n+KzzZlbZcP027n1x5go5wRNadRCWoJJKUFghBJFB+qypCTXBCGtxV83OUuLY8cJpSNvzOI85SSEyvhrF70rrrjkuQS516XT2uyjAEypoOYf4CTxzSqPzIK3r7l0WgOkA49ggmnZ5rihu+2nQC03d43zfQNtVVbxTmyUvn2moGJd0SccL1OJ60uyDQeN719T9T3TcjPE+YMFQawpnKfXjzs=
before_install:
- echo 'deb https://apt.dockerproject.org/repo ubuntu-trusty main' > /tmp/docker.list
- sudo cp /tmp/docker.list /etc/apt/sources.list.d/docker.list
- sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv F76221572C52609D
- sudo apt-get update
- apt-cache policy docker-engine || true
- sudo apt-get install -y --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" docker-engine=${DOCKER_APP_VERSION}
- sudo iptables -L DOCKER || sudo iptables -N DOCKER
- sudo apt-get install -y curl python-pip ruby-dev build-essential python-dev
- sudo pip install pip --upgrade
- sudo pip install docker-compose --upgrade
- gem install marathon_deploy
- docker pull ubuntu:16.04
- docker ps
- ./build-docker-image.sh
- export IP=$(/sbin/ifconfig eth0 | awk '/inet addr:/{gsub(/.*:/,"",$2);print $2;exit}')
- echo $IP
- export START_DNSMASQ=false
- export ZOOKEEPER_HOSTS=${IP}:2181
- ./generate_yml.sh
- cat docker-compose.yml
- sudo netstat -tulpen
- docker --version
- docker images
- docker-compose up -d

- echo 'deb https://apt.dockerproject.org/repo ubuntu-trusty main' > /tmp/docker.list
- sudo cp /tmp/docker.list /etc/apt/sources.list.d/docker.list
- sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv F76221572C52609D
- sudo apt-get update
- apt-cache policy docker-engine || true
- sudo apt-get install -y --force-yes -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold"
docker-engine=${DOCKER_APP_VERSION}
- sudo iptables -L DOCKER || sudo iptables -N DOCKER
- sudo apt-get install -y curl python-pip ruby-dev build-essential python-dev
- sudo pip install pip
- sudo pip install docker-compose
- gem install marathon_deploy
- docker pull ubuntu:16.04
- docker ps
- "./build-docker-image.sh"
- export IP=$(/sbin/ifconfig eth0 | awk '/inet addr:/{gsub(/.*:/,"",$2);print $2;exit}')
- echo $IP
- export START_DNSMASQ=false
- export ZOOKEEPER_HOSTS=${IP}:2181
- "./generate_yml.sh"
- cat docker-compose.yml
- sudo netstat -tulpen
- docker --version
- docker images
- docker-compose up -d
script:
- docker ps
- sleep 30
- curl -s http://${IP}:8080/v2/leader
- curl -s http://${IP}:8080/v2/info
- curl -I -s http://${IP}:5050/master/health
- curl -s http://${IP}:5050/system/stats.json
- docker exec -ti panteras_panteras_1 supervisorctl status
- cd examples/SimpleWebappPython
- ./test_service.sh
- cd -
- cd examples/SmoothWebappPython
- ./test_service.sh
- docker exec -ti panteras_panteras_1 supervisorctl status
- docker ps
- sleep 30
- curl -s http://${IP}:8080/v2/leader
- curl -s http://${IP}:8080/v2/info
- curl -I -s http://${IP}:5050/master/health
- curl -s http://${IP}:5050/system/stats.json
- docker exec -ti panteras_panteras_1 supervisorctl status
- cd examples/SimpleWebappPython
- "./test_service.sh"
- cd -
- cd examples/SmoothWebappPython
- "./test_service.sh"
- docker exec -ti panteras_panteras_1 supervisorctl status
23 changes: 10 additions & 13 deletions docker-compose.yml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ panteras:
pid: host
restart: "${PANTERAS_RESTART}"
${PORTS}
${FABIO_UI_PORTS}
${CONSUL_UI_PORTS}
${MARATHON_PORTS}
${MESOS_PORTS}
Expand All @@ -18,28 +19,31 @@ panteras:
FQDN: "${FQDN}"
GOMAXPROCS: "${GOMAXPROCS}"

SERVICE_81_NAME: fabio-ui
SERVICE_81_TAGS: paas-fabio.ui.service.consul/
SERVICE_81_CHECK_HTTP: /v1/status/leader

SERVICE_8500_NAME: consul-ui
SERVICE_8500_TAGS: haproxy,urlprefix-consul-ui.service.consul/
SERVICE_8500_TAGS: paas-consul.ui.service.consul/
SERVICE_8500_CHECK_HTTP: /v1/status/leader

SERVICE_8080_NAME: marathon
SERVICE_8080_TAGS: haproxy,urlprefix-marathon.service.consul/
SERVICE_8080_TAGS: paas-marathon.ui.service.consul/
SERVICE_8080_CHECK_HTTP: /v2/leader

SERVICE_5050_NAME: mesos
SERVICE_5050_TAGS: haproxy,urlprefix-mesos.service.consul/
SERVICE_5050_TAGS: paas-mesos.service.consul/
SERVICE_5050_CHECK_HTTP: /master/health

SERVICE_4400_NAME: chronos
SERVICE_4400_TAGS: haproxy,urlprefix-chronos.service.consul/
SERVICE_4400_TAGS: paas-chronos.service.consul/
SERVICE_4400_CHECK_HTTP: /ping

SERVICE_19999_NAME: netdata
SERVICE_19999_TAGS: haproxy,urlprefix-netdata.service.consul/
SERVICE_19999_TAGS: paas-netdata.service.consul/
SERVICE_19999_CHECK_HTTP: /version.txt

START_CONSUL: "${START_CONSUL}"
START_CONSUL_TEMPLATE: "${START_CONSUL_TEMPLATE}"
START_DNSMASQ: "${START_DNSMASQ}"
START_MESOS_MASTER: "${START_MESOS_MASTER}"
START_MARATHON: "${START_MARATHON}"
Expand All @@ -50,24 +54,17 @@ panteras:
START_FABIO: "${START_FABIO}"
START_NETDATA: "${START_NETDATA}"

HAPROXY_SSL: "${HAPROXY_SSL}"

CONSUL_APP_PARAMS: "${CONSUL_APP_PARAMS}"
CONSUL_DOMAIN: "${CONSUL_DOMAIN}"
CONSUL_TEMPLATE_APP_PARAMS: "${CONSUL_TEMPLATE_APP_PARAMS}"
DNSMASQ_APP_PARAMS: "${DNSMASQ_APP_PARAMS}"
HAPROXY_ADD_DOMAIN: "${HAPROXY_ADD_DOMAIN}"
HAPROXY_CERT_OPTS: "${HAPROXY_CERT_OPTS}"
MARATHON_APP_PARAMS: "${MARATHON_APP_PARAMS}"
MARATHON_JAVA_OPTS: "${MARATHON_JAVA_OPTS}"
MESOS_MASTER_APP_PARAMS: "${MESOS_MASTER_APP_PARAMS}"
MESOS_SLAVE_APP_PARAMS: "${MESOS_SLAVE_APP_PARAMS}"
REGISTRATOR_APP_PARAMS: "${REGISTRATOR_APP_PARAMS}"
JVMFLAGS: "${ZOOKEEPER_JAVA_OPTS}"
ZOOKEEPER_APP_PARAMS: "${ZOOKEEPER_APP_PARAMS}"
ZOOKEEPER_HOSTS: "${ZOOKEEPER_HOSTS}"
ZOOKEEPER_ID: "${ZOOKEEPER_ID}"
KEEPALIVED_VIP: "${KEEPALIVED_VIP}"
CHRONOS_APP_PARAMS: "${CHRONOS_APP_PARAMS}"
JAVA_OPTS: "${CHRONOS_JAVA_OPTS}"
FABIO_APP_PARAMS: "${FABIO_APP_PARAMS}"
Expand Down
11 changes: 9 additions & 2 deletions examples/SimpleWebappPython/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,20 @@ Test:
$ curl -H 'Host: python.service.consul' http://<IP>
```

Test canary:

Deploy "tcp" example:
http://<IP>:81/manual
```
route weight python.service.consul weight 0.01 tags "canary"
```


Deploy "tcp" example (require fabio start with extra port):
```
$ IP=<IP> ./start_with_marathon.sh deploy2_marathon.json
```

Test:
```
$ curl http://<IP>:5556
$ curl http://<IP>:8181
```
Empty file.
6 changes: 4 additions & 2 deletions examples/SimpleWebappPython/deploy0_marathon.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"id": "python-example-stable",
"cmd": "{ echo python stable `hostname` > index.html; exec python3 -m http.server 8080; }",
"user": "ecgapp",
"mem": 16,
"cpus": 0.1,
"instances": 2,
Expand All @@ -15,8 +16,9 @@
}
},
"env": {
"SERVICE_TAGS" : "haproxy,haproxy_weight=100,haproxy_httpchk=GET /",
"SERVICE_NAME" : "python"
"SERVICE_TAGS" : "paas-python.service.consul/",
"SERVICE_NAME" : "python",
"SERVICE_8080_CHECK_HTTP" : "/index.html"
},
"healthChecks": [
{
Expand Down
14 changes: 4 additions & 10 deletions examples/SimpleWebappPython/deploy1_marathon.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"id": "python-example-canaries",
"cmd": "echo python canaries `hostname` > index.html; python3 -m http.server 8080",
"user": "ecgapp",
"mem": 16,
"cpus": 0.1,
"instances": 2,
Expand All @@ -15,18 +16,11 @@
}
},
"env": {
"SERVICE_TAGS" : "haproxy,haproxy_weight=1,haproxy_route=/media,haproxy_route=/chat",
"SERVICE_NAME" : "python"
"SERVICE_TAGS" : "paas-python.service.consul/,canary",
"SERVICE_NAME" : "python",
"SERVICE_8080_CHECK_HTTP" : "/index.html"
},
"healthChecks": [
{
"portIndex": 0,
"protocol": "MESOS_TCP",
"gracePeriodSeconds": 30,
"intervalSeconds": 10,
"timeoutSeconds": 30,
"maxConsecutiveFailures": 3
},
{
"path": "/",
"portIndex": 0,
Expand Down
6 changes: 4 additions & 2 deletions examples/SimpleWebappPython/deploy2_marathon.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"id": "python-example-tcp",
"cmd": "echo python stable `hostname` > index.html; python3 -m http.server 8080",
"user": "ecgapp",
"mem": 16,
"cpus": 0.1,
"instances": 2,
Expand All @@ -15,8 +16,9 @@
}
},
"env": {
"SERVICE_TAGS" : "haproxy,haproxy_tcp=5556",
"SERVICE_NAME" : "python-tcp"
"SERVICE_TAGS" : "paas-:8181 proto=tcp",
"SERVICE_NAME" : "python-tcp",
"SERVICE_8080_CHECK_HTTP" : "/index.html"
},
"healthChecks": [
{
Expand Down
4 changes: 2 additions & 2 deletions examples/SimpleWebappPython/start_with_marathon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ then
curl -X DELETE -H "Content-Type: application/json" http://${IP}:8080/v2/apps/python-example-tcp?force=true >/dev/null 2>&1
else
echo "Start a new one"
#curl -X POST -H "Content-Type: application/json" http://${IP}:8080/v2/apps -d@$1
curl -X PUT -H "Content-Type: application/json" http://${IP}:8080/v2/apps/python-example-stable?force=true -d@$1
curl -X POST -H "Content-Type: application/json" http://${IP}:8080/v2/apps -d@$1
#curl -X PUT -H "Content-Type: application/json" http://${IP}:8080/v2/apps/python-example-stable?force=true -d@$1
fi
3 changes: 2 additions & 1 deletion examples/SmoothWebappPython/deploy0_marathon.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"id": "python-smooth-stable",
"user": "ecgapp",
"args": [ "cd /opt/web/ && python3 -m http.server --cgi" ],
"container": {
"docker": {
Expand All @@ -16,7 +17,7 @@
"mem": 64.0,
"instances": 2,
"env": {
"SERVICE_TAGS" : "haproxy,haproxy_weight=100,haproxy_httpchk=GET /,urlprefix-python-smooth.service.consul/",
"SERVICE_TAGS" : "paas-python-smooth.service.consul/",
"SERVICE_NAME" : "python-smooth",
"SERVICE_8000_CHECK_HTTP" : "/index.html"
},
Expand Down
3 changes: 2 additions & 1 deletion examples/SmoothWebappPython/deploy1_marathon.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"id": "python-smooth-canaries",
"user": "ecgapp",
"args": [ "cd /opt/web/ && python3 -m http.server --cgi" ],
"container": {
"docker": {
Expand All @@ -16,7 +17,7 @@
"mem": 64.0,
"instances": 1,
"env": {
"SERVICE_TAGS" : "haproxy,haproxy_weight=50,urlprefix-python-smooth.service.consul/",
"SERVICE_TAGS" : "paas-python-smooth.service.consul/",
"SERVICE_NAME" : "python-smooth",
"SERVICE_8000_CHECK_HTTP" : "/index.html"
},
Expand Down
10 changes: 7 additions & 3 deletions examples/SmoothWebappPython/simple_webapp_python/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@ ADD ./cgi-bin/index /opt/web/cgi-bin/
RUN chmod a+x /opt/web/cgi-bin/index

ADD https://raw.githubusercontent.com/eBayClassifiedsGroup/PanteraS/master/frameworks/start.sh /usr/local/bin/start.sh
RUN chmod +x /usr/local/bin/start.sh
RUN chmod +rx /usr/local/bin/start.sh

EXPOSE 8000
RUN addgroup -g 31337 ecgapp && \
adduser -G ecgapp -u 31337 -h /app -s /bin/false -D ecgapp && \
chown ecgapp:ecgapp /opt/web/

WORKDIR /
USER ecgapp

WORKDIR /app

ENTRYPOINT ["/usr/local/bin/start.sh"]
17 changes: 0 additions & 17 deletions frameworks/jessie-node4/Dockerfile

This file was deleted.

13 changes: 0 additions & 13 deletions frameworks/jessie-node6/Dockerfile

This file was deleted.

Loading

0 comments on commit efd093e

Please sign in to comment.