Stacked Up is a website created to explore the textbook inventory of Philadelphia public schools, where citizens can check the book records at neighborhood schools. This web application was written using the Django web framework, and all the data is stored under a local PostgreSQL database. It can easily be run again on different machines or in the cloud.
The website can be accessed here, and the original implementation of the website is available here. However, the ReproZip package that we provide is based on a fork of the original project implementation, which fixes some issues, such as missing dependencies.
The ReproZip package is available here (58 MB).
In the original implementation, to locally run the web application, one needs to run the following:
$ ./manage.py runserver 0.0.0.0:8000
However, to properly pack the web application, the database also needs to be traced. Therefore, a script, named runserver, was created to include both the database and the website:
$ sudo /etc/init.d/postgresql start ## Start Database Server $ trap ' ' INT $ ./manage.py runserver 0.0.0.0:8000 ## Run Stacked Up $ trap - INT $ sudo /etc/init.d/postgresql stop ## Stop Database Server
and this script was then traced by ReproZip:
$ reprozip trace ./runserver
This guarantees that both the database and the website are properly identified and traced. Please note the use of
trap to correctly handle Unix signals.
In addition, in the configuration file, all the database and web application files were included under the
additional_patterns: - /var/lib/postgresql/9.1/main/** # all the database files - /home/vagrant/sdp_curricula/** # all the web application files
How to Reproduce
The web application can be started as follows:
$ reprounzip docker setup stacked-up.rpz stacked-up/ $ reprounzip docker run stacked-up/ --expose-port=8000
You can then access your local Stacked Up application at
http://localhost:8000/. If you are using docker-machine, replace
localhost by the IP address of the docker-machine VM.
How to Run in the Cloud
$ docker-machine create --driver amazonec2 --amazonec2-access-key AWS_ID --amazonec2-secret-key AWS_KEY aws01 $ eval $(docker-machine env aws01) $ reprounzip docker setup stacked-up.rpz stacked-up-aws/ $ reprounzip docker run -d stacked-up-aws/ --expose-port=80:8000 $ docker ps
AWS_ID is the AWS Access Key ID and
AWS_KEY is the AWS Secret Access Key.
Packing From Our Demo VM
If you are using our demo VM image, you can run the following:
$ vagrant ssh $ workon stacked-up $ cd reprozip-examples/stacked-up/sdp_curricula/ $ ./runserver