Giter Club home page Giter Club logo

ukgovernmentbeis.bre_digitalregulationnavigator_alpha's Introduction

DRN Alpha Wagtail site

Technical documentation

This project contains technical documentation written in Markdown in the /docs folder. This covers:

  • continuous integration
  • deployment
  • git branching
  • project conventions

You can view it using mkdocs by running:

mkdocs serve

The documentation will be available at: http://localhost:8001/

Setting up a local build

This repository includes docker-compose configuration for running the project in local Docker containers, and a fabfile for provisioning and managing this.

Dependencies

The following are required to run the local environment. The minimum versions specified are confirmed to be working: if you have older versions already installed they may work, but are not guaranteed to do so.

Note that on Mac OS, if you have an older version of fabric installed, you may need to uninstall the old one and then install the new version with pip3:

pip uninstall fabric
pip3 install fabric

You can manage different python versions by setting up pyenv: https://realpython.com/intro-to-pyenv/

Running the local build for the first time

If you are using Docker Desktop, ensure the Resources:File Sharing settings allow the cloned directory to be mounted in the web container (avoiding mounting OCI runtime failures at the end of the build step).

Starting a local build can be done by running:

git clone https://github.com/UKGovernmentBEIS/BRE_DigitalRegulationNavigator_Alpha.git drn-alpha
cd drn-alpha
fab build
fab start
fab sh

Then within the SSH session:

./manage.py migrate
./manage.py createcachetable
./manage.py createsuperuser
./manage.py runserver 0:8000

The site should be available on the host machine at: http://127.0.0.1:8000/. To set any custom configuration, copy settings/local.py.example to settings/local.py

Frontend tooling

There are 2 ways to run the frontend tooling:

With the frontend docker container (default)

After starting the containers as above and running ./manage.py runserver 0:8000, in a new terminal session run fab npm start. This will start the frontend container and the site will be available on port :3000 using browsersync. E.G localhost:3000.

Locally

To run the FE tooling locally. Create a .env file in the project root (see .env.example) and add FRONTEND=local. Running fab start will now run the frontend container and you can start npm locally instead

There are a number of other commands to help with development using the fabric script. To see them all, run:

fab -l

Front-end assets

Frontend npm packages can be installed locally with npm, then added to the frontend container with fabric like so:

npm install promise
fab npm install

Installing Python packages

Python packages can be installed using poetry in the web container:

fab sh-root
poetry install notifications-python-client

After adding or updating packages, run poetry export --extras gunicorn --without-hashes --output requirements.txt for GOV.UK PaaS

GOV.UK PaaS

To set environment variables in GOV.UK PaaS, use cf set-env APP_NAME VARIABLE VALUE.

Key variables: COMPANIES_HOUSE_API_KEY, NOTIFY_KEY, NOTIFY_EMAIL_TEMPLATE_ID. If you have not yet done so, generate a random long value for SECRET_KEY and set it as well.

To enable HTTP Authentication, set BASIC_AUTH_LOGIN, BASIC_AUTH_PASSWORD.

For further variables, see settings/base.py (search for env.get)

Deployment

A manual deployment workflow would looks somethiong like

# build static assets
nvm use
npm install
npm run build:prod

# ensure requirements.txt is up to date
poetry export --extras gunicorn --without-hashes --output requirements.txt

# Login (note --sso is used if you have enabled SSO). Select sandbox for the environment
cf login -a api.london.cloud.service.gov.uk --sso

# push to GovPaaS. See https://docs.cloud.service.gov.uk/deploying_apps.html#deploy-a-django-app for more
cf push

ukgovernmentbeis.bre_digitalregulationnavigator_alpha's People

Contributors

zerolab avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.