Table of Contents
Installation
To begin with, you will need the compiled jar file. You can either download it from the releases section of this repo, or by building it from source.
On linux systems, place the jar file in a directory such as /var/lib/chatto or /var/www/chatto.
Place the below application.properties config file in the same directory -
chatto.datasource.username=chatto_user
chatto.datasource.password=test
chatto.datasource.database-name=chatto_db
chatto.datasource.url=localhost
chatto.datasource.port=3306
chatto.datasource.params=useSSL=false
Then you would need to configure a reverse proxy, preferably with SSL. You can obtain a free SSL certificate from letsencrypt (be sure to donate if possible). Below is a sample nginx config -
upstream chat {
server 127.0.0.1:8080;
}
# Expires map
map $sent_http_content_type $expires {
default off;
text/html epoch;
text/css max;
application/javascript max;
~image/ max;
}
server {
server_name chat.example.com;
access_log /var/log/nginx/chat.acess.log;
error_log /var/log/nginx/chat.acess.log;
expires $expires;
location / {
proxy_pass http://localhost:8080;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
}
#listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/chat.example.com/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/chat.example.com/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = chat.example.com) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80 ;
listen [::]:80;
server_name chat.example.com;
return 404; # managed by Certbot
}
Place the file as chat.conf in
/etc/nginx/sites-available/
(depending on your linux distro this may differ).
Now make a symlink -
sudo ln -s /etc/nginx/sites-available/chat.conf /nginx/sites-enabled
verify configration -
sudo nginx -t
and restart nginx -
sudo systemctl restart nginx
Now create a linux user -
sudo useradd -r -s /bin/false chatto
Next create a systemd script making use of the created user-
[Unit]
Description=System Daemon for Chatto
[Service]
WorkingDirectory=/path/to/chatto-jar/
ExecStart=/path/to/java -jar Chatto.jar --spring.profiles.active=prod
User=chatto
Type=simple
[Install]
WantedBy=multi-user.target
Take note of the spring profiles argument. It enabled the production profile. Omitting it would run the app in dev profile.
Name the file chatto.service and place it in
/etc/systemd/systemd
Reload systemd daemon -
sudo systemctl daemon-reload
Then start the service -
sudo systemctl start chatto
If everything went well then the app should start. Check with
sudo systemctl status chatto
and if it fails to start do
sudo journalctl -u chatto
to check the cause of the failure.
Default Password
When running the jar file for the first time, a file containing the default(randomly generated) password for the admin account will have been generated in the same directory as the jar.
Please make note of the password, and then delete the file.