Merge pull request #21 from bfirsh/rename-services

Rename services to remove "app"
This commit is contained in:
Ben Firshman 2016-06-18 19:32:22 +02:00 committed by GitHub
commit ade2b40403
21 changed files with 37 additions and 35 deletions

View File

@ -1,10 +1,11 @@
version: "2" version: "2"
services: services:
voting-app: vote:
build: ./voting-app build: ./vote
command: python app.py
volumes: volumes:
- ./voting-app:/app - ./vote:/app
ports: ports:
- "5000:80" - "5000:80"
@ -18,11 +19,11 @@ services:
db: db:
image: postgres:9.4 image: postgres:9.4
result-app: result:
build: ./result-app build: ./result
command: nodemon --debug server.js command: nodemon --debug server.js
volumes: volumes:
- ./result-app:/app - ./result:/app
ports: ports:
- "5001:80" - "5001:80"
- "5858:5858" - "5858:5858"

View File

@ -4,9 +4,9 @@ db:
redis: redis:
image: 'redis:latest' image: 'redis:latest'
restart: always restart: always
result-app: result:
autoredeploy: true autoredeploy: true
image: 'instavote/result-app:latest' image: 'instavote/result:latest'
ports: ports:
- '80:80' - '80:80'
restart: always restart: always
@ -14,15 +14,15 @@ lb:
autoredeploy: true autoredeploy: true
image: 'dockercloud/haproxy:latest' image: 'dockercloud/haproxy:latest'
links: links:
- voting-app - vote
ports: ports:
- "80:80" - "80:80"
roles: roles:
- global - global
restart: always restart: always
voting-app: vote:
autoredeploy: true autoredeploy: true
image: 'instavote/voting-app:latest' image: 'instavote/vote:latest'
restart: always restart: always
target_num_containers: 5 target_num_containers: 5

View File

@ -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

View File

@ -5,14 +5,14 @@ services:
sut: sut:
build: ./tests/ build: ./tests/
depends_on: depends_on:
- voting-app - vote
- result-app - result
- worker - worker
networks: networks:
- front-tier - front-tier
voting-app: vote:
build: ../voting-app/ build: ../vote/
ports: ["80"] ports: ["80"]
depends_on: depends_on:
- redis - redis
@ -21,7 +21,7 @@ services:
- front-tier - front-tier
- back-tier - back-tier
result-app: result:
build: . build: .
ports: ["80"] ports: ["80"]
depends_on: depends_on:

View File

@ -1,5 +1,5 @@
{ {
"name": "result-app", "name": "result",
"version": "1.0.0", "version": "1.0.0",
"description": "", "description": "",
"main": "server.js", "main": "server.js",

15
result/tests/tests.sh Executable file
View File

@ -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

View File

@ -15,4 +15,4 @@ ADD . /app
EXPOSE 80 EXPOSE 80
# Define our command to be run when launching the container # Define our command to be run when launching the container
CMD ["python", "app.py"] CMD gunicorn app:app -b 0.0.0.0:80 --log-file - --access-logfile - --workers 4 --keep-alive 0

3
vote/requirements.txt Normal file
View File

@ -0,0 +1,3 @@
Flask
Redis
gunicorn

View File

@ -1,2 +0,0 @@
Flask
Redis