- About this application
- Getting Started
- Continuous Integration and Deployment Pipeline
- Contributing
- License
The purpose of this app is to provide a user interface for admin users to maintain the 'DiscoverUni' site content.
This application is based on the Wagtail CMS. It utilises:
- Wagtail CMS
- Python/Django framework
- jQuery
- SASS
You need to have Python (3.6.8), PIP and PostgreSQL installed. There are multiple ways to install Python, either download from the official Python site or use the package manager Homebrew brew install python3
. PIP comes installed with Python 3.4(or greater) by default.
To install Postgres you can also use Homebrew
brew update
brew doctor
brew install postgresql
You need to have Docker and PostgreSQL installed. Docker installation guidance can be found in the Docker Docs.
To install Postgres you can also use Homebrew
brew update
brew doctor
brew install postgresql
To start Postgres:
pg_ctl -D /usr/local/var/postgres start && brew services start postgresql
Create a local database
CREATE DATABASE sampledb;
CREATE USER manager WITH PASSWORD 'supersecretpassword';
GRANT ALL PRIVILEGES ON DATABASE sample TO manager;
Variable | Default | Description |
---|---|---|
DBHOST | host.docker.internal | DB host url/string |
DBPORT | 5432 | DB connection port |
DBNAME | discoveruni | DB name to use |
DBUSER | DB user | |
DBPASSWORD | DB password | |
SEARCHAPIHOST | The url endpoint for the search api | |
DATASETAPIHOST | The url endpoint for the dataset api | |
WIDGETAPIKEY | The access key for the api for the widget | |
DATASETAPIKEY | The access key for the api for the site | |
FEEDBACK_API_HOST | The url endpoint for the feedback api | |
AZURE_ACCOUNT_NAME | The name of the account for image storage | |
AZURE_ACCOUNT_KEY | The access key to account for image storage | |
AZURE_ACCOUNT | The account for image storage | |
LOCAL | False | Tells the site to use external API or mocks |
Create a Python 3.6.8 virtual environment and run the following commands from the root directory of the project:
pip install -r requirements.txt
python manage.py migrate
python manage.py createsuperuser
python manage.py runserver
docker-compose build
docker-compose up
The first command builds the docker image. The second command starts the docker container, running on port 8000.
After the docker image is running for the first time, connect to it and create an admin login as follows:
(From the route directory)
./bin/manage createsuperuser
There are commands setup in the bin directory of the project, that allow easy use of common commands inside the docker container.
- container - takes you on to the containers command line.
- manage - can be passed arguments to run standard django manage.py commands.
- shell - takes you on to the python shell command line for the project.
Adding a new dependency requires rebuilding docker image for Django app.
Stop docker container
docker-compose down
Rebuild Docker image
docker-compose build
Start server again
docker-compose up
The continuous integration and deployment pipeline for this project is implemented using Azure DevOps pipelines.
The continuous integration pipeline for the project is defined in yml files in the root of the project, all starting with 'azure-pipelines'.
There are 4 pipelines defined in the project.
Defined in 'azure-pipelines.yml'
This pipeline should run on every push to Github from feature, bug and refactor branches. All this pipeline does is run the tests to regression check the new code.
Defined in 'dev-azure-pipelines.yml'
This pipeline should run on every push to Github on the develop branch. This pipeline runs the tests and, if they pass, builds a docker container and pushes it to the dev container registry.
Defined in 'pre-prod-azure-pipelines.yml'
This pipeline should run on every push to Github from a release branch. This pipeline runs the tests and, if they pass, builds a docker container and pushes it to the pre-prod container registry.
Defined in 'prod-azure-pipelines.yml'
This pipeline should run on every push to Github on the master branch. This pipeline runs the tests and, if they pass, builds a docker container and pushes it to the prod container registry.
The continuous deployment pipeline is defined through the Azure DevOps pipeline UI.
There are 3 pipelines setup for the project.
The pipeline runs when the Development CI pipeline passes, it pulls the container generated by the CI build on to the WebApp server and starts the container.
The pipeline runs when the a new container is pushed to the pre-prod container registry, it pulls the container on to the WebApp server and starts the container.
The pipeline runs when the a new container is pushed to the prod container registry, it pulls the container on to the WebApp server and starts the container.
Releases of the code are following the major/minor/patch pattern for release numbering.
New releases can be generated manually or by using the 'release' command in the bin directory.
- update the version number with in the version.txt file
- create a new branch named in the pattern 'release/v
version number
' (e.g. release/v0.0.1) - push the branch to Github
- ensure there are no uncommitted changes in your local repository
- call the 'release' command in the bin directory, passing as a parameter either major/minor/patch.
Once a release has been signed off and deployed to production, you need to:
- merge the release branch into master and to development.
- tag master with the release number at the point it was merged in.
- delete the release branch
See CONTRIBUTING for details.
See LICENSE for details.