Django project for the managment and deployment of batteries of experiments.
The repos and their purpose from first iteration of Expfactory:
expfactory-experiments <https://github.com/expfactory/experiments>
_: Holds large nunmber of jspsych experiments currated by Poldrack Lab.expfactory-python <https://github.com/expfactory/expfactory-python>
_:
Python module/cli that would take experiments and compose them into
batteries. Could serve batteries locally via a flask application.expfactory-battery <https://github.com/expfactory/expfactory-battery>
_: Held
static files used across all experiments, and templates used by
expfactory-python to help glue expeirments together.expfactory-docker <https://github.com/expfactory/expfactory-docker>
_:
Django project to serve batteries and store results generated by them.And from the The second iteration of Expfactory:
expfactory-experiments (github org) <https://github.com/expfactory-experiments>
_: Seprated each experiment into
their own repository.expfactory <https://github.com/expfactory/expfactory>
_: A utility to mint
container images that allow given batteries to be reproducibly run.This repository is intended as a replacement for
expfactory-docker<https://github.com/expfactory/expfactory-docker>
_ and
seeks to expand on the ease of use of the first iteration of expfactory and
integrate the tenets of reproducibility from the second iteration.
On a fresh clone a number of environemnt variables must be set for django to start properly: In a shell: mkdir -p ./.envs/.local touch -p ./.envs/.local/.postgres touch -p ./.envs/.local/.django
./.envs/.local/.postgres
requires:
POSTGRES_HOST=postgres
POSTGRES_PORT=5432
POSTGRES_DB=any_db_name
POSTGRES_USER=any_user_name
POSTGRES_PASSWORD=some_passowrd
./.envs/.local/.django
requires:
USE_DOCKER=yes
IPYTHONDIR=/app/.ipython
REDIS_URL=redis://redis:6379/0
CELERY_FLOWER_USER=any_user_name
CELERY_FLOWER_PASSWORD=any_password
./.envs/.local/.django
can also define the following for testing with prolific:
PROLIFIC_KEY=your_prolific_key
A few more commands will need to run in order to setup the database and create an admin user: docker-compost -f local.yml build docker-compose -f local.yml run django ./manage.py makemigrations docker-compose -f local.yml run django ./manage.py migrate docker-compose -f local.yml run django ./manage.py createsuperuser
Finally to start whole thing run: docker compose -f local.yml up
Nginx will run without ssl on port 80 (http://localhost
). This should load non django resources properly while still passing requests that need django to the django development server on port 8000.
Production requires the same settings as local but located in .envs/.production
.envs/.production/.django
Also needs the following set with an appropriate value:
DJANGO_SETTINGS_MODULE=config.settings.production
DJANGO_ADMIN_URL=admin
DJANGO_SECRET_KEY=some_key
DJANGO_ALLOWED_HOSTS=[ips, hostnames]
To make use of compose/production/aws/maintenance
these will need to be set:
AWS_ACCESS_KEY_ID
AWS_SECRET_ACCESS_KEY
AWS_DEFAULT_REGION
To use sentry SENTRY_DSN
will need to be set with the proper URL.
Nginx expects a few directories and files to exist for SSL to work: mkdir -p ./.certs/well-known/acme-challenge mkdir ./.certs/keys mkdir ./.certs/certs
And compose/production/nginx/nginx.conf
expects these files to exist as generated by openssl:
.certs/keys/domain.key;
.certs/certs/server.dhparam;
.certs/certs/signed_chain.crt;
server_name
in ./compose/production/nginx/nginx.conf
will need to be updated accordingly as well. This should probably be another environment variable.
Like local some setup commands will need to be run: docker-compost -f production.yml build docker-compose -f production.yml run django ./manage.py collectstatic --noinput docker-compose -f production.yml run django ./manage.py makemigrations docker-compose -f production.yml run django ./manage.py migrate docker-compose -f production.yml run django ./manage.py createsuperuser
And to kick it off: docker compose -f production.yml up -d