Skip to content
This repository has been archived by the owner on Jun 6, 2021. It is now read-only.

Latest commit

 

History

History
68 lines (39 loc) · 3.1 KB

README.md

File metadata and controls

68 lines (39 loc) · 3.1 KB

README

Directory tree layout

  • freenodejobs/

    This directory contians the Django project for this. It makes use of nested applications to organise the code.

  • freenodejobs/settings/

    This directory contains the distributable Django settings for the project. The majority of the settings are stored in defaults/*.py and then "roles" are applied on top of this to override them when running outside of production and/or in tests controlled by the role.py file that is overridden by the deployment. For local settings to your personal environment. you can add them to the freenodejobs/settings/custom.py file.

  • media/

    This directory contains assets that will are served publically via Nginx. They are managed by the Django staticfiles mechanism with the addition of the django-staticfiles-dotd third-party application to automatically concatenate foo.ext.d directories (into a foo.ext file) and to render .scss (Sass) files via the STATICFILES_DOTD_RENDER_PIPELINE setting.

  • templates/

    Contains regular Django templates. organised by application.

  • data/

    This directory contains files that should be available to the Django project but not available via the web server (c.f. static/).

  • config/

    Contains Ansible roles, etc. for deploying the site. Called via .travis.yml, the main script is at deploy/entry which expects a ANSIBLE_VAULT_PASSWORD variable to be exported to the environment (set in the private Travis CI settings, but also available in Lastpass) in order to decrypt private data such as SSH keys, AWS keys, Django's SECRET_KEY, etc.

  • debian/

    As part of the deployment pipeline, a Debian .deb package is built using dh-virtualenv to ensure a tidy installation on the target server. The Gunicorn WSGI server is started via the systemd debian/freenodejobs.freenodejobs-gunicorn.service file.

Local database setup

  1. Create PostgreSQL user with an id matching your UNIX username:

    $ sudo -u postgres createuser $(whoami) -SDR
    
  2. Create a database owned by this user:

    $ sudo -u postgres createdb -E UTF-8 -O $(whoami) freenodejobs
    
  3. Check we can connect to this database:

    $ /usr/bin/psql freenodejobs
    
  4. Create empty tables, etc.:

    $ ./manage.py migrate
    

Running the tests

./setup.py test

Logs

https://eu-west-2.console.aws.amazon.com/cloudwatch/home?region=eu-west-2#logEventViewer:group=freenodejobs;stream=freenodejobs