This project aims to enhance understanding of how large-scale systems is created and how they function between different subsystems. The primary focus of this project is on large scale system development with emphasis on System Integration between subsystems such as 911, Prime Minister Office, Emergency Forces and lastly Crisis Management Office to manage crisis.
To run the server for this project, we will do the following:
- Install
pip
- Install
virtualenv
and activate it - Install all python dependecies for this project
- Run the server
First, we will install pip by following installation guide at https://pip.pypa.io/en/stable/installing/
$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
$ python get-pip.py
Next, we will install virtualenv
using pip
, create a virtual environment, and activate the
environment.
$ sudo python -m pip install virtualenv
$ virtualenv cmoenv
$ source cmoenv/bin/activate
Next, we will install all requirements/dependencies for this project using pip
.
$ pip install -r requirements.txt
Finally, we start the server using the followin command:
# Make sure you are in <root>/src folder before running the server
$ cd src/
# Create Table in SQLite database.
$ python manage.py migrate
# Run the server.
# The website can be accessed at http://localhost:8080
$ python manage.py runserver
At the end of our development, we call deactivate
in command line to deactivate virtualenv
.
We don't install these dependecies everytime when we want to develop for this project. A normal workflow would be:
$ source cmoenv/bin/activate
$ cd src/
$ python manage.py runserver
# When you are done
$ deactivate
This option would allow any platforms that are supported by Docker to build and run this project. In addition, a MySQL backend will be used to store data, instead of SQLite.
First, we need to install Docker from https://www.docker.com/. Then, run the following commands:
# Run the server.
# The website can be accessed at http://localhost:80
$ docker-compose up
# Create Table in MySQL server
$ docker exec -it cz3003ssp3cmo_cmo_1 python manage.py migrate --settings cmo.prod_settings
# Create admin user
$ docker exec -it cz3003ssp3cmo_cmo_1 python manage.py createsuperuser --settings cmo.prod_settings
Both the server for this project and the MySQL server will be runned. All data in MySQL server will
be stored at ./mysql/tmp/
folder. Few useful commands to work with the MySQL server using Docker:
# Get the name of the CMO DB by running docker command, and set the name to a variable
$ docker ps
$ DOCKER_CMO_DB_NAME=cz3003ssp3cmo_db_1
$ DOCKER_CMO_NAME=cz3003ssp3cmo_cmo_1
# Execute some sql commands in the mysql server
$ docker exec -i $DOCKER_CMO_DB_NAME mysql -uroot -pcmodb <<< "use cmodb; select database();"
# Dump all databases to command line outputs
$ docker exec cz3003ssp3cmo_db_1 sh -c 'exec mysqldump --all-databases -uroot -p"cmodb"'
We follow pep8 style guide for python.
To lint our codes:
$ pip install pylint
$ find src -iname "*.py" | xargs pylint
To format our codes:
$ pip install yapf
$ find src -iname "*.py" | xargs yapf -i
Disclaimer: This repo is deprecated and no longer maintained. The Project was submitted as part of the course project for CZ3003 SOFTWARE SYSTEM ANALYSIS AND DESIGN at NTU in AY 17/18 Semester 1. All rights reserved to Nanyang Technological University and the Designer of course CZ3003. The author will bear no responsibilities for any issues arose from academic integrity or honor code violations of anyone who takes this repository as a reference.