Skip to content

Fri3dCamp/tickets.fri3d.be

Repository files navigation

tickets.fri3d.be

Pulling her to docker-compose, moving target till the dust settles.

Ticket website for Fri3d Camp 2018

This ships without a real config file, ask Jef for fr1ckets_priv.conf (there be SMTP creds).

Get a local version up 'n' running

Do docker-compose -f docker-compose.yml up in the project folder to start the dev version. Site will be reachable at localhost:80 and will automatically show all changes you make.

Do docker-compose up for a more optimized local version. This will snapshot your current state and serve that, changes to code will not be reflected.

To refresh all the things

docker-compose -f docker-compose.yml down -v Followed by docker-compose -f docker-compose.yml up

A Python-flask app which generates and interprets both the ticket-ordering form and the administrative pages for the orga team. The pages themselves use bootstrap. Datastore is MySQL (was sqlite, again if possible), mail is sent out in the background to a Celery worker pool over Redis.

To work on it, I propose to use docker. On Linux;

  1. make docker-build (this takes a while, only needed if the image changes)
  2. make docker-run (you'll become root within the docker instance)
  3. make docker-test (inside the docker instance)
  1. work on the code, you can work as usual on your git clone, your clone is mounted as /usr/share/fr1ckets/ within the docker instance so any changes are instantly visible
  2. /etc/init.d/uwsgi reload (to pick up and run changed code)
  3. ctrl+d ends the docker instance

To roll out, there's a script to generate a .deb;

  1. make deb
  2. scp it to a server
  3. sudo dpkg -i debfile
  4. *apt-get install -f * (to get any deps you might not have)
  5. copy the files in /usr/share/fr1ckets/conf to their respective locations
  • /etc/nginx/sites-enabled/fr1ckets (update port/hostname to match your situation)
  • /etc/uwsgi/apps-enabled/fr1ckets.ini
  • /etc/supervisor/conf.d/celery.conf
  1. restart said daemons
  2. create a fr1ckets MySQL database/user, load /usr/share/fr1ckets/db/fr1ckets_db.sql

A succinct walkthrough of the code in $checkout/src/fr1ckets/;

  • /views.py generates all the views, def tickets dumps the form, def ticket_register parses the submit
  • /texts.py contains snippets of user-viewable text used by the backend, at the moment all of the mails
  • /model/model.py does all the database work
  • /static/ is in it's entirety copied as $url/static/
    • js/fr1ckets.js is all the js code for the ticket form
    • js/fr1ckets_internal.js is all the js code for the management code
    • css/ and fonts/ comes from the main site repo
  • /templates/ holds the templates which are rendered to html with Jinja2
    • tickets.html is the motherload, but all the collapsible parts are stuffed by fr1ckets.js at run time

LESS stylesheets

The css files are based on LESS, and should not be edited directly, but rather generated through Gulp.

There are a gulpfile.js and package.json in fr1ckets/src/fr1ckets

Installing gulp and the necessary dependencies can be done by doing npm install in this directory.

Subsequently, a minified css file can be generated by doing gulp in the same directory. Alternatively, a non-minified css can be generated through gulp dev.

SASS stylesheet

Navigate to the scripts dir and run sass.sh to generate a .css file for the 2020 style overrides.