Server Management (UNIT3D v8.x.x)
HDVinnie edited this page Mar 24, 2024
·
2 revisions
Important
The following assumptions are made:
- You have one
root
user and one regular user with sudo privileges on the dedicated server. - The regular user with sudo privileges is assumed to have the username
ubuntu
. - The project root directory is located at
/var/www/html
. - All commands are ran from the project root directory.
All SSH and SFTP must be done with the non-root user and use sudo
on any commands run. Do not use the root
user.
Everything in /var/www/html
must be www-data:www-data
besides node_modules
which must be root:root
.
This is achieved and setup with:
sudo usermod -a -G www-data ubuntu
sudo chown -R www-data:www-data /var/www/html
sudo find /var/www/html -type f -exec chmod 664 {} \;
sudo find /var/www/html -type d -exec chmod 775 {} \;
sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache
rm -rf node_modules && bun install && bun run build
If PHP changes are made, all that's needed is:
sudo php artisan set:all_cache && sudo systemctl restart php8.3-fpm && sudo php artisan queue:restart
If SCSS or JS changes are made, all that's needed is:
bun run build
# Update the domain in environment variables: `APP_URL` and `MIX_ECHO_ADDRESS`
sudo nano ./.env
# Refresh the TLS certificate:
certbot --redirect --nginx -n --agree-tos --email=sysop@yourdomain.tld -d yourdomain.tld -d www.yourdomain.tld --rsa-key-size 2048
# Update all the domains listed in the websocket configuration to the new domain
sudo nano ./laravel-echo-server.json
# Restart the chatbox server
sudo supervisorctl reload
# Compile static assets
bun run build