Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
compose: docker-compose.yml
application_template: app-config.yaml
105 changes: 105 additions & 0 deletions app-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
---
app: example-voting-app
auto_deploy: true
context: release-handsup-us-east-1
domain: example-voting-app.releaseapp.gethandsup.com
mode: development
repo_name: dustyspace/example-voting-app
hostnames:
- vote: vote-${env_id}-${domain}
- result: result-${env_id}-${domain}
environment_templates:
- name: ephemeral
- name: permanent
resources:
cpu:
limits: 500m
requests: 100m
memory:
limits: 1Gi
requests: 100Mi
replicas: 1
services:
- name: vote
image: dustyspace/example-voting-app/vote
has_repo: true
static: false
volumes: []
args:
- python
- app.py
depends_on:
- worker
ports:
- port: '5000'
type: node_port
target_port: '80'
build:
context: "./vote"
autoscale:
min_replicas: 3
max_replicas: 10
metrics:
- resource:
name: cpu
average_utilization: 50
- resource:
name: memory
average_value: 100Mi
- name: result
image: dustyspace/example-voting-app/result
has_repo: true
static: false
volumes: []
args:
- nodemon
- server.js
depends_on:
- worker
ports:
- port: '5001'
type: node_port
target_port: '80'
- port: '5858'
type: node_port
target_port: '5858'
build:
context: "./result"
- name: worker
image: dustyspace/example-voting-app/worker
has_repo: true
static: false
depends_on:
- redis
- db
build:
context: "./worker"
- name: redis
image: redis:alpine
ports:
- port: '6379'
type: container_port
- name: db
image: postgres:9.6.1
volumes:
- name: db-data
type: persistent
mount_path: "/var/lib/postgresql/data"
ports:
- port: '5432'
type: container_port
storage:
size: 10Gi
type: aws-efs
workflows:
- name: setup
order_from:
- services.all
- name: patch
order_from:
- services.vote
- services.result
- services.worker
- services.redis
- services.db

14 changes: 0 additions & 14 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,6 @@ services:
networks:
- back-tier

uploader:
image: mayth/simple-upload-server
ports:
- "3000:3000"
command:
- "/usr/local/bin/app"
- "-port"
- '3000'
- "-upload_limit"
- '10485760'
- "-token"
- f9403fc5f537b4ab332d
- "/tmp"

redis:
image: redis:alpine
container_name: redis
Expand Down
6 changes: 3 additions & 3 deletions result/views/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html ng-app="catsvsdogs">
<head>
<meta charset="utf-8">
<title>Cats vs Dogs -- Result</title>
<title>Biden vs Trump -- Result</title>
<base href="/index.html">
<meta name = "viewport" content = "width=device-width, initial-scale = 1.0">
<meta name="keywords" content="docker-compose, docker, stack">
Expand All @@ -20,12 +20,12 @@
<div id="content-container-center">
<div id="choice">
<div class="choice cats">
<div class="label">Fred</div>
<div class="label">Biden</div>
<div class="stat">{{aPercent | number:1}}%</div>
</div>
<div class="divider"></div>
<div class="choice dogs">
<div class="label">Savage</div>
<div class="label">Trump</div>
<div class="stat">{{bPercent | number:1}}%</div>
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions vote/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ EXPOSE 80

# Define our command to be run when launching the container
CMD ["gunicorn", "app:app", "-b", "0.0.0.0:80", "--log-file", "-", "--access-logfile", "-", "--workers", "4", "--keep-alive", "0"]

10 changes: 7 additions & 3 deletions vote/app.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
from flask import Flask, render_template, request, make_response, g
from redis import Redis
from dotenv import load_dotenv

import os
import socket
import random
import json

option_a = os.getenv('OPTION_A', "Fredie")
option_b = os.getenv('OPTION_B', "Savagie")
load_dotenv(verbose=True)
option_a = os.getenv('OPTION_A', "Bidenie")
option_b = os.getenv('OPTION_B', "Trumpie")
hostname = socket.gethostname()

app = Flask(__name__)

def get_redis():
if not hasattr(g, 'redis'):
g.redis = Redis(host="redis", db=0, socket_timeout=5)
redis_host = os.getenv('VOTE_REDIS_HOST', "redis")
g.redis = Redis(host=redis_host, db=0, socket_timeout=5)
return g.redis

@app.route("/", methods=['POST','GET'])
Expand Down
1 change: 1 addition & 0 deletions vote/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Flask
Redis
gunicorn
python-dotenv
2 changes: 2 additions & 0 deletions worker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ RUN ["mvn", "verify"]
COPY ["src/main", "/code/src/main"]
RUN ["mvn", "package"]

RUN "echo 'i see you tommy'"

FROM openjdk:8-jre-alpine

COPY --from=build /code/target/worker-jar-with-dependencies.jar /
Expand Down