Skip to content

Installation without docker

A.s edited this page Jul 31, 2023 · 33 revisions

Pre-requisites

  • Python (any version matching the ones specified here grep python-version .github/workflows/django.yml).
  • Virtualenv (e.g. python3-venv package from your distro's repositories).
  • PostgreSQL database (Django framework will administer tables inside it).
  • E-mail server, Open port, TLS certificates, DNS routing, Reverse Proxy, Backup strategy, etc.

Steps

Execute these commands as the user that will be running/ exposing the application.

First

Note that the default branch is 'develop'. We dropped main to ease the development among contributors. If you wanted to get one of the stable releases, please do so by adding --branch 1.0.0 to git-clone. Do so with an appropriate version number from releases.

git clone --depth=1 git@github.com:maxplanck-ie/parkour2.git
python3 -m venv env_app
source ./env_app/bin/activate
pip install -r parkour_app/requirements/prod.txt

Now the core installation is done, you may move forward.

Second

We assume some environmental variables are set (e.g. LANG, LC_TIME, TZ, etc.) ... Next, you'll need to set further environmental variables (use export so that these are inherited by downstream processes). Take a look at misc/parkour.env.sample to get an idea of what you'll need (e.g. DATABASE_URL is read by Django to authenticate with your PostgreSQL instance). Optionally, add your email and password using the variables SETUP_ADMIN_EMAIL and SETUP_ADMIN_PASSWORD.

Third

Next, change directory into the parkour_app/ subfolder. From now on, all commands will assume this positioning.

Fourth

At last, run the application (in this example, using 4 workers and binding it to port 8000 of all available IP addresses, to be taken care afterward by a web server running as a reverse proxy). See Green Unicorn's Official Documentation for further details.

gunicorn wui.wsgi:application -t 600 -w 4 -b :8000

Fifth

At this point, the database is empty. Before populating it, we'd need to define the schema (e.g. creating empty tables, defining relation between columns/ foreign keys, etc.) For this, run python manage.py migrate --traceback. The command will run all the django-generated code matching the Model definitions of our application (e.g. files matching parkour_app/**/migrations/*.py)

Sixth

For the first login, create an admin account with the following command: python manage.py createsuperuser. You'll be asked for an email account, and a password (twice).

Seventh

There's some default data that will be useful and required, run python manage.py loaddata cost_units organizations principal_investigators sequencers pool_sizes fixed_costs library_preparation_costs sequencing_costs concentration_methods index_pairs index_types index_types_data indices_i5 indices_i7 library_protocols library_types organisms read_lengths nucleic_acid_types. You may edit fixtures manually (e.g. files matching parkour_app/**/fixtures/*.json). Please note that since the primary keys (pk) are defined in such files; every time you re-load these JSON Fixtures, the database is gracefully overwritten.

Finally, further populate your database according to your needs (see the user manual for details, or check Django's loaddata administrative command). Use the cog icon in the top-right corner to access the 'Site Admin' panel.

Take a look at other administrative commands, like django-admin dumpdata and/ or pg_dump & pg_restore. Even if you're not using docker, running make help for a list, and spying upon these with dry-run (e.g. make -n save-postgres) is highly encouraged!

Clone this wiki locally