README.md manual installation update
ApplePie420 opened this issue · 0 comments
Hey,
recently I went through installation of this dashboard. Love the style of it, everything works, but the readme has some mistakes that can be difficult for some to solve. I've installed it manually on a VM, without using docker. That might also have some mistakes, but since I don't know how to work with docker, that will be omitted in this Issue.
I'm running Arch Linux 5.18.6 on a VM, Proxmox hyperV v.6.2-4, 1 CPU core, 2GB RAM. Only additional installed packages are yarn, git, vim and nginx. Except that, it is a base Arch installation.
Step by step explanation
First, we clone and build the repo, which is fine, but we, for some unknown reason to me, move all built files to dashboard/
folder. That creates two problems:
- A complete mess in the file structure
- When we later on copy the folder to
/var/www/
, we are serving everything in that folder, since we do not configure nginx to not serve anything else. So we can accesshttp://localhost/README.md
orhttps://localhost/package.json
, which is absolutely not secure.
I suggest we do NOT copy the built files to wherever we are serving them, but instead, just copy contents of the build/ data/ public/
folders. This can either be done manually, or we can create a simple small script that can do this for us.
Nginx config is very vaguely configured. Later in the commands, we chown
the folder to user www-data
, but that user, by default, does not exist (at least it did not on my Arch install. Nginx was installed with pacman). So we would need to create both user and group first:
groupadd www-data
usermod -a -G www-data www-data
chown -R www-data:www-data /var/www/dashboard
Then, we never set the nginx to run as that user. Meaning we still serve all the files as root. So we need to specify also
user www-data;
# ...
in the nginx config file. Funnily enough, the example file nginx.conf
provided in the repo would not work, because the root of the app is set to /app
, which we never create. I suggest to either completely delete that file from the repo, since there is no mention of it, or how should it be used, or to change it to what I've written down, and instead, reference it in the readme (add a step like "move the example nginx config file with cp nginx.conf /etc/nginx/nginx.conf
. But that is probably not a good idea, since it will completely obliterate all other configs.)
Also, the location of Nginx config file is /etc/nginx/nginx.conf
, at least in systemd.
Speaking of systemd, correct syntax for reloading a service under systemd is systemctl reload nginx
.
Then there is that absolutely unnecessary step of moving ~/dashboard
into ~/html
. We can move the ~/dashboard
folder directly into /var/www/dashboard/html
. That is, if we want to move the whole folder. Refer to above, where I was mentioning that we should copy only certain files.
So my proposed Manual install section would look like:
Manual installation
Clone and build
git clone https://github.com/phntxx/dashboard.git
cd dashboard
yarn
yarn build
Move all the files
mkdir /var/www/dashboard/html
cp -r build/ data/ src/ /var/www/dashboard/html
Configure nginx
# only do the next two steps if your www-data user does not exist. Check `grep www-data /etc/passwd`
groupadd www-data
useradd -a -G www-data www-data
chown -R www-data:www-data /var/www/dashboard
Next, edit the /etc/nginx/nginx.conf
file. It should look something like this:
user www-data;
worker_processes auto;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octec-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost; # edit as needed if using your own domain
root /var/www/dashboard/html/;
location / {
index index.html index.htm;
}
}
}
As a last step, reload nginx:
systemctl reload nginx
Now you should be able to visit your dashboard at http://localhost