Merge pull request #26 from tonytan4ever/rakcerlabs-master

CDN API docker along with requirements reorganization
This commit is contained in:
Amit Gandhi 2014-07-01 11:35:06 -04:00
commit 038f3d6c8d
12 changed files with 156 additions and 14 deletions

View File

@ -87,7 +87,7 @@ installed and running.
6. Install general requirements::
$ pip install -r requirements.txt
$ pip install -r requirements/requirements.txt
Install Requirements for each Provider configured::

View File

@ -16,7 +16,18 @@ RUN apt-get -qq update
RUN apt-get -qq upgrade
# Install Pip, Python, etc
RUN apt-get -qqy install git-core python-pip curl libpython-dev uwsgi memcached libev4 libev-dev
RUN apt-get -qqy install git-core wget curl libpython-dev vim memcached libev4 libev-dev python-dev
# setuptools
RUN wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py
RUN python ez_setup.py
# pip
RUN wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py
RUN python get-pip.py
# uwsgi
RUN pip install uwsgi
# Make ssh dir
RUN mkdir /root/.ssh/
@ -32,20 +43,28 @@ RUN echo "IdentityFile ~/.ssh/id_rsa" >> /etc/ssh/ssh_config
RUN touch /root/.ssh/known_hosts
# Pull project
RUN git clone git@github.com:rackerlabs/cdn.git /home/cdn
RUN git clone git@github.com:rackerlab/cdn /home/cdn
# Install Requirements
RUN sudo pip install -r /home/cdn/requirements.txt
# RUN sudo pip install -r /home/cdn/cdn/provider/fastly/requirements.txt
RUN sudo pip install -e git+https://github.com/zebrafishlabs/fastly-python@b98a756b2a03687d76c3cfa0e024a445af85b38d#egg=fastly-python
RUN sudo pip install httplib2>=0.8
RUN sudo pip install -r /home/cdn/requirements/requirements.txt
RUN sudo pip install -e /home/cdn/.
# Set up the configuration files
ADD cdn.conf /etc/cdn.conf
ADD logging.conf /etc/logging.conf
ADD ./cdn.conf /etc/cdn.conf
ADD ./logging.conf /etc/logging.conf
ADD ./uwsgi.ini /root/uwsgi.ini
# create uwsgi log directory
RUN mkdir -p /var/log/cdn
RUN chmod -R +w /var/log/cdn
# create uwsgi pid directory
RUN mkdir -p /var/run/cdn
RUN chmod -R +w /var/run/cdn
#RUN /usr/local/bin/uwsgi --ini /root/uwsgi.ini
# Start CDN
EXPOSE 8888
ENTRYPOINT ["cdn-server"]
EXPOSE 80
CMD ["/usr/local/bin/uwsgi", "--ini", "/root/uwsgi.ini"]

53
docker/api-cdn/cdn.conf Normal file
View File

@ -0,0 +1,53 @@
# By default, this should live in one of:
# ~/.cdn/cdn.conf
# /etc/cdn/cdn.conf
[DEFAULT]
# Show more verbose log output (sets INFO log level output)
;verbose = False
# Show debugging output in logs (sets DEBUG log level output)
;debug = False
# Log to this file
log_file = cdn.log
;auth_strategy =
# ================= Syslog Options ============================
# Send logs to syslog (/dev/log) instead of to file specified
# by `log_file`
;use_syslog = False
# Facility to use. If unset defaults to LOG_USER.
;syslog_log_facility = LOG_LOCAL0
# ================= Driver Options ============================
[drivers]
# Transport driver module (e.g., falcon, pecan)
transport = falcon
# Storage driver module (e.g., mongodb, sqlite, cassandra)
# change to cassandra if you want to use cassandra storage
storage = mockdb
[drivers:transport:falcon]
bind = 0.0.0.0
port = 8888
[drivers:storage:mongodb]
uri = mongodb://localhost
database = cdn
[drivers:storage:cassandra]
cluster = "<your-cassandra-server-link-name>"
keyspace = cdn
[drivers:storage:mockdb]
database = cdn
[drivers:provider:fastly]
apikey = "<MYAPIKEY>"

View File

@ -0,0 +1,49 @@
[loggers]
keys=root,server,combined
[formatters]
keys=normal,normal_with_name,debug
[handlers]
keys=production,file,devel
[logger_root]
level=NOTSET
handlers=devel
[logger_server]
level=DEBUG
handlers=devel
qualname=cdn-server
[logger_combined]
level=DEBUG
handlers=devel
qualname=cdn-combined
[handler_production]
class=handlers.SysLogHandler
level=ERROR
formatter=normal_with_name
args=(('localhost', handlers.SYSLOG_UDP_PORT), handlers.SysLogHandler.LOG_USER)
[handler_file]
class=FileHandler
level=DEBUG
formatter=normal_with_name
args=('cdn.log', 'w')
[handler_devel]
class=StreamHandler
level=NOTSET
formatter=debug
args=(sys.stdout,)
[formatter_normal]
format=%(asctime)s %(levelname)s %(message)s
[formatter_normal_with_name]
format=(%(name)s): %(asctime)s %(levelname)s %(message)s
[formatter_debug]
format=(%(name)s): %(asctime)s %(levelname)s %(module)s %(funcName)s %(message)s

14
docker/api-cdn/uwsgi.ini Normal file
View File

@ -0,0 +1,14 @@
[uwsgi]
master = true
chdir = /home/cdn/
workers = 4
http-socket = 0.0.0.0:80
logger = file:/var/log/cdn/cdn.log
pidfile = /var/run/cdn/cdn.pid
die-on-term = true
enable-threads = true
buffer-size = 32768
max-requests = 15000
no-orphans = true
vacuum = true
module = cdn.transport.falcon.app:app

View File

@ -2,12 +2,10 @@ pbr>=0.5.21,<1.0
Babel>=1.3
netaddr>=0.7.6
falcon>=0.1.6,<0.1.7
jsonschema>=1.3.0,!=1.4.0
iso8601>=0.1.8
msgpack-python
pymongo>=2.4
cassandra-driver>=1.0.0
python-keystoneclient>=0.4.1
python-memcached
WebOb>=1.2.3,<1.3

View File

@ -0,0 +1,2 @@
fastly-python=git+https://github.com/zebrafishlabs/fastly-python@b98a756b2a03687d76c3cfa0e024a445af85b38d#egg=fastly-python
httplib2>=0.8

View File

@ -0,0 +1,4 @@
-r common.txt
-r storage/cassandra.txt
-r transport/falcon.txt
-r provider/fastly.txt

View File

@ -0,0 +1 @@
cassandra-driver>=1.0.0

View File

@ -0,0 +1 @@
pymongo>=2.4

View File

@ -0,0 +1 @@
falcon>=0.1.6,<0.1.7

View File