This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
# Run as | |
# docker-compose build; docker-compose up -d | |
# Check with | |
# docker ps | |
# Then check the logs with | |
# docker logs --tail 50 $container_id | |
# docker-compose images | |
# docker-compose logs --tail 20 repo_name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Licensed to the Apache Software Foundation (ASF) under one or more | |
# contributor license agreements. See the NOTICE file distributed with | |
# this work for additional information regarding copyright ownership. | |
# The ASF licenses this file to You under the Apache License, Version 2.0 | |
# (the "License"); you may not use this file except in compliance with | |
# the License. You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
# Deploy the stack | |
# docker stack deploy -f docker-compose-swarm.yml celery | |
# Investigate the service with | |
# docker service ls | |
# docker service logs celery_rabbit | |
# Scale the service with | |
# docker service scale celery_job_queue_flask_app=N | |
# docker service rm celery_rabbit celery_job_queue_flask_app celery_job_queue_celery_worker job_queue_celery_flower |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
# Run as | |
# docker-compose build; docker-compose up -d | |
# Check with | |
# docker ps | |
# Then check the logs with | |
# docker logs --tail 50 $container_id | |
# docker-compose logs --tail 20 tf_counts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from celery import Celery | |
import os | |
from flask import Flask | |
app = Flask(__name__) | |
def make_celery(app): | |
celery = Celery( | |
app.import_name, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
# Run as | |
# docker-compose build; docker-compose up -d | |
# Check with | |
# docker ps | |
# Then check the logs with | |
# docker logs --tail 50 $container_id | |
# docker-compose logs --tail 20 tf_counts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"AWSEBDockerrunVersion": 2, | |
"volumes": [ | |
], | |
"containerDefinitions": [ | |
{ | |
"name": "flask-app-server", | |
"image": "quay.io/jerowe/flask-app-server:latest", | |
"update": true, | |
"essential": true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
flask-app-server: | |
build: | |
context: flask_app | |
dockerfile: Dockerfile | |
ports: | |
- "5000:5000" | |
volumes: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM continuumio/miniconda3:4.5.11 | |
RUN apt-get update -y; apt-get upgrade -y | |
# You don't technically need these, but I get kind of twitchy if I don't have vim installed | |
RUN apt-get install -y vim-tiny vim-athena ssh | |
# Add a user and switch, using the default root user is BAD | |
RUN adduser --home /home/flask flask |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -x -e | |
gunicorn --workers=2 --bind=0.0.0.0:5000 --keep-alive=2000 --timeout=2000 --log-level=debug flask_app:app |