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.pyfromfabric_settings.py.examplefile and fill the parameters. - Now you're ready to use
fabcommand 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
stagingorproductionbased 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.pyon docker server, run./bin/dc_mwith arguments
- Run
To run the application on local for development, please follow these steps.
- In
[project folder]/mxtrackingdirectory, 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.txtto install local development dependencies (which includes test libraries in addition to main dependencies.) - Run
python manage.py makemigrations inspection home routeplanningto create migrations - Run
python manage.py migrateto migrate database - Load fixtures (See below)
- Run
python manage.py runserverto run project
- Install node
- Run
npm installto install dependencies - Run
npm run watchto watch and compile resource changes
- Run
python manage.py createsuperuserto create an admin - Login to
http://localhost:8000/adminto 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 permissionswhen 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_endornpm run test(test_front_endtool is actually alias tonpm run test)