Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

refactor: Update ServerSeeder and PopulateSshKeysDirectorySeeder

Andras Bacsaibe42f15711d2
diff --git a/database/seeders/PopulateSshKeysDirectorySeeder.php b/database/seeders/PopulateSshKeysDirectorySeeder.php
index 77ec1cf3bf..a097505e59 100644
--- a/database/seeders/PopulateSshKeysDirectorySeeder.php
+++ b/database/seeders/PopulateSshKeysDirectorySeeder.php
@@ -23,7 +23,13 @@ class PopulateSshKeysDirectorySeeder extends Seeder
}
});
- Process::run('chown -R 9999:9999 '.storage_path('app/ssh/keys'));
- Process::run('chown -R 9999:9999 '.storage_path('app/ssh/mux'));
+ if (isDev()) {
+ $user = env('PUID').':'.env('PGID');
+ Process::run("chown -R $user ".storage_path('app/ssh/keys'));
+ Process::run("chown -R $user ".storage_path('app/ssh/mux'));
+ } else {
+ Process::run('chown -R 9999:9999 '.storage_path('app/ssh/keys'));
+ Process::run('chown -R 9999:9999 '.storage_path('app/ssh/mux'));
+ }
}
}
diff --git a/database/seeders/ServerSeeder.php b/database/seeders/ServerSeeder.php
index 197a0b5cb0..d328431071 100644
--- a/database/seeders/ServerSeeder.php
+++ b/database/seeders/ServerSeeder.php
@@ -2,6 +2,8 @@
namespace Database\Seeders;
+use App\Enums\ProxyStatus;
+use App\Enums\ProxyTypes;
use App\Models\Server;
use Illuminate\Database\Seeder;
@@ -16,6 +18,10 @@ class ServerSeeder extends Seeder
'ip' => 'coolify-testing-host',
'team_id' => 0,
'private_key_id' => 1,
+ 'proxy' => [
+ 'type' => ProxyTypes::TRAEFIK->value,
+ 'status' => ProxyStatus::EXITED->value,
+ ],
]);
}
}
diff --git a/resources/views/livewire/project/database/heading.blade.php b/resources/views/livewire/project/database/heading.blade.php
index acc26774a4..8265ca7725 100644
--- a/resources/views/livewire/project/database/heading.blade.php
+++ b/resources/views/livewire/project/database/heading.blade.php
@@ -23,87 +23,82 @@
<button>Terminal</button>
</a>
@if (
- $database->getMorphClass() === 'App\Models\StandalonePostgresql' ||
- $database->getMorphClass() === 'App\Models\StandaloneMongodb' ||
- $database->getMorphClass() === 'App\Models\StandaloneMysql' ||
- $database->getMorphClass() === 'App\Models\StandaloneMariadb')
- <a class="{{ request()->routeIs('project.database.backup.index') ? 'dark:text-white' : '' }}" href="{{ route('project.database.backup.index', $parameters) }}">
- <button>Backups</button>
- </a>
+ $database->getMorphClass() === 'App\Models\StandalonePostgresql' ||
+ $database->getMorphClass() === 'App\Models\StandaloneMongodb' ||
+ $database->getMorphClass() === 'App\Models\StandaloneMysql' ||
+ $database->getMorphClass() === 'App\Models\StandaloneMariadb')
+ <a class="{{ request()->routeIs('project.database.backup.index') ? 'dark:text-white' : '' }}"
+ href="{{ route('project.database.backup.index', $parameters) }}">
+ <button>Backups</button>
+ </a>
@endif
</nav>
<div class="flex flex-wrap gap-2 items-center">
@if (!str($database->status)->startsWith('exited'))
- <x-modal-confirmation
- title="Confirm Database Restart?"
- buttonTitle="Restart"
- submitAction="restart"
- :actions="['This database will be unavailable during the restart.', 'If the database is currently in use data could be lost.']"
- :confirmWithText="false"
- :confirmWithPassword="false"
- step2ButtonText="Restart Database"
- :dispatchEvent="true"
- dispatchEventType="restartEvent"
- >
- <x-slot:button-title>
- <svg class="w-5 h-5 dark:text-warning" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
- <g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2">
- <path d="M19.933 13.041a8 8 0 1 1-9.925-8.788c3.899-1 7.935 1.007 9.425 4.747" />
- <path d="M20 4v5h-5" />
- </g>
- </svg>
- Restart
- </x-slot:button-title>
- </x-modal-confirmation>
- <x-modal-confirmation
- title="Confirm Database Stopping?"
- buttonTitle="Stop"
- submitAction="stop"
- :checkboxes="$checkboxes"
- :actions="['This database will be stopped.', 'If the database is currently in use data could be lost.', 'All non-persistent data of this database (containers, networks, unused images) will be deleted (don\'t worry, no data is lost and you can start the database again).']"
- :confirmWithText="false"
- :confirmWithPassword="false"
- step1ButtonText="Continue Stopping Database"
- step2ButtonText="Stop Database"
- :dispatchEvent="true"
- dispatchEventType="stopEvent"
- >
- <x-slot:button-title>
- <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-error" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
- <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
- <path d="M6 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">
- </path>
- <path d="M14 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">
- </path>
- </svg>
- Stop
- </x-slot:button-title>
- </x-modal-confirmation>
+ <x-modal-confirmation title="Confirm Database Restart?" buttonTitle="Restart" submitAction="restart"
+ :actions="[
+ 'This database will be unavailable during the restart.',
+ 'If the database is currently in use data could be lost.',
+ ]" :confirmWithText="false" :confirmWithPassword="false" step2ButtonText="Restart Database"
+ :dispatchEvent="true" dispatchEventType="restartEvent">
+ <x-slot:button-title>
+ <svg class="w-5 h-5 dark:text-warning" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
+ <g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"
+ stroke-width="2">
+ <path d="M19.933 13.041a8 8 0 1 1-9.925-8.788c3.899-1 7.935 1.007 9.425 4.747" />
+ <path d="M20 4v5h-5" />
+ </g>
+ </svg>
+ Restart
+ </x-slot:button-title>
+ </x-modal-confirmation>
+ <x-modal-confirmation title="Confirm Database Stopping?" buttonTitle="Stop" submitAction="stop"
+ :checkboxes="$checkboxes" :actions="[
+ 'This database will be stopped.',
+ 'If the database is currently in use data could be lost.',
+ 'All non-persistent data of this database (containers, networks, unused images) will be deleted (don\'t worry, no data is lost and you can start the database again).',
+ ]" :confirmWithText="false" :confirmWithPassword="false" step1ButtonText="Continue"
+ step2ButtonText="Stop Database" :dispatchEvent="true" dispatchEventType="stopEvent">
+ <x-slot:button-title>
+ <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 text-error" viewBox="0 0 24 24"
+ stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round"
+ stroke-linejoin="round">
+ <path stroke="none" d="M0 0h24v24H0z" fill="none"></path>
+ <path d="M6 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">
+ </path>
+ <path d="M14 5m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v12a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z">
+ </path>
+ </svg>
+ Stop
+ </x-slot:button-title>
+ </x-modal-confirmation>
@else
- <button @click="$wire.dispatch('startEvent')" class="gap-2 button">
- <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 dark:text-warning" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
- <path stroke="none" d="M0 0h24v24H0z" fill="none" />
- <path d="M7 4v16l13 -8z" />
- </svg>
- Start
- </button>
+ <button @click="$wire.dispatch('startEvent')" class="gap-2 button">
+ <svg xmlns="http://www.w3.org/2000/svg" class="w-5 h-5 dark:text-warning" viewBox="0 0 24 24"
+ stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round"
+ stroke-linejoin="round">
+ <path stroke="none" d="M0 0h24v24H0z" fill="none" />
+ <path d="M7 4v16l13 -8z" />
+ </svg>
+ Start
+ </button>
@endif
@script
- <script>
- $wire.$on('startEvent', () => {
- window.dispatchEvent(new CustomEvent('startdatabase'));
- $wire.$call('start');
- });
- $wire.$on('stopEvent', () => {
- $wire.$dispatch('info', 'Stopping database.');
- $wire.$call('stop');
- });
- $wire.$on('restartEvent', () => {
- $wire.$dispatch('info', 'Restarting database.');
- $wire.$call('restart');
- });
- </script>
+ <script>
+ $wire.$on('startEvent', () => {
+ window.dispatchEvent(new CustomEvent('startdatabase'));
+ $wire.$call('start');
+ });
+ $wire.$on('stopEvent', () => {
+ $wire.$dispatch('info', 'Stopping database.');
+ $wire.$call('stop');
+ });
+ $wire.$on('restartEvent', () => {
+ $wire.$dispatch('info', 'Restarting database.');
+ $wire.$call('restart');
+ });
+ </script>
@endscript
</div>
</div>
-</nav>
\ No newline at end of file
+</nav>
diff --git a/scripts/run b/scripts/run
index 24aa2ac397..f8ac0f97df 100755
--- a/scripts/run
+++ b/scripts/run
@@ -20,47 +20,14 @@ function help {
compgen -A function | cat -n
}
-# function sync:v3 {
-# if [ -z "$1" ]; then
-# echo -e "Please provide a version.\n\nExample: run sync:v3 3.12.32"
-# exit 1
-# fi
-# skopeo copy --all docker://ghcr.io/coollabsio/coolify:$1 docker://coollabsio/coolify:$1
-# }
function test {
docker exec -t coolify php artisan test --testsuite=Feature
}
+
function sync:bunny {
php artisan sync:bunny --env=secrets
}
-# function queue {
-# bash spin exec -u webuser coolify php artisan queue:listen
-# }
-
-# function horizon {
-# bash spin exec -u webuser coolify php artisan horizon -vvv
-# }
-
-# function schedule {
-# bash spin exec -u webuser coolify php artisan schedule:work
-# }
-
-# function schedule:run {
-# bash spin exec -u webuser coolify php artisan schedule:run
-# }
-
-# function db {
-# bash spin exec -u webuser coolify php artisan db
-# }
-# function db:seed {
-# bash spin exec -u webuser coolify php artisan migrate --seed
-# }
-
-# function db:migrate {
-# bash spin exec -u webuser coolify php artisan migrate --step
-# }
-
function db:reset {
bash spin exec -u webuser coolify php artisan migrate:fresh --seed
}
@@ -96,9 +63,6 @@ function tinker {
bash spin exec -u webuser coolify php artisan tinker
}
-# function build:helper {
-# act -W .github/workflows/coolify-helper.yml --secret-file .env.secrets
-# }
function default {
help
}