refactor: Update ServerSeeder and PopulateSshKeysDirectorySeeder

This commit is contained in:
Andras Bacsai
2024-09-20 17:28:55 +02:00
parent fa375e2fd8
commit be42f15711
4 changed files with 84 additions and 113 deletions

View File

@@ -23,7 +23,13 @@ class PopulateSshKeysDirectorySeeder extends Seeder
} }
}); });
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/keys'));
Process::run('chown -R 9999:9999 '.storage_path('app/ssh/mux')); Process::run('chown -R 9999:9999 '.storage_path('app/ssh/mux'));
} }
} }
}

View File

@@ -2,6 +2,8 @@
namespace Database\Seeders; namespace Database\Seeders;
use App\Enums\ProxyStatus;
use App\Enums\ProxyTypes;
use App\Models\Server; use App\Models\Server;
use Illuminate\Database\Seeder; use Illuminate\Database\Seeder;
@@ -16,6 +18,10 @@ class ServerSeeder extends Seeder
'ip' => 'coolify-testing-host', 'ip' => 'coolify-testing-host',
'team_id' => 0, 'team_id' => 0,
'private_key_id' => 1, 'private_key_id' => 1,
'proxy' => [
'type' => ProxyTypes::TRAEFIK->value,
'status' => ProxyStatus::EXITED->value,
],
]); ]);
} }
} }

View File

@@ -27,27 +27,24 @@
$database->getMorphClass() === 'App\Models\StandaloneMongodb' || $database->getMorphClass() === 'App\Models\StandaloneMongodb' ||
$database->getMorphClass() === 'App\Models\StandaloneMysql' || $database->getMorphClass() === 'App\Models\StandaloneMysql' ||
$database->getMorphClass() === 'App\Models\StandaloneMariadb') $database->getMorphClass() === 'App\Models\StandaloneMariadb')
<a class="{{ request()->routeIs('project.database.backup.index') ? 'dark:text-white' : '' }}" href="{{ route('project.database.backup.index', $parameters) }}"> <a class="{{ request()->routeIs('project.database.backup.index') ? 'dark:text-white' : '' }}"
href="{{ route('project.database.backup.index', $parameters) }}">
<button>Backups</button> <button>Backups</button>
</a> </a>
@endif @endif
</nav> </nav>
<div class="flex flex-wrap gap-2 items-center"> <div class="flex flex-wrap gap-2 items-center">
@if (!str($database->status)->startsWith('exited')) @if (!str($database->status)->startsWith('exited'))
<x-modal-confirmation <x-modal-confirmation title="Confirm Database Restart?" buttonTitle="Restart" submitAction="restart"
title="Confirm Database Restart?" :actions="[
buttonTitle="Restart" 'This database will be unavailable during the restart.',
submitAction="restart" 'If the database is currently in use data could be lost.',
: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"
:confirmWithText="false" :dispatchEvent="true" dispatchEventType="restartEvent">
:confirmWithPassword="false"
step2ButtonText="Restart Database"
:dispatchEvent="true"
dispatchEventType="restartEvent"
>
<x-slot:button-title> <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"> <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"> <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="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" /> <path d="M20 4v5h-5" />
</g> </g>
@@ -55,21 +52,17 @@
Restart Restart
</x-slot:button-title> </x-slot:button-title>
</x-modal-confirmation> </x-modal-confirmation>
<x-modal-confirmation <x-modal-confirmation title="Confirm Database Stopping?" buttonTitle="Stop" submitAction="stop"
title="Confirm Database Stopping?" :checkboxes="$checkboxes" :actions="[
buttonTitle="Stop" 'This database will be stopped.',
submitAction="stop" 'If the database is currently in use data could be lost.',
:checkboxes="$checkboxes" '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).',
: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"
:confirmWithText="false" step2ButtonText="Stop Database" :dispatchEvent="true" dispatchEventType="stopEvent">
:confirmWithPassword="false"
step1ButtonText="Continue Stopping Database"
step2ButtonText="Stop Database"
:dispatchEvent="true"
dispatchEventType="stopEvent"
>
<x-slot:button-title> <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"> <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 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 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>
@@ -81,7 +74,9 @@
</x-modal-confirmation> </x-modal-confirmation>
@else @else
<button @click="$wire.dispatch('startEvent')" class="gap-2 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"> <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 stroke="none" d="M0 0h24v24H0z" fill="none" />
<path d="M7 4v16l13 -8z" /> <path d="M7 4v16l13 -8z" />
</svg> </svg>

View File

@@ -20,47 +20,14 @@ function help {
compgen -A function | cat -n 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 { function test {
docker exec -t coolify php artisan test --testsuite=Feature docker exec -t coolify php artisan test --testsuite=Feature
} }
function sync:bunny { function sync:bunny {
php artisan sync:bunny --env=secrets 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 { function db:reset {
bash spin exec -u webuser coolify php artisan migrate:fresh --seed 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 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 { function default {
help help
} }