Skip to content

A self-hosted media server and file management system

Reverb + General Setup Scripts

aminnausin6d9f02b0bd4f
diff --git a/.env.example b/.env.example
index b7816ae4..dfc98b66 100755
--- a/.env.example
+++ b/.env.example
@@ -1,7 +1,7 @@
-APP_NAME=Laravel
+APP_NAME=mediaServer
APP_ENV=local
APP_KEY=
-APP_DEBUG=true
+APP_DEBUG=false
APP_TIMEZONE=UTC
APP_URL=https://app.test:8080
APP_LOCALE=en
@@ -26,7 +26,7 @@ DB_CONNECTION=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=mediaServer
-DB_USERNAME=root
+DB_USERNAME=postgres
DB_PASSWORD=
SANCTUM_STATEFUL_DOMAINS=app.test:8080,0.0.0.0:6001,app.test:6001
diff --git a/app/Console/Commands/GenerateReverbKeys.php b/app/Console/Commands/GenerateReverbKeys.php
new file mode 100644
index 00000000..5e9dc919
--- /dev/null
+++ b/app/Console/Commands/GenerateReverbKeys.php
@@ -0,0 +1,55 @@
+<?php
+
+namespace App\Console\Commands;
+
+use Illuminate\Console\Command;
+
+class GenerateReverbKeys extends Command {
+ /**
+ * The name and signature of the console command.
+ *
+ * @var string
+ */
+ protected $signature = 'reverb:generate';
+
+ /**
+ * The console command description.
+ *
+ * @var string
+ */
+ protected $description = 'Generate REVERB_APP_ID, REVERB_APP_KEY, and REVERB_APP_SECRET and insert them into the .env file';
+
+ /**
+ * Execute the console command.
+ */
+ public function handle() {
+ $reverbAppId = random_int(100000, 999999);
+ $reverbAppKey = bin2hex(random_bytes(16));
+ $reverbAppSecret = bin2hex(random_bytes(16));
+
+ $this->setEnvironmentValue('REVERB_APP_ID', $reverbAppId);
+ $this->setEnvironmentValue('REVERB_APP_KEY', $reverbAppKey);
+ $this->setEnvironmentValue('REVERB_APP_SECRET', $reverbAppSecret);
+
+ $this->info('Reverb keys generated and updated in .env file.');
+ }
+
+ // Helper method to set the values in the .env file
+ protected function setEnvironmentValue($key, $value) {
+ $envPath = base_path('.env');
+
+ if (! file_exists($envPath)) {
+ return;
+ }
+
+ $content = file_get_contents($envPath);
+ $pattern = "/^$key=[^\n]*/m";
+ $replacement = "$key=$value";
+
+ $newContent = preg_replace($pattern, $replacement, $content);
+
+ if ($newContent !== null) {
+ file_put_contents($envPath, $newContent);
+ }
+ }
+}
diff --git a/bootstrap/cache/packages.php b/bootstrap/cache/packages.php
index 84c55e0f..0576bfe9 100755
--- a/bootstrap/cache/packages.php
+++ b/bootstrap/cache/packages.php
@@ -138,14 +138,14 @@
),
'pbmedia/laravel-ffmpeg' =>
array (
- 'providers' =>
- array (
- 0 => 'ProtoneMedia\\LaravelFFMpeg\\Support\\ServiceProvider',
- ),
'aliases' =>
array (
'FFMpeg' => 'ProtoneMedia\\LaravelFFMpeg\\Support\\FFMpeg',
),
+ 'providers' =>
+ array (
+ 0 => 'ProtoneMedia\\LaravelFFMpeg\\Support\\ServiceProvider',
+ ),
),
'robertogallea/pulse-api' =>
array (
diff --git a/package-lock.json b/package-lock.json
index c119068f..b4da8ef0 100755
--- a/package-lock.json
+++ b/package-lock.json
@@ -51,7 +51,7 @@
"eslint": "^9.14.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-vue": "^9.30.0",
- "laravel-echo": "^1.17.1",
+ "laravel-echo": "^1.19.0",
"laravel-vite-plugin": "^1.0.0",
"postcss": "^8.4.47",
"prettier": "3.3.3",
@@ -4316,9 +4316,9 @@
"license": "MIT"
},
"node_modules/laravel-echo": {
- "version": "1.18.0",
- "resolved": "https://registry.npmjs.org/laravel-echo/-/laravel-echo-1.18.0.tgz",
- "integrity": "sha512-aIeADT+vk8kFN7OliK5gcOiLVmtZUGqJ2bnc4/NoHZYYBkV9h+Sy+Ksictp6uBqKDMm3WlYMdpK+XP31YWvXtQ==",
+ "version": "1.19.0",
+ "resolved": "https://registry.npmjs.org/laravel-echo/-/laravel-echo-1.19.0.tgz",
+ "integrity": "sha512-o/X4XH8BIRwij66PSjtotZfM88Z8g/4P3gzxQf2BTcZBKmGqucvI5JYYLprR2OZQ9XlGsmJ2v+hDpPGEbXwUWw==",
"dev": true,
"license": "MIT",
"engines": {
diff --git a/package.json b/package.json
index 7dfc3d6b..fa88ec19 100755
--- a/package.json
+++ b/package.json
@@ -29,8 +29,8 @@
},
"devDependencies": {
"@7nohe/laravel-typegen": "^0.6.1",
- "@eslint/js": "^9.7.0",
"@eslint/compat": "^1.2.0",
+ "@eslint/js": "^9.7.0",
"@iconify-json/circum": "^1.1.11",
"@iconify-json/lucide": "^1.1.202",
"@iconify-json/majesticons": "^1.2.1",
@@ -58,13 +58,13 @@
"eslint": "^9.14.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-vue": "^9.30.0",
- "laravel-echo": "^1.17.1",
+ "laravel-echo": "^1.19.0",
"laravel-vite-plugin": "^1.0.0",
"postcss": "^8.4.47",
"prettier": "3.3.3",
"pusher-js": "^8.4.0-rc2",
- "tailwindcss": "^3.4.13",
"tailwind-scrollbar-hide": "^1.1.7",
+ "tailwindcss": "^3.4.13",
"typescript": "~5.6.3",
"unplugin-icons": "^0.19.0",
"vite": "^5.0.0",
diff --git a/resources/js/echo.ts b/resources/js/echo.ts
index 9b67f53a..3e48cd58 100644
--- a/resources/js/echo.ts
+++ b/resources/js/echo.ts
@@ -1,5 +1,4 @@
import Pusher from 'pusher-js';
-import Echo from 'laravel-echo';
window.Pusher = Pusher;
diff --git a/setup.bat b/setup.bat
index e28b39fb..d3490f3b 100644
--- a/setup.bat
+++ b/setup.bat
@@ -1,31 +1,28 @@
@echo off
-setlocal EnableDelayedExpansion
-
-:: Exit immediately if a command exits with a non-zero status
-set -e
:: Pull the latest changes from the repository
git pull
-:: Install Node.js dependencies
-npm install
+echo Install Node.js dependencies
+npm i
-:: Install Composer dependencies
-composer install
+echo Installing Composer (PHP) dependencies
+composer i
-:: Copy the example environment configuration file
+echo Setup environment variables
copy .env.example .env
-:: Generate a new application key
+echo Setup Laravel app key
php artisan key:generate
-:: Build frontend assets
+echo Setup Reverb app keys
+php artisan reverb:generate
+
+echo Build Frontend
npm run build
-:: Install broadcasting dependencies
-php artisan install:broadcasting
-echo "Setup a database connection in the .env file and then run 'php artisan migrate'"
+echo Setup a database connection in the .env file and then run 'php artisan migrate'
+echo Finally run 'npm run vite:php' to start the queue and websocket servers in addition to your web server (nginx)
-endlocal
@echo on
diff --git a/setup.sh b/setup.sh
index 4dc00cd9..6dcd861c 100644
--- a/setup.sh
+++ b/setup.sh
@@ -5,15 +5,23 @@ set -e
git pull
+echo "Installing Node.js dependencies"
npm i
+
+echo "Installing Composer (PHP) dependencies"
composer install
+echo "Setup environment variables"
cp .env.example .env
+echo "Setup Laravel app key"
php artisan key:generate
-npm run build
+echo "Setup Reverb app keys"
+php artisan reverb:generate
-php artisan install:broadcasting
+echo "Build Frontend"
+npm run build
-echo "Setup a database connection in the .env file and then run php artisan migrate"
+echo "Setup a database connection in the .env file and then run 'php artisan migrate'"
+echo "Finally run 'npm run vite:php' to start the queue and websocket servers in addition to your web server (nginx)"