Skip to content

Deploying production version (deprecated)

Jakub Neruda edited this page Sep 22, 2017 · 1 revision

Introduction

This guide also describes the process of compiling Typescript files into html/css/javascript bundle. Bear in mind that official releases always do this step for you.

I'll assume you've managed to run the development version of the gui. Making production release is quite different. You still have to run database process, but frontend part will be compiled into bunch of html, css and js files, that will be served by some web server (like Apache). Backend part will be run by web server as daemon through wsgi.

This guide assumes that your gui will have it's root in /var/www/html/lgui. Also this guide is written for CentOS7 which misses some features of more advanced distros.

Compiling frontend

With clean clone of this repo, go to www and execute commands:

$ npm install
$ ng build --prod --bh="/lgui/" --aot=false -w

First round of compilation should once again fail on AppModule, but wait for a while, it should try to recompile itself. After a successful compilation, stop the process. There should be now directory www/dist. Copy all of its contents to /var/www/html/lgui. Please note that --bh parameter determines path to root of the gui from root of web server. Apache has its root at /var/www/html and thus path to root of gui is /lgui/. Do not omit the final slash!

Make sure that within lgui/assets there is a config.json. At this point your web browser should be able to load and display login screen of gui at http://localhost/lgui/.

Serving backend

You need to install mod_wsgi for you web server to be able to make rest of this guide work. Since you need mod_wsgi to work with Python3.4 and CentOS7 has not such version available for apache, do the following:

$ yum install httpd-devel gcc
$ mod_wsgi-express module-config >/etc/httpd/conf.modules.d/00-wsgi.conf
$ systemctl restart httpd

With the proper wsgi module installed, you need to configure /etc/httpd/conf/httpd.conf. README in api folder contains configuration for secure connections, following configuration is for local use only since it is unsafe:

ErrorLog '/tmp/log.txt'
LogLevel info

<VirtualHost *:80>
	DocumentRoot "/var/www/html/"
	WSGIDaemonProcess libapi threads=5
	WSGIScriptAlias "/libapi" "/path/to/api/wsgi.py"
	WSGIPassAuthorization on

	<directory "/path/to/api">
		WSGIProcessGroup libapi
		WSGIApplicationGroup %{GLOBAL}
		WSGIScriptReloading On

		Options All
		AllowOverride All
		Require all granted
	</directory>
</VirtualHost>

Don't forget to set up proper paths within that configuration. Also make sure that this path is open for reading for the apache user. In case of any errors, check /tmp/log.txt file for more info on the matter. At this point, whole gui should work.