</> T3MPL

Using T3MPL Server with Apache2

T3MPL Server is Node.js app. If you want to use the server with Apache2 you can do this with Apache Proxy module. In this article I'll show the instruction how achieve this on Ubuntu 19.10 Server.

Instalation

At the beginning you should clone the repository of T3MPL Server. You need Node.js and Git for that.

git clone https://github.com/b4rtaz/t3mpl-server t3mpl-server
cd t3mpl-server

Ok, the installation script now. It builds the server and downloads and builds T3MPL Editor.

bash scripts/install.sh

You may also configure the server port in the configuration.json file, the default is 5050. This port should be hidden on the firewall for external connections.

{
   "server": {
      "port": 5050
   },
...

Apache2

You need proxy and proxy_http module. It must be activated. If you don't have them, you should install them. To activate, enter:

sudo a2enmod proxy
sudo a2enmod proxy_http

You can create a new configuration in /etc/apache2/sites-available directory now.

<VirtualHost *:80>
   ServerAdmin admin@email.com
   ServerName mydomain.com

   ProxyRequests On
   ProxyPass / http://localhost:5050/
   ProxyPassReverse / http://localhost:5050/

   ErrorLog ${APACHE_LOG_DIR}/error.log
   LogLevel warn
   CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

You should activate the new website and restart Apache2.

sudo a2ensite mywebsitename.conf
sudo systemctl restart apache2

T3MPL Server

You can run the server directly from your console. To do this enter:

npm run serve:prod

After this you may try open T3MPL Server by the Apache port. If you do everything correctly, you should see the login panel.

Run Server Forever

Running the server from a user console is a bad thing. I recommend using for that screen program. It allows you keep the server running when you are not connected to a terminal. The repository of the project contains a small script file which manages a screen session.

To start the server, enter:

bash scripts/screen-server.sh start

To stop the server, enter:

bash scripts/screen-server.sh stop

If you want to start T3MPL Server after server restart. I recommend installing above command into crontab. To open crontab enter:

crontab -e

And add this line:

@reboot /bin/bash /your/path/to/t3mpl-server/scripts/screen-server.sh start