Getting Started#
Introduction#
Before proceeding, we recommend watching this short introduction video to understand what e-Babylab offers and decide whether it fits your needs.
Prerequisites#
e-Babylab runs in a containerised environment using Docker and Docker Compose, which are both included in Docker Desktop.
Try It Locally#
Run a local instance of e-Babylab for testing or development.
Clone the e-Babylab repository:
git clone https://github.com/lochhh/e-Babylab.git cd e-Babylab
If you plan to make custom changes to the code, fork the repository first, then clone your fork:
git clone https://github.com/YOUR_GITHUB_USERNAME/e-Babylab.git cd e-Babylab
Configure your
.envfile as described in Set Up Environment Variables.Start e-Babylab in development mode:
docker compose -f docker-compose.dev.yml up -d --build
Set up the database:
docker compose -f docker-compose.dev.yml exec web uv run python manage.py migrate
Expose static files (e.g. JavaScript files):
docker compose -f docker-compose.dev.yml exec web uv run python manage.py collectstatic
Create an admin account for logging into the admin interface:
docker compose -f docker-compose.dev.yml exec web uv run python manage.py createsuperuser
Once everything is set up, e-Babylab is accessible at http://localhost:8080/admin/.
To stop e-Babylab:
docker compose -f docker-compose.dev.yml down
For more information on running tests, managing dependencies, and other development workflows, see the Development guide.
Production Deployment#
Deploy e-Babylab to a production server.
Create the
e-Babylabdirectory and download the required files:mkdir e-Babylab && cd e-Babylab curl -LO https://raw.githubusercontent.com/lochhh/e-Babylab/main/docker-compose.yml curl -LO https://raw.githubusercontent.com/lochhh/e-Babylab/main/.env.template curl -LO https://raw.githubusercontent.com/lochhh/e-Babylab/main/nginx.conf.template
Configure your
.envfile as described in Set Up Environment Variables, then uncomment and set the following production values:Domain and TLS certificates — you will need a domain name pointing to your server and a TLS certificate. Obtain these from your institution’s IT department or a provider such as Let’s Encrypt. Then set
DOMAIN,SSL_CERT_PATH, andSSL_KEY_PATH:DOMAIN=your-domain.com SSL_CERT_PATH=/etc/ssl/certs/your_cert.pem SSL_KEY_PATH=/etc/ssl/private/your_key.key
Database password — set a strong
DB_PASSWORD.Admin account (optional) — set
DJANGO_SUPERUSER_USERNAME,DJANGO_SUPERUSER_EMAIL, andDJANGO_SUPERUSER_PASSWORDto auto-create an admin account on first startup. If you skip this, you can create one manually later:docker compose exec web python manage.py createsuperuser
Start e-Babylab:
docker compose up -d
e-Babylab will be available at https://your-domain.com/admin/.
Database Access#
For production database access, use any Postgres client (e.g. psql, pgAdmin, DBeaver) with SSH tunnelling to port 5432 on your server:
ssh -L 5432:localhost:5432 user@your-server
Then connect to localhost:5432 with the credentials from your .env file. pgAdmin is included in the development environment only.
Set Up Environment Variables#
Create your
.envfile by copying the template:cp .env.template .env
Generate a Django
SECRET_KEY:python -c 'import secrets; print(secrets.token_urlsafe())'
Or use an online generator such as Djecrety.
Note
If your secret key contains special characters like
$,\, or`, Docker will try to interpret them as variable references in the.envfile. Either wrap the value in single quotes (e.g.,SECRET_KEY='my$ecretKey') or regenerate until you get a key without those characters. Thesecrets.token_urlsafe()method above only produces URL-safe characters and avoids this problem.Copy the generated key and paste it into the
SECRET_KEYfield in your.envfile.Register for Cloudflare Turnstile to obtain the site key and secret key:
For local development, use Cloudflare’s test keys — no account needed.
Go to the Cloudflare Turnstile dashboard and click Add widget, then fill in:
Widget name: e.g.
e-BabylabHostname: your domain (e.g.
your-domain.com)
Leave all other options at their defaults and click Create to generate the keys.
Copy the site key to
CLOUDFLARE_TURNSTILE_SITE_KEYand the secret key toCLOUDFLARE_TURNSTILE_SECRET_KEYin your.envfile.The database connection values (
DB_NAME,DB_USER,DB_PASSWORD,DB_HOST,DB_PORT) are pre-filled with defaults that work for local development. If you are deploying to production, make sure to set a strongDB_PASSWORD.