Hello fellow operators,
I have been running STORJ nodes on remote linux servers for over a year now. They are non-GUI environments so the best I could do to monitor the node usage was the CLI dashboard. While providing basic information like uptime, disk usage and transfer details, it doesn’t have the cool stuff that the GUI dashboard shows. By default, the GUI dashboard can only be accessed locally which means I cannot use the external ip:14002 to access it. This is a quick way for SNOs to access their dashboards from external locations
Install Caddy
Caddy is a simple web server that needs very little setup. While it can do complex stuff like serving PHP sites, we will use it as a reverse proxy. In this guide, you need to add just 4 lines of code to get your dashboard ready.
To install Caddy, we can either download the static binaries or use the package manager of your Linux server. The steps vary based on the flavor of Linux, see the steps here - https://caddyserver.com/docs/install
Once installed, Caddy is installed as a service and will automatically start on system restart. Caddy is now running on port 80. You can go to your ip from a web browser and see the default “Welcome to Caddy” message. So far, so good.
Setting up the reverse Proxy
The config file for Caddy is located in /etc/caddy/Caddyfile
. This by default has directives to listen to port 80. If you want to change it to something else (maybe 8080), you can edit it. :80
to :8080
. To restart the server to reflect the change, enter sudo systemctl restart caddy
Now, to add the reverse proxy directive, in a blank line enter this
reverse_proxy 127.0.0.1:14002
You can stop here if you want. Restart caddy. Go to http://your-ip/
and you can now view the dashboard. If you don’t feel comfortable sharing this information to anyone who stumbles across the IP, you can move to the basic server protection step
Basic Authentication
You can add a password challenge (basic & insecure) to the Caddyfile
basicauth /* {
username base64_hash_password
}
More details here - basicauth (Caddyfile directive) — Caddy Documentation
You can use caddy hash-password
command to create the hashed password for use in the Caddyfile. Restart the Caddy server and you are good to go. A basic password protected page for your Storj dashboard
Scoring more brownie points
If you assign a domain name to your IP, you can automatically enable https. Caddy comes out of the box with support for HTTPS. Here is some further reading for you - Automatic HTTPS — Caddy Documentation
Hope this guide helped.