Server starts up
- create simple ubuntu 22.04 server
- if it was Beget then username is root and ssh auth instead password
sudo apt update
- install mysql
sudo apt install mysql-server mysql-client
mysql -V
must have ^8.0sudo systemctl status mysql
- import mysql database
CREATE DATABASE box_dust;
CREATE USER 'box_dust_admin'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON box_dust.* TO 'box_dust_admin'@'localhost';
exit;
mysql -u box_dust_admin -p box_dust < box_dust.sql
- install node & npm
sudo apt install build-essential checkinstall
sudo apt install libssl-dev
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash
- restart terminal
nvm install --lts
nvm use --lts
node -v & npm -v
- install nginx
sudo apt-add-repository ppa:nginx/stable
sudo apt install nginx
sudo systemctl enable nginx
- open server ip in browser
- install git
sudo apt install git
git --version
- import project
cd /var/www/html
mkdir box-dust
cd ~
ln -s /var/www/html/box-dust box-dust
ssh-keygen
- add ssh-key to git
cd box-dust
git clone [email protected]:t3946/box-dust.git .
- build project
npm i
- write all required env variables
sudo -H gedit /etc/environment
then reboot server
- expose project
- just open ports for nodes
- client
sudo iptables -A INPUT -p tcp --dport 3000 -j ACCEPT
- api
sudo iptables -A INPUT -p tcp --dport 3080 -j ACCEPT
- check that's all right
sudo iptables -nvL
- in client part you need install submodules
git submodule init
git submodule update --init
- if not working then go in submodule and use git manually
npm run start
- create link to storage for roulette
ln -s /var/www/html/box-dust/admin/storage/app/public/ storage
- setup admin part. You can read this instruction https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-laravel-with-nginx-on-ubuntu-20-04". Don't forget to install php-fpm for current php version and check nginx config for right fpm version.
sudo apt install php-mbstring php-xml php-bcmath
- install composer
sudo apt install curl php-cli php-mbstring git unzip
curl -sS https://getcomposer.org/installer -o composer-setup.php
sudo php composer-setup.php --install-dir=/usr/local/bin --filename=composer
- check it
composer
- install packages
cd admin
composer update
- check laravel
php artisan
- link to admin storage
ln -s /var/www/html/box-dust/admin/storage/app/public/ storage
- domain and port settings
- change in nginx config port 80 to 8000 (admin laravel must work on 8000 port)
- redirect incoming http to client application:
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 3000
sudo iptables-save
If you register through email and password then you must confirm your account before use it. Not confirmed accounts will be deleted after one day.
Dto validation objects good for development more and prevent database errors. Client get errors either before form send or after form send and data is valid but controller declined their by third-side cause (then I write explicitly req.send(errors: {email: "already registered"}) -- email is ok but after check db I got that it can't to use).