Skip to content

Commit

Permalink
Merge 6ed4d75 into bb26069
Browse files Browse the repository at this point in the history
  • Loading branch information
Noah Zoschke committed Sep 29, 2015
2 parents bb26069 + 6ed4d75 commit 9357901
Show file tree
Hide file tree
Showing 28 changed files with 553 additions and 8 deletions.
22 changes: 18 additions & 4 deletions api/dist/kernel.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"BlankDockerImageApi": { "Fn::Equals": [ { "Ref": "DockerImageApi" }, "" ] },
"BlankKey": { "Fn::Equals": [ { "Ref": "Key" }, "" ] },
"BlankRegistryHost": { "Fn::Equals": [ { "Ref": "RegistryHost" }, "" ] },
"Development": { "Fn::Equals": [ { "Ref": "Development" }, "Yes" ] }
"Development": { "Fn::Equals": [ { "Ref": "Development" }, "Yes" ] },
"Encryption": { "Fn::Equals": [ { "Ref": "Encryption" }, "Yes" ] }
},
"Mappings": {
"RegionConfig": {
Expand Down Expand Up @@ -59,7 +60,10 @@
},
"EncryptionKey": {
"Condition": "Development",
"Value": { "Ref": "EncryptionKey" }
"Value": { "Fn::If": [ "Encryption",
{ "Ref": "EncryptionKey" },
{ "Ref": "AWS::NoValue" }
] }
},
"Kinesis": {
"Value": { "Ref": "Kinesis" }
Expand Down Expand Up @@ -130,6 +134,12 @@
"Description": "Deprecated",
"Default": ""
},
"Encryption": {
"Type": "String",
"Description": "Encrypt secrets with KMS",
"Default": "Yes",
"AllowedValues": [ "Yes", "No" ]
},
"InstanceCount": {
"Default": "3",
"Description": "The number of instances in the runtime cluster",
Expand Down Expand Up @@ -175,6 +185,7 @@
},
"Resources": {
"EncryptionKey": {
"Condition": "Encryption",
"DependsOn": "CustomTopic",
"Type": "Custom::KMSKey",
"Properties": {
Expand Down Expand Up @@ -812,7 +823,7 @@
"Type": "AWS::S3::Bucket"
},
"KernelTasks": {
"DependsOn": [ "Balancer", "Cluster", "CustomTopic", "DynamoBuilds", "DynamoReleases", "EncryptionKey", "KernelAccess", "Kinesis", "RegistryAccess", "RegistryBucket", "Subnet0", "Subnet1", "Subnet2", "Vpc" ],
"DependsOn": [ "Balancer", "Cluster", "CustomTopic", "DynamoBuilds", "DynamoReleases", "KernelAccess", "Kinesis", "RegistryAccess", "RegistryBucket", "Subnet0", "Subnet1", "Subnet2", "Vpc" ],
"Properties": {
"Name": {
"Ref": "AWS::StackName"
Expand All @@ -834,7 +845,10 @@
] },
"DYNAMO_BUILDS": { "Ref": "DynamoBuilds" },
"DYNAMO_RELEASES": { "Ref": "DynamoReleases" },
"ENCRYPTION_KEY": { "Ref": "EncryptionKey" },
"ENCRYPTION_KEY": { "Fn::If": [ "Encryption",
{ "Ref": "EncryptionKey" },
""
] },
"KINESIS": { "Ref": "Kinesis" },
"MIXPANEL_TOKEN": "43fb68427548c5e99978a598a9b14e55",
"PASSWORD": { "Ref": "Password" },
Expand Down
22 changes: 22 additions & 0 deletions ci/dependencies-pre.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
set -ex

VERSION=${VERSION:-ci}

# install utilities
curl -O http://stedolan.github.io/jq/download/linux64/jq && chmod +x jq && sudo mv jq /usr/local/bin
sudo pip install awscli

# build and install with VERSION
go get -d github.com/convox/rack/cmd/convox
(
cd ${GOPATH%%:*}/src/github.com/convox/rack/cmd/convox
[ -n "$CIRCLE_BRANCH" ] && git fetch && git checkout $CIRCLE_BRANCH && git reset --hard origin/$CIRCLE_BRANCH
go install -ldflags "-X main.Version $VERSION"
)

# configure client id if on CircleCI
if [ ! -d "~/.convox/" ]; then
mkdir -p ~/.convox/
echo ci@convox.com > ~/.convox/id
fi
43 changes: 43 additions & 0 deletions ci/examples/python-data-science/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
FROM ubuntu:14.04

# vowpal_wabbit, geo deps
RUN apt-get update -qq && apt-get install -y \
build-essential \
curl \
git \
libboost-program-options-dev \
libboost-python-dev \
libgdal-dev \
libgeos-dev \
libproj-dev \
nodejs \
automake \
npm

# -- Install vowpal_wabbit
RUN git clone https://github.com/JohnLangford/vowpal_wabbit.git --branch 7.10 && \
(cd vowpal_wabbit && \
./autogen.sh && \
make && \
make install && \
ldconfig)

RUN npm install less

# Set up Miniconda environment for python2
ENV PATH /opt/miniconda/bin:$PATH
RUN curl https://repo.continuum.io/miniconda/Miniconda-3.5.2-Linux-x86_64.sh -s -o miniconda.sh && \
bash miniconda.sh -p /opt/miniconda -b && \
conda update --yes conda && \
conda install pip --yes

RUN mkdir /app
WORKDIR /app
COPY requirements.txt /app/
COPY conda-requirements.txt /app/

RUN conda install --file conda-requirements.txt --yes && \
pip install -r requirements.txt --exists-action=w --allow-all-external && \
conda clean -pt

COPY . /app/
27 changes: 27 additions & 0 deletions ci/examples/python-data-science/conda-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# This file may be used to create an environment using:
# $ conda create --name <env> --file <this file>
# platform: osx-64
dateutil=2.1=py27_2
geos=3.3.3=0
ipython=3.1.0=py27_0
nose=1.3.6=py27_0
numexpr=2.4.3=np19py27_0
numpy=1.9.2=py27_0
openssl=1.0.1k=1
pandas=0.16.1=np19py27_0
pip=7.1.0=py27_0
pytables=3.1.1=np19py27_2
python=2.7.10=0
python-dateutil=2.4.1=py27_0
pytz=2015.4=py27_0
pyzmq=14.6.0=py27_0
readline=6.2=2
scikit-learn=0.16.1=np19py27_0
scipy=0.15.1=np19py27_0
setuptools=17.0=py27_0
shapely=1.5.9=py27_0
six=1.9.0=py27_0
sqlite=3.8.4.1=1
tk=8.5.18=0
zeromq=4.0.4=0
zlib=1.2.8=0
58 changes: 58 additions & 0 deletions ci/examples/python-data-science/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
alabaster==0.7.4
alembic==0.7.6
amqp==1.4.6
anyjson==0.3.3
APScheduler==3.0.3
arrow==0.5.4
Babel==1.3
billiard==3.3.0.20
blinker==1.3
boto==2.38.0
celery==3.1.18
cssmin==0.2.0
dicttoxml==1.6.6
docutils==0.12
factory-boy==2.5.2
Flask==0.10.1
Flask-Assets==0.10
Flask-Login==0.2.11
Flask-Mail==0.9.1
Flask-Principal==0.4.0
Flask-Script==2.0.5
Flask-Security==1.7.4
Flask-SQLAlchemy==2.0
Flask-WTF==0.11
freezegun==0.3.3
futures==3.0.2
GeoAlchemy2==0.2.4
gunicorn==19.3.0
guppy==0.1.10
httpretty==0.8.10
itsdangerous==0.24
Jinja2==2.7.3
jsmin==2.1.1
kombu==3.0.26
Mako==1.0.1
MarkupSafe==0.23
mock==1.0.1
moto==0.4.2
newrelic==2.50.0.39
-e git+https://github.com/lambdalisue/nose-machineout2.git@c5da96c0ab88494e5d9add354f72ca4d56535200#egg=nose_machineout2
passlib==1.6.2
psycopg2==2.6
Pygments==2.0.2
raven==5.3.1
redis==2.10.3
requests==2.7.0
simplejson==3.7.3
snowballstemmer==1.2.0
SQLAlchemy==1.0.4
SQLAlchemy-Utils==0.30.7
testfixtures==4.1.2
toolz==0.7.2
tzlocal==1.1.3
ujson==1.33
webassets==0.10.1
Werkzeug==0.10.4
WTForms==2.0.2
xmltodict==0.9.2
13 changes: 13 additions & 0 deletions ci/examples/sinatra/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM gliderlabs/alpine:3.2

RUN apk-install ruby ruby-bundler ruby-io-console ruby-kgio ruby-pg ruby-raindrops ruby-unicorn

WORKDIR /app

# cache bundler
COPY Gemfile /app/Gemfile
COPY Gemfile.lock /app/Gemfile.lock
RUN bundle install

# copy the rest of the app
COPY . /app
9 changes: 9 additions & 0 deletions ci/examples/sinatra/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
source "https://rubygems.org"

gem "erubis"
gem "pg", "0.17.1"
gem "redis"
gem "sequel"
gem "sinatra"
gem "sinatra-contrib"
gem "unicorn"
44 changes: 44 additions & 0 deletions ci/examples/sinatra/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
GEM
remote: https://rubygems.org/
specs:
backports (3.6.4)
erubis (2.7.0)
kgio (2.9.3)
multi_json (1.10.1)
pg (0.17.1)
rack (1.6.0)
rack-protection (1.5.3)
rack
rack-test (0.6.3)
rack (>= 1.0)
raindrops (0.13.0)
redis (3.2.0)
sequel (4.18.0)
sinatra (1.4.5)
rack (~> 1.4)
rack-protection (~> 1.4)
tilt (~> 1.3, >= 1.3.4)
sinatra-contrib (1.4.2)
backports (>= 2.0)
multi_json
rack-protection
rack-test
sinatra (~> 1.4.0)
tilt (~> 1.3)
tilt (1.4.1)
unicorn (4.8.3)
kgio (~> 2.6)
rack
raindrops (~> 0.7)

PLATFORMS
ruby

DEPENDENCIES
erubis
pg (= 0.17.1)
redis
sequel
sinatra
sinatra-contrib
unicorn
21 changes: 21 additions & 0 deletions ci/examples/sinatra/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Convox: Sinatra

This application includes:

* Sinatra web app
* Redis-based worker
* Data storage in PostgreSQL

## Development

$ convox start

## Production

[See docs](http://docs.convox.com/docs/deploying-an-application/)

## License

Apache 2.0

&copy; 2015 David Dollar
6 changes: 6 additions & 0 deletions ci/examples/sinatra/bin/web
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

echo "waiting for database"
while true; do sequel -c 'DB.inspect' $POSTGRES_URL 2>/dev/null && break || sleep 1; done

unicorn -c unicorn.rb
9 changes: 9 additions & 0 deletions ci/examples/sinatra/bin/worker
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

# wait for database
while true; do sequel -c 'DB.inspect' $POSTGRES_URL 2>/dev/null && break || sleep 1; done

# execute migrations
sequel -m migrations ${POSTGRES_URL}

bundle exec ruby worker.rb
36 changes: 36 additions & 0 deletions ci/examples/sinatra/conf/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
worker_processes 1;

events { worker_connections 1024; }

error_log /proc/self/fd/2;
pid /var/run/nginx/nginx.pid;

http {
client_body_temp_path /var/cache/nginx/body;
fastcgi_temp_path /var/cache/nginx/fastcgi;
proxy_temp_path /var/cache/nginx/proxy;
scgi_temp_path /var/cache/nginx/scgi;
uwsgi_temp_path /var/cache/nginx/uwsgi;

upstream unicorn {
server localhost:5000;
}

server {
listen 3000;
server_name convox;

access_log /proc/self/fd/1;
error_log /proc/self/fd/2;

location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_next_upstream error;

proxy_pass http://unicorn;
}
}
}
5 changes: 5 additions & 0 deletions ci/examples/sinatra/config.ru
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
require "sinatra"

require File.expand_path("../web.rb", __FILE__)

run Web
Loading

0 comments on commit 9357901

Please sign in to comment.