Skip to content

Latest commit

 

History

History
88 lines (74 loc) · 2.23 KB

install_develop.md

File metadata and controls

88 lines (74 loc) · 2.23 KB

Installing for development

WARNING! DO NOT USE THIS DEPLOYMENT IN A PRODUCTION ENVIRONMENT!

This document describes installation steps required to install locally for development.

Preparing environment

  • Install node (>=20)
  • Install python and python-dev (>=3.12)
  • Install and start postgresql (>=15)
  • Install and start redis (>=7)
  • Create a postgresql database and user:
    sudo -u postgres createuser -Pds contactdb && sudo -u postgres createdb contactdb
  • (Recommended) create and activate a python virtualenv
  • Clone this repository

Installing Backend for development

  • Configure local settings, starting from the dev example; ensure that the DB connection details are correctly set
    cp .env.develop.example .env
  • Install dependencies
    pip install -c requirements/constraints.txt -r requirements/dev.txt
    npm install
  • Run migrations
    ./manage.py migrate
  • Add some testing data to the DB:
    ./manage.py seed_db

Running the application

  • Start the backend with hot-reload
    ./manage.py runserver
  • (optional) Start worker. NOTE Worker does not have hot-reload, changes to the code will require a restart
    ./manage.py rqworker
  • Check backend is running correctly at http://localhost:8000 and login with credentials created with seed_db:

Updating the application

  • Update the code with the latest version
  • Update third-party packages required at runtime.
    pip install -c requirements/constraints.txt -r requirements/dev.txt
  • Run migrations:
    ./manage.py migrate

Docker

  • Copy the env file
    cp .env.develop.docker.example .env
  • Copy the compose ovveride file to create an override
    cp compose.override.local-build.yml compose.override.yml
  • Build and start the containers
    docker compose build
    docker compose up -d
  • Create superuser
    docker compose exec app ./manage.py createsuperuser

Where to go from here?

See the tests guide to run the test suites locally. Afterward check the development guide to help you get started.