Skip to content

Latest commit

 

History

History
75 lines (49 loc) · 2.07 KB

File metadata and controls

75 lines (49 loc) · 2.07 KB

How to set up the application locally for dev or fun

  • Clone the repo using git
git clone git@github.com:Bolls-Bible/bain.git

Basic commands to run the application locally

make build
make create-network

Now add bolls.local to your hosts file (on linux it's /etc/hosts) and generate ssl certificates by running

make mkcert-install

If you're on Windows, install mkcert using chocolatey or scoop and run the following command to generate the certificates:

mkcert -install
mkcert -cert-file "C:\path-to-the-project\bain\nginx_dev\certs\local-cert.pem" -key-file "C:\path-to-the-project\bain\nginx_dev\certs\local-key.pem" "bolls.local"

Then create .env.dev (may be empty) and run the application with

sudo sysctl net.ipv4.ip_unprivileged_port_start=80 # only for linux to allow non-root process to bind to port 80
make up

And don't forget to run migrations and create a superuser with

make migrate
make createsuperuser

Once it runs you can download and restore essential tables in the database, run

make restore-db

Now you should be able to open the application in your browser at https://bolls.local

Basic commands for debugging and logging

docker compose up -d --force-recreate

docker compose ps

docker compose logs -f --tail 8

docker compose stop

docker compose exec django python manage.py makemigrations
docker compose exec django python manage.py migrate --noinput

docker cp ./django/sql/unaccent_plus.rules db:/usr/local/share/postgresql/tsearch_data/unaccent_plus.rules

docker exec -i db psql -U django -d cotton -c "ALTER TEXT SEARCH DICTIONARY unaccent (RULES='unaccent_plus')"

docker cp ./django/sql/unaccent_plus.rules database:/usr/local/share/postgresql/tsearch_data/unaccent_plus.rules
docker exec -t database psql -U postgres_user -d postgres_db -c "CREATE EXTENSION unaccent;"
docker exec -i database psql -U postgres_user -d postgres_db -c "ALTER TEXT SEARCH DICTIONARY unaccent (RULES='unaccent_plus')"

docker compose exec -T django python manage.py test --keepdb