Project has deployment setup to deploy using fabric and docker on staging/production server, so please follow these steps to configure deployment parameters.
Note that current configuration sets up on ubuntu 16.
- Put your SSH key pair (for connecting to server) into deploy/ssh/staging or deploy/ssh/production folder. Private key as
id_rsa
, public key asid_rsa.pub
. - Generate SSH key pair of remote server (for pulling from git) and link public key of the pair to any bitbucket account that can access the repo
- Copy
fabric_settings.py
fromfabric_settings.py.example
file and fill the parameters. - Now you're ready to use
fab
command line tool to start deployment process. - Deploy commands
- Run
fab staging bootstrap
- Only for the first time to setup environment - Run
fab staging deploy
- Deploy latest code to server when using docker - specify
staging
orproduction
based on fabric settings
- Run
- To setup super user of django admin
= open shell inside docker:
fab staging shell
= run the commandpython manage.py createsuperuser
- To test dockerized production environment on local, run these command:
- Run
./bin/dc_build_local
- Then run
./bin/dc_up_local
- If you want to stop docker, run
./bin/dc_down_local
- If you want to run
manage.py
on docker server, run./bin/dc_m
with arguments
- Run
To run the application on local for development, please follow these steps.
- In
[project folder]/mxtracking
directory, copy local_settings.py.example to local_settings.py - Set Database and Redis configuration
- Activate virtual environment
- Go to project root directory
- Run
pip install -r requirements/local.txt
to install local development dependencies (which includes test libraries in addition to main dependencies.) - Run
python manage.py makemigrations inspection home routeplanning
to create migrations - Run
python manage.py migrate
to migrate database - Load fixtures (See below)
- Run
python manage.py runserver
to run project
- Install node
- Run
npm install
to install dependencies - Run
npm run watch
to watch and compile resource changes
- Run
python manage.py createsuperuser
to create an admin - Login to
http://localhost:8000/admin
to enter django admin - Add Site model with site name
localhost
- Add Social auth application as Google with api key and secret
- You'll be likely seeing
Not enough permissions
when trying to access front end with created account. To fix this you need to set user role inadmin/User Profiles
.
- Run this command to load fixtures:
./bin/load_all_data
- After running this command, load flights CSV file in front end: Route Planning Gantt -> Flights page.
- Run tests on back end:
./bin/test_back_end
- Run tests on back end with coverage report:
./bin/test_back_end_with_coverage
- Test front end Vue.js components:
./bin/test_front_end
ornpm run test
(test_front_end
tool is actually alias tonpm run test
)