Skip to content

A self-hosted media server and file management system

use single env and set reverb key from mounted env file

aminnausin5a95fd7558cb
diff --git a/.github/workflows/build-beta.yml b/.github/workflows/build-beta.yml
index e7300c76..8d8eac3a 100644
--- a/.github/workflows/build-beta.yml
+++ b/.github/workflows/build-beta.yml
@@ -37,11 +37,11 @@ jobs:
- name: Zip Files Linux
run: |
- zip -r mediaServerDockerLinux.zip ./docker/etc ./docker/.env.docker ./docker-compose.yaml ./startDocker.sh ./README.md
+ zip -r mediaServerDockerLinuxBeta.zip ./docker/etc ./docker/.env.docker ./docker-compose.yaml ./startDocker.sh ./README.md ./data/avatars
- name: Zip Files Windows
run: |
- zip -r mediaServerDockerWindows.zip ./docker/etc ./docker/.env.docker ./docker-compose.yaml ./startDocker.bat ./README.md
+ zip -r mediaServerDockerWindowsBeta.zip ./docker/etc ./docker/.env.docker ./docker-compose.yaml ./startDocker.bat ./README.md ./data/avatars
- name: Create Release
uses: ncipollo/release-action@v1
with:
@@ -51,4 +51,4 @@ jobs:
name: Beta Release
draft: false
prerelease: false
- artifacts: mediaServerDockerLinux.zip,mediaServerDockerWindows.zip
+ artifacts: mediaServerDockerLinuxBeta.zip,mediaServerDockerWindowsBeta.zip
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index d1f83a29..91e887de 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -34,11 +34,11 @@ jobs:
- name: Zip Files Linux
run: |
- zip -r mediaServerDockerLinux.zip ./docker/etc ./docker/.env.docker ./docker-compose.yaml ./startDocker.sh ./README.md
+ zip -r mediaServerDockerLinux.zip ./docker/etc ./docker/.env.docker ./docker-compose.yaml ./startDocker.sh ./README.md ./data/avatars
- name: Zip Files Windows
run: |
- zip -r mediaServerDockerWindows.zip ./docker/etc ./docker/.env.docker ./docker-compose.yaml ./startDocker.bat ./README.md
+ zip -r mediaServerDockerWindows.zip ./docker/etc ./docker/.env.docker ./docker-compose.yaml ./startDocker.bat ./README.md ./data/avatars
- name: Create Release
uses: ncipollo/release-action@v1
with:
diff --git a/app/Console/Commands/GenerateReverbKeys.php b/app/Console/Commands/GenerateReverbKeys.php
index 89ed47ff..e4e1976e 100644
--- a/app/Console/Commands/GenerateReverbKeys.php
+++ b/app/Console/Commands/GenerateReverbKeys.php
@@ -10,27 +10,27 @@ class GenerateReverbKeys extends Command {
*
* @var string
*/
- protected $signature = 'reverb:generate {--env-file=.env}';
+ 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 specified .env file';
+ 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() {
- $envPath = base_path($this->option('env-file'));
+ $envPath = base_path('.env');
if (! file_exists($envPath)) {
- $this->error("The specified env file ($envPath) does not exist.");
+ $this->error("The env file ($envPath) does not exist.");
return false;
}
- if ($this->keysExist($envPath)) {
+ if ($this->keysExist()) {
$this->info('Reverb keys already exist.');
return false;
}
@@ -43,8 +43,7 @@ class GenerateReverbKeys extends Command {
$this->setEnvironmentValue('REVERB_APP_KEY', $reverbAppKey, $envPath);
$this->setEnvironmentValue('REVERB_APP_SECRET', $reverbAppSecret, $envPath);
- $this->info("Reverb keys generated and updated in $envPath.");
- return true;
+ $this->info('Reverb keys generated and updated in .env file.');
}
// Helper method to set the values in the .env file
@@ -53,8 +52,6 @@ class GenerateReverbKeys extends Command {
$pattern = "/^$key=[^\n]*/m";
$replacement = "$key=$value";
- // $newContent = preg_replace($pattern, $replacement, $content);
-
if (preg_match($pattern, $content)) {
$newContent = preg_replace($pattern, $replacement, $content);
} else {
@@ -66,15 +63,10 @@ class GenerateReverbKeys extends Command {
}
}
- protected function keysExist($envPath) {
- $envContent = file_get_contents($envPath);
- // $reverbAppId = (int) env('REVERB_APP_ID');
- // $reverbAppKey = env('REVERB_APP_KEY', '');
- // $reverbAppSecret = env('REVERB_APP_SECRET', '');
-
- $reverbAppId = (int) preg_match("/^REVERB_APP_ID=\d{6}$/m", $envContent);
- $reverbAppKey = preg_match("/^REVERB_APP_KEY=[a-f0-9]{32}$/m", $envContent);
- $reverbAppSecret = preg_match("/^REVERB_APP_SECRET=[a-f0-9]{32}$/m", $envContent);
+ protected function keysExist() {
+ $reverbAppId = (int) env('REVERB_APP_ID');
+ $reverbAppKey = env('REVERB_APP_KEY', '');
+ $reverbAppSecret = env('REVERB_APP_SECRET', '');
if ($reverbAppId < 100000 || $reverbAppId > 999999) {
return false;
diff --git a/app/Http/Controllers/DirectoryController.php b/app/Http/Controllers/DirectoryController.php
index d4804033..a0ba039a 100755
--- a/app/Http/Controllers/DirectoryController.php
+++ b/app/Http/Controllers/DirectoryController.php
@@ -424,7 +424,7 @@ class DirectoryController extends Controller {
try {
broadcast(new TaskEnded($task));
} catch (\Throwable $th) {
- Log::error($th->getMessage(), TaskStatus::from($status));
+ Log::error("Unable to broadcast task ended", $th->getMessage());
}
})->before(function (Batch $batch) use ($task) {
$this->taskService->updateTask($task->id, [
diff --git a/docker/.env.docker b/docker/.env.docker
index 9d76d016..0f67de05 100644
--- a/docker/.env.docker
+++ b/docker/.env.docker
@@ -7,6 +7,8 @@ APP_PORT=8086 # App Port -> Website will be available on 127
REVERB_PORT=6001 # Websocket Port -> Set to 6001 if you have websocket connection issues
REVERB_SCHEME=http # Websocket Protocol -> http OR https -> Set to HTTPS if you have a valid SSL Certificate for your URL
+APP_ENV=local # App Environment -> change to staging if you are using a valid domain or production server
+
DB_HOST=database
DB_PORT=5432
DB_DATABASE=mediaServer
@@ -21,7 +23,6 @@ DOCKER_RELEASE=latest
APP_NAME=mediaServer
-APP_ENV=staging
APP_KEY=
APP_DEBUG=false
APP_TIMEZONE=UTC
@@ -63,29 +64,6 @@ QUEUE_CONNECTION=database
CACHE_DRIVER=file
CACHE_STORE=database
-CACHE_PREFIX=
-
-MEMCACHED_HOST=127.0.0.1
-
-REDIS_CLIENT=phpredis
-REDIS_HOST=127.0.0.1
-REDIS_PASSWORD=null
-REDIS_PORT=6379
-
-MAIL_MAILER=log
-MAIL_HOST=127.0.0.1
-MAIL_PORT=2525
-MAIL_USERNAME=null
-MAIL_PASSWORD=null
-MAIL_ENCRYPTION=null
-MAIL_FROM_ADDRESS="[email protected]"
-MAIL_FROM_NAME="${APP_NAME}"
-
-AWS_ACCESS_KEY_ID=
-AWS_SECRET_ACCESS_KEY=
-AWS_DEFAULT_REGION=us-east-1
-AWS_BUCKET=
-AWS_USE_PATH_STYLE_ENDPOINT=false
VITE_APP_NAME="${APP_NAME}"
VITE_BASE_URL="${APP_URL}"
diff --git a/docker/entrypoint.d/keys.sh b/docker/entrypoint.d/keys.sh
index dab5bc55..296f9e10 100644
--- a/docker/entrypoint.d/keys.sh
+++ b/docker/entrypoint.d/keys.sh
@@ -11,12 +11,10 @@ else
echo "APP_KEY already set, skipping key generation."
fi
-if [ -f "/var/www/html/.env.docker" ]; then
- php artisan reverb:generate --env-file=".env.docker"
+php artisan reverb:generate
-else
- php artisan reverb:generate
-fi
+# else
+ # php artisan reverb:generate
# echo "Waiting for PostgreSQL to be ready..."