Installing Wetty
Installing Wetty
The best way should be to follow https://github.com/butlerx/wetty and its docs but if that does not work this how-to could be used.
It assumes you are in your home directory as an ordinary (non-root) user. Otherwise some paths below will need to be adjusted.
Run:
$ git clone https://github.com/butlerx/wetty.git
$ cd wetty
$ yarn
$ yarn build
The README.md from the author directs to install it globally. Didn’t work for me. Just rename the app file:
$ mv wetty.js app.js
Config for nginx
Assuming that the service is to be available at https://yoursite.adr/wetty below is the piece of Nginx config responsible for this:
location /wetty {
# uncomment if you need to restrict the access
# the password file should be prepared
# auth_basic "Restricted";
# auth_basic_user_file /etc/nginx/.htpasswd;
proxy_pass http://127.0.0.1:3000/wetty;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_read_timeout 43200000;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
}
Run WeTTy as a service daemon
Prepare service file:
$ mcedit bin/wetty.service
Edit it like this:
# systemd unit file
#
# place in /etc/systemd/system
# systemctl enable wetty.service
# systemctl start wetty.service
[Unit]
Description=Wetty Web Terminal
After=network.target
[Service]
WorkingDirectory=/home/YOURUSER/wetty/
ExecStart=/usr/bin/node app.js -p 3000 --host 127.0.0.1 --base /wetty/
[Install]
WantedBy=multi-user.target
(pay attention to WorkingDirectory and the parameters in ExecStart, change if needed)
After that copy the file to its place and start the service:
$ sudo cp bin/wetty.service /etc/systemd/system/
$ sudo systemctl enable wetty
$ sudo systemctl start wetty
That’s it.