NYC Parks Trees Count! 2015 tree census
A combination of Vagrant 1.5+ and Ansible 1.8+ is used to setup the development environment for this project. It of the following virtual machines:
app virtual machine contains an instance of the Django application,
tiler contains a tiling server, and
services contains shared resources of
Use the following command to bring up a local development environment:
$ vagrant up
After provisioning is complete, you can login to the application server to execute Django management commands:
$ vagrant ssh app vagrant@app:~$ envdir /etc/nyc-trees.d/env /opt/app/manage.py test
Note: If you get an error that resembles the following, try logging into the
app virtual machine again for the group permissions changes to take effect:
envdir: fatal: unable to switch to directory /etc/nyc-trees.d/env: access denied
The Vagrant configuration maps the following host ports to services
running in the VMs. You can change the host port numbers by setting
the environment variables listed in the
Env Variable Override
|Django Web Application||8000||http://localhost:8000|
|livereload||35729||(for gulp watch)|
|LiveServer Tests||9001||(for Sauce Labs)|
The main tool used is gulp, which is exposed through
npm run to avoid version conflicts.
- To create JS bundles, compile sass, and concatenate third-party css, minify CSS and JS, and version files using
npm run build.
- To do the above but skip minification and versioning, use
gulp build --debugor
npm run build-debug.
- To watch files and automatically rebuild the JS or sass files when they change, use
gulp watch --debugor
npm run watch. This will also start a livereload server.
gulp build and
gulp watch without the
--debug flag are intentionally not exposed through
In order to speed up things up, you may want to consider leveraging the
vagrant-cachier plugin. If installed, it is automatically used by Vagrant.
src/nyc_trees/apps/survey/fixtures/README.md for documentation on how the source data fixtures were created.
In order to simulate the testing environment used in CI, bring up the testing environment with:
$ VAGRANT_ENV="TEST" vagrant up
Once that is complete, execute the top-level test suite responsible for linting and unit testing the client and server-side components:
If you want to run the integration tests, use the following command:
$ ./scripts/manage.sh selenium
In addition, other scripts exist if you want to test just one of the client or server-side components.
For more details around the Amazon Web Services deployment process, please see the deployment README.