diff --git a/docker-compose.yml b/docker-compose.yml index 9ad272a..289b9d2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,11 +1,11 @@ version: "2" services: - voting-app: - build: ./voting-app + vote: + build: ./vote command: python app.py volumes: - - ./voting-app:/app + - ./vote:/app ports: - "5000:80" @@ -19,11 +19,11 @@ services: db: image: postgres:9.4 - result-app: - build: ./result-app + result: + build: ./result command: nodemon --debug server.js volumes: - - ./result-app:/app + - ./result:/app ports: - "5001:80" - "5858:5858" diff --git a/dockercloud.yml b/dockercloud.yml index b3d63d4..65dc5e7 100644 --- a/dockercloud.yml +++ b/dockercloud.yml @@ -4,9 +4,9 @@ db: redis: image: 'redis:latest' restart: always -result-app: +result: autoredeploy: true - image: 'instavote/result-app:latest' + image: 'instavote/result:latest' ports: - '80:80' restart: always @@ -14,15 +14,15 @@ lb: autoredeploy: true image: 'dockercloud/haproxy:latest' links: - - voting-app + - vote ports: - "80:80" roles: - global restart: always -voting-app: +vote: autoredeploy: true - image: 'instavote/voting-app:latest' + image: 'instavote/vote:latest' restart: always target_num_containers: 5 diff --git a/result-app/tests/tests.sh b/result-app/tests/tests.sh deleted file mode 100755 index a3c8408..0000000 --- a/result-app/tests/tests.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/sh -while ! timeout 1 bash -c "echo > /dev/tcp/voting-app/80"; do sleep 1; done -curl -sS -X POST --data "vote=a" http://voting-app > /dev/null -curl -sS -X POST --data "vote=b" http://voting-app > /dev/null -sleep 10 -if phantomjs render.js http://result-app | grep -q '2 votes'; then - echo -e "\e[42m------------" - echo -e "\e[92mTests passed" - echo -e "\e[42m------------" - exit 0 -fi - echo -e "\e[41m------------" - echo -e "\e[91mTests failed" - echo -e "\e[41m------------" - exit 1 diff --git a/result-app/.vscode/launch.json b/result/.vscode/launch.json similarity index 100% rename from result-app/.vscode/launch.json rename to result/.vscode/launch.json diff --git a/result-app/Dockerfile b/result/Dockerfile similarity index 100% rename from result-app/Dockerfile rename to result/Dockerfile diff --git a/result-app/docker-compose.test.yml b/result/docker-compose.test.yml similarity index 88% rename from result-app/docker-compose.test.yml rename to result/docker-compose.test.yml index e2d9547..0df964e 100644 --- a/result-app/docker-compose.test.yml +++ b/result/docker-compose.test.yml @@ -5,14 +5,14 @@ services: sut: build: ./tests/ depends_on: - - voting-app - - result-app + - vote + - result - worker networks: - front-tier - voting-app: - build: ../voting-app/ + vote: + build: ../vote/ ports: ["80"] depends_on: - redis @@ -21,7 +21,7 @@ services: - front-tier - back-tier - result-app: + result: build: . ports: ["80"] depends_on: diff --git a/result-app/package.json b/result/package.json similarity index 94% rename from result-app/package.json rename to result/package.json index 97b53e0..f7863e1 100644 --- a/result-app/package.json +++ b/result/package.json @@ -1,5 +1,5 @@ { - "name": "result-app", + "name": "result", "version": "1.0.0", "description": "", "main": "server.js", diff --git a/result-app/server.js b/result/server.js similarity index 100% rename from result-app/server.js rename to result/server.js diff --git a/result-app/tests/Dockerfile b/result/tests/Dockerfile similarity index 100% rename from result-app/tests/Dockerfile rename to result/tests/Dockerfile diff --git a/result-app/tests/render.js b/result/tests/render.js similarity index 100% rename from result-app/tests/render.js rename to result/tests/render.js diff --git a/result/tests/tests.sh b/result/tests/tests.sh new file mode 100755 index 0000000..c02e212 --- /dev/null +++ b/result/tests/tests.sh @@ -0,0 +1,15 @@ +#!/bin/sh +while ! timeout 1 bash -c "echo > /dev/tcp/vote/80"; do sleep 1; done +curl -sS -X POST --data "vote=a" http://vote > /dev/null +curl -sS -X POST --data "vote=b" http://vote > /dev/null +sleep 10 +if phantomjs render.js http://result | grep -q '2 votes'; then + echo -e "\e[42m------------" + echo -e "\e[92mTests passed" + echo -e "\e[42m------------" + exit 0 +fi + echo -e "\e[41m------------" + echo -e "\e[91mTests failed" + echo -e "\e[41m------------" + exit 1 diff --git a/result-app/views/app.js b/result/views/app.js similarity index 100% rename from result-app/views/app.js rename to result/views/app.js diff --git a/result-app/views/index.html b/result/views/index.html similarity index 100% rename from result-app/views/index.html rename to result/views/index.html diff --git a/result-app/views/socket.io.js b/result/views/socket.io.js similarity index 100% rename from result-app/views/socket.io.js rename to result/views/socket.io.js diff --git a/result-app/views/stylesheets/style.css b/result/views/stylesheets/style.css similarity index 100% rename from result-app/views/stylesheets/style.css rename to result/views/stylesheets/style.css diff --git a/voting-app/Dockerfile b/vote/Dockerfile similarity index 100% rename from voting-app/Dockerfile rename to vote/Dockerfile diff --git a/voting-app/app.py b/vote/app.py similarity index 100% rename from voting-app/app.py rename to vote/app.py diff --git a/voting-app/requirements.txt b/vote/requirements.txt similarity index 100% rename from voting-app/requirements.txt rename to vote/requirements.txt diff --git a/voting-app/static/stylesheets/style.css b/vote/static/stylesheets/style.css similarity index 100% rename from voting-app/static/stylesheets/style.css rename to vote/static/stylesheets/style.css diff --git a/voting-app/templates/index.html b/vote/templates/index.html similarity index 100% rename from voting-app/templates/index.html rename to vote/templates/index.html