/ems-pgp

Economic Management Solutions for Postgraduate programs

Primary LanguageJavaScript

Installation

For the installation of the app, an Ubuntu 18 server is recommended.

  1. Install Python 3.6 or later
  2. Install pip (it comes bundled with Python by default)
  3. Install virtualenv
  4. Install virtualenvwrapper (recommended)
  5. Install client and server instances of PostgreSQL version 10 or later You can follow this tutorial.
  6. Create a database dedicated for the app
  7. Create a python virtual enviroment for the app
  8. Create /config/settings/production.json and give parameters as described in the following schema
  {
    "HOST": "xxx.xxx.xxx.xxx",
    "DB_USER": "DB_USER",
    "DB_PASS": "SUPER_HARD_PASS",
    "STATIC_ROOT": "/var/www/static"
  }
  1. Install nvm
  2. Install yarn by executing npm i -g yarn

Update version

  1. Fetch last changes git pull
  2. Activate the virtual environment workon emspgp
  3. Update python dependencies pip install -r requirements.txt
  4. Update the database ./manage.py migrate
  5. Activate the node environment nvm use
  6. Install javascript dependencies yarn instal
  7. Bundle front-end files yarn build
  8. Bundle all static files and send them to STATIC_ROOT folder ./manage.py collectstatic

Go Live on production server

  1. Execute gunicorn config.wsgi --bind 127.0.0.1:9010

  2. Make sure to set a web server to proxy the gunicorn port

server {
  listen 9000;
  server_name xxx.xxx.xxx.xxx;


	access_log /path_to/emspgp/logs/nginx_access.log;
	error_log  /path_to/emspgp/logs/nginx_error.log;

	location /static {
    		root /path_to/emspgp/static;
	}

	location / {
    		proxy_pass http://127.0.0.1:9010;
	}
}

Development

  1. Continuously build front-end files yarn start (keep terminal open)
  2. Run server ./manage.py runserver --settings=config.settings.development