Installation

Prerequisites

The following prerequisites are required in order for Trudesk to run.

Trudesk is still in active development and its possible you may run into issues during the install process. If you have issues please fill out a bug report.

Release Notes

Detailed release notes for each version are available on GitHub.

Download

To download the latest version please use master branch on GitHub.


Development VersionMay contain untested code

Production VersionLatest zip of master branch

OSX Install

Please verify you have met all of the prerequisites before running the following commands.

For detailed documentation on installing the prerequisites, please visit the documentation for each above.

The following commands will download and install the latest version.

$ git clone https://www.github.com/polonel/trudesk
$ cd trudesk
$ npm install -g yarn
$ yarn
$ yarn run build
$ node runner

By default the server starts listening for incoming connections on http://0.0.0.0:8118

Linux Install

Please verify you have met all of the prerequisites before running the following commands.

For detailed documentation on installing the prerequisites, please visit the documentation for each above.

The following commands will download and install the latest version.

$ git clone https://www.github.com/polonel/trudesk
$ cd trudesk
$ npm install -g yarn
$ yarn
$ yarn run build
$ node runner

By default the server starts listening for incoming connections on http://0.0.0.0:8118

Ubuntu Install Script

The install script will download all the required packages and prompt if you want to install MongoDB locally.

Note: This script is designed to run on a fresh install of Ubuntu 16.04

Ubuntu 16.04

curl -L -s http://www.trudesk.io/install/install_ubuntu.sh | sudo bash

Installing Trudesk video showing the install processes with the Ubuntu Install Script.

Windows Install

Please verify you have met all of the prerequisites before running the following commands.

For detailed documentation on installing the prerequisites, please visit the documentation for each above.

The following commands will download and install the latest version.

C:\> git clone https://www.github.com/polonel/trudesk
C:\> cd trudesk
C:\trudesk> npm install -g yarn
C:\trudesk> yarn
C:\trudesk> yarn run build
C:\trudesk> node runner

Virtual Appliance

The trudesk virtual appliance is no longer maintained. It has been superseded by the Ubuntu Install Script.

Docker Install

Trudesk can run as a docker container as well. The below example shows running a MongoDB container and linking it to a trudesk container.

The below example assumes you have docker already install

Note: In this example all container storage is located on the host.
In order to run trudesk in a multi-host container cluster, you will require a shared storage. (ex: NFS)

Storage - Create directories on host

$ mkdir -p /data/db
$ mkdir -p /data/configdb
$ mkdir -p /data/trudesk/plugins
$ mkdir -p /data/trudesk/uploads
$ mkdir -p /data/trudesk/backups

MongoDB Container

The following command will deploy a mongodb 3.6 docker container with the name mongodb, which we will use to link to our trudesk container.

$ docker run --name mongodb \
-v /data/db:/data/db \
-v /data/configdb:/data/configdb \
-d mongo:3.6

Trudesk Container

The following command will deploy a trudesk 1.0 docker container. The container will expose a NodePort to access the container.

Get latest updated image of 1.0

$ docker pull polonel/trudesk:1.0

$ docker run --name trudesk --link mongodb:mongodb \
-v /data/trudesk/uploads:/usr/src/trudesk/public/uploads \
-v /data/trudesk/plugins:/usr/src/trudesk/plugins \
-v /data/trudesk/backups:/usr/src/trudesk/backups \
-e NODE_ENV=production \
-e TRUDESK_DOCKER=true \
-e TD_MONGODB_SERVER=mongodb -e TD_MONGODB_DATABASE=trudesk \
-P -d polonel/trudesk:1.0

The following environment variables are available

TD_MONGODB_SERVER
TD_MONGODB_PORT
TD_MONGODB_USERNAME
TD_MONGODB_PASSWORD

#Complete mongodb:// URI
TD_MONGODB_URI

Accessing the trudesk container

Once the containers are running, access the trudesk container via the assigned NodePort.
The following command will list the two running containers. Notice under the ports column
the NodePort - 32772. This will allow access to the trudesk container via http://{hostip}:32772

$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5f75716aa8cc polonel/trudesk:1 "/bin/bash /usr/src/…" 1 minute ago Up 1 minute 0.0.0.0:32772->8118/tcp trudesk
5b4f77cbf1a3 mongo:3.6 "docker-entrypoint.s…" 32 minutes ago Up 32 minutes 27017/tcp mongodb

Systemd startup script

The docker containers will not start on reboot. A startup script can relaunch the containers during startup. The following is an example of a systemd startup script.

MongoDB

$ sudo vi /etc/systemd/system/docker-mongodb.service

[Unit]
Description=MongoDb Container
Requires=docker.service
After=docker.service

[Service]
Restart=always
ExecStart=/usr/bin/docker start -a mongodb
ExecStop=/usr/bin/docker stop -t 10 mongodb

[Install]
WantedBy=default.target

Trudesk

$ sudo vi /etc/systemd/system/docker-trudesk.service

[Unit]
Description=Trudesk Container
Requires=docker-mongodb.service
After=docker-mongodb.service

[Service]
Restart=always
ExecStart=/usr/bin/docker start -a trudesk
ExecStop=/usr/bin/docker stop -t 2 trudesk

[Install]
WantedBy=default.target

Stop the containers if they are running

$ docker stop trudesk mongodb

Reload the systemd service files, start the containers, and enable the services for system startup.

$ sudo systemctl daemon-reload
$ sudo systemctl start docker-mongodb
$ sudo systemctl start docker-trudesk
$ sudo systemctl enable docker-mongodb
$ sudo systemctl enable docker-trudesk

Nginx Proxy

I recommend using Nginx to access the trudesk container with a hostname/domain name. Check out jwilder/nginx-proxy for more information.

PM2

Process Manager 2 is a great tool to handle running the Trudesk process.

Install and Configure

npm install pm2 -g will install the pm2 CLI for handling the process.

Linux & MacOS

$ pm2 start {path/to/trudesk}/app.js --name trudesk \
-l {path/to/trudesk}/logs/output.log --merge-logs
$ pm2 save
$ pm2 startup

Reverse Proxy - Nginx

Trudesk runs on an internal port of 8118. In order to access Trudesk on port 80, a reverse proxy is recommended. This allows you to setup SSL/TLS for your domain.

nginx.conf - example

http {
access_log /var/log/nginx/access.log main;

sendfile on;
keepalive_timeout 65;

upstream socket_nodes {
ip_hash;
# IP Address of Host running Trudesk
server 192.168.1.x:8118;
}

server {
listen 80;
server_name trudesk.domain.com;

location ~ ^/(uploads/) {
root /path/to/trudesk/public;
access_log off;
expires modified +1h;
}

location / {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_cache one;
proxy_cache_key trudesk$request_uri$scheme;
proxy_pass http://socket_nodes;
}

# redirect server error pages to the static page /40x.html
#
error_page 404 /404.html;
location = /40x.html {
}

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
}
}
}