-
Notifications
You must be signed in to change notification settings - Fork 0
Development environment
Robin Paret edited this page May 22, 2024
·
13 revisions
- Docker and docker compose installed
The .env file contains all kinds of settings for the frontend, backend and database. An example setup for development looks like this:
DEBUG=1
SLASHAPI=0
SECRET_KEY=development_key
DJANGO_ALLOWED_HOSTS='localhost 127.0.0.1 [::1] django example.com localhost:3000 localhost:8000'
SQL_ENGINE=django.db.backends.postgresql
SQL_DATABASE=pigeonhole_dev
SQL_USER=pigeonhole
SQL_PASSWORD=password
SQL_HOST=pigeonhole-database
SQL_PORT=5432
DATABASE=postgres
DJANGO_SUPERUSER_PASSWORD=abc
DJANGO_SUPERUSER_EMAIL=[email protected]
OAUTH_CLIENT_ID=[CENSORED]
OAUTH_TENANT_ID=[CENSORED]
OAUTH_CLIENT_SECRET=[CENSORED]
FRONTEND_URL=http://localhost:3000
NEXT_PUBLIC_BACKEND_URL=http://localhost:8000
NEXT_PUBLIC_SERVER_URL=http://pigeonhole-backend:8000
NEXT_PUBLIC_REDIRECT_URL=/redirect
SUBMISSIONS_PATH=/data/submissions
REGISTRY_URL=http://localhost:5000
REGISTRY_NAME=localhost:5000
REGISTRY_USER=[CENSORED]
REGISTRY_PASSWORD=[CENSORED]
Notice the Django superuser credentials are inputted here.
This will start the frontend, backend and database containers.
Just run make start
- The frontend is available at localhost:3000
- The backend is available at localhost:8000
- The database is available at localhost:5432 with the login from .env
- If the build or startup of the container shows timeout or other network errors, it may be a problem with docker's network ranges, especially on eduroam. You can fix this by making a new file /etc/docker/daemon.json and entering the following:
{
"bip": "10.200.0.1/24",
"default-address-pools":[
{"base":"10.201.0.0/16","size":24},
{"base":"10.202.0.0/16","size":24}
]
}
Then restart docker or just reboot and try again.
Changes in code will automatically update in the browser and backend, no need to reload anything
There is a Makefile script with handy actions you can run from the terminal, such as:
- make start: Does the relevant docker compose up command
- make stop: Does the relevant docker compose down command
- make lint: Lints both Frontend and Backend locally and gives the results (If empty, you're good.)