<p align="center"><a href="https://hstream.moe" target="_blank"><img src="https://hstream.moe/images/hs_banner.png" width="400" alt="hstream Logo"></a></p>

## hstream Website

### Install

```bash
# Install PHP
sudo add-apt-repository ppa:ondrej/php
apt update && apt upgrade
apt install php8.3 php8.3-xml php8.3-mysql php8.3-gd php8.3-zip

# Install NodeJS
curl -sL https://deb.nodesource.com/setup_18.x -o /tmp/nodesource_setup.sh
sudo bash /tmp/nodesource_setup.sh
sudo apt install -y nodejs

# Install composer
cd /usr/bin/
curl -sS https://getcomposer.org/installer | sudo php
mv composer.phar composer

# Install NGINX
apt install nginx
apt install php8.3-fpm

# Install MariaDB
apt install mariadb-server
sudo mysql_secure_installation

# Clone Repo
cd /var/www
git clone https://gitea.hstream.moe/w33b/hstream.git
chown -R www-data hstream/
git config --global --add safe.directory /var/www/hstream

# Install dependencies
composer install --optimize-autoloader --no-dev
npm install

# Build Node modules
npm run build
```

### Supervisor
```bash
apt install supervisor

nano /etc/supervisor/conf.d/laravel-queue.conf :

[program:laravel-queue]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/hstream/artisan queue:work --queue=default --sleep=3 --tries=3 --max-time=3600
autostart=true
autorestart=true
stopasgroup=true
killasgroup=true
user=www-data
numprocs=1
redirect_stderr=true
stdout_logfile=/var/log/laravel-queue.log


sudo systemctl start supervisor
sudo supervisorctl reread
sudo supervisorctl update
sudo supervisorctl start laravel-queue:*
```


### Backup 
```bash
# DB
mysqldump -u root hstream > backup_2023_11_01.sql

# WWW
zip -r hstream_2023_11_30.zip hstream/
```

### Update
```bash
php artisan down && git pull && npm run build && php artisan up
```
