-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refs #127. Adds runserver dev container.
- Loading branch information
Justin Littman
committed
Jan 14, 2016
1 parent
fdf6e8e
commit f4bab08
Showing
6 changed files
with
193 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
FROM ubuntu:14.04 | ||
MAINTAINER Rajat Vij <rajatvij@email.gwu.edu> | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
build-essential \ | ||
gettext \ | ||
python-dev \ | ||
zlib1g-dev \ | ||
libpq-dev \ | ||
python-pip \ | ||
apache2 \ | ||
libapache2-mod-wsgi \ | ||
wget \ | ||
zip | ||
# Not sure why the git install needs its own line, | ||
# but it seems to be ignored if added into the list above | ||
RUN apt-get install -y git | ||
#Upgrade pip | ||
RUN pip install --upgrade pip | ||
#This pre-fetches the most recent requirements.txt. | ||
ADD https://raw.githubusercontent.com/gwu-libraries/sfm-ui/master/requirements/requirements.txt /opt/sfm-setup/ | ||
RUN pip install -r /opt/sfm-setup/requirements.txt | ||
#Install appdeps to allow checking for application dependencies | ||
RUN pip install appdeps | ||
#This is used to automatically create the admin user. | ||
RUN pip install django-finalware==0.1.0 | ||
#This will be copied over into the app by invoke.sh. | ||
ADD wsgi.py /tmp/ | ||
#Adds fixtures. | ||
ADD fixtures.json /opt/sfm-setup/ | ||
ADD invoke.sh /opt/ | ||
RUN chmod +x /opt/invoke.sh | ||
WORKDIR /opt/sfm-ui | ||
ENV DJANGO_SETTINGS_MODULE=sfm.settings.docker_settings | ||
CMD ["/opt/invoke.sh"] | ||
EXPOSE 80 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
[ | ||
{ | ||
"fields": { | ||
"name": "testgroup", | ||
"permissions": [] | ||
}, | ||
"model": "auth.group", | ||
"pk": 1 | ||
}, | ||
{ | ||
"fields": { | ||
"name": "testgroup2", | ||
"permissions": [] | ||
}, | ||
"model": "auth.group", | ||
"pk": 2 | ||
}, | ||
{ | ||
"fields": { | ||
"is_visible": true, | ||
"stats": "", | ||
"name": "testcollection", | ||
"date_updated": "2015-12-01T19:10:46Z", | ||
"is_active": true, | ||
"date_added": "2015-12-01T19:10:28Z", | ||
"group": 1, | ||
"description": "This is a test collection." | ||
}, | ||
"model": "ui.collection", | ||
"pk": 1 | ||
}, | ||
{ | ||
"fields": { | ||
"is_visible": true, | ||
"stats": "", | ||
"name": "Test Collection 2", | ||
"date_updated": "2015-12-30T13:18:40.392Z", | ||
"is_active": true, | ||
"date_added": "2015-12-29T20:24:47Z", | ||
"group": 2, | ||
"description": "This collection is for testing purposes." | ||
}, | ||
"model": "ui.collection", | ||
"pk": 2 | ||
}, | ||
{ | ||
"fields": { | ||
"username": "testuser", | ||
"first_name": "", | ||
"last_name": "", | ||
"is_active": true, | ||
"local_id": "", | ||
"is_superuser": false, | ||
"is_staff": false, | ||
"last_login": null, | ||
"groups": [ | ||
1 | ||
], | ||
"user_permissions": [], | ||
"password": "pbkdf2_sha256$20000$7gZDb0TxSksC$HXFliz5Vqsd+S3a6+X+iwQuZ//uvfEpYb+0+0sMD7Vk=", | ||
"email": "", | ||
"date_joined": "2015-12-01T19:09:21Z" | ||
}, | ||
"model": "ui.user", | ||
"pk": 2 | ||
}, | ||
{ | ||
"fields": { | ||
"username": "testuser2", | ||
"first_name": "", | ||
"last_name": "", | ||
"is_active": true, | ||
"local_id": "", | ||
"is_superuser": false, | ||
"is_staff": false, | ||
"last_login": null, | ||
"groups": [ | ||
2 | ||
], | ||
"user_permissions": [], | ||
"password": "pbkdf2_sha256$20000$mvf0xFj6z38i$8MTmopihB8R06iUrqZ22D0MMadsJCIR3avqdAwnpdZ0=", | ||
"email": "", | ||
"date_joined": "2015-12-29T15:01:22Z" | ||
}, | ||
"model": "ui.user", | ||
"pk": 3 | ||
} | ||
] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
echo "Waiting for db" | ||
appdeps.py --wait-secs 30 --port-wait db:5432 --file /opt/sfm-ui --port-wait mq:5672 | ||
if [ "$?" = "1" ]; then | ||
echo "Problem with application dependencies." | ||
exit 1 | ||
fi | ||
|
||
echo "Updating requirements" | ||
pip install -r /opt/sfm-ui/requirements/requirements.txt --upgrade | ||
|
||
echo "Copying config" | ||
cp /tmp/wsgi.py /opt/sfm-ui/sfm/sfm/ | ||
|
||
echo "Syncing db" | ||
/opt/sfm-ui/sfm/manage.py syncdb --noinput | ||
|
||
echo "Migrating db" | ||
/opt/sfm-ui/sfm/manage.py migrate --noinput | ||
|
||
echo "Collecting static files" | ||
/opt/sfm-ui/sfm/manage.py collectstatic --noinput | ||
|
||
echo "Loading fixtures" | ||
/opt/sfm-ui/sfm/manage.py loaddata /opt/sfm-setup/fixtures.json | ||
|
||
echo "Starting message consumer" | ||
/opt/sfm-ui/sfm/manage.py startconsumer & | ||
|
||
echo "Running server" | ||
/opt/sfm-ui/sfm/manage.py runserver 0.0.0.0:80 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
""" | ||
WSGI config for sfm project. | ||
This module contains the WSGI application used by Django's development server | ||
and any production WSGI deployments. It should expose a module-level variable | ||
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover | ||
this application via the ``WSGI_APPLICATION`` setting. | ||
Usually you will have the standard Django WSGI application here, but it also | ||
might make sense to replace the whole Django WSGI application with a custom one | ||
that later delegates to the Django one. For example, you could introduce WSGI | ||
middleware here, or combine a Django application with an application of another | ||
framework. | ||
""" | ||
# if using a virtualenv, uncomment and set the next three lines appropriately | ||
#import site | ||
#ENV = '/PATH/TO/YOUR/VIRTUALENV' | ||
#site.addsitedir(ENV + '/lib/python2.7/site-packages') | ||
|
||
import os | ||
|
||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sfm.settings.docker_settings") | ||
|
||
# This application object is used by any WSGI server configured to use this | ||
# file. This includes Django's development server, if the WSGI_APPLICATION | ||
# setting points here. | ||
from django.core.wsgi import get_wsgi_application | ||
application = get_wsgi_application() | ||
|
||
# Apply WSGI middleware here. | ||
# from helloworld.wsgi import HelloWorldApplication | ||
# application = HelloWorldApplication(application) |
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
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