wip: scheduled backups
fix: file locations vendor unlocking
This commit is contained in:
parent
46909dca85
commit
d18de24cf9
@ -12,17 +12,17 @@ class StartPostgresql
|
|||||||
public StandalonePostgresql $database;
|
public StandalonePostgresql $database;
|
||||||
public array $commands = [];
|
public array $commands = [];
|
||||||
public array $init_scripts = [];
|
public array $init_scripts = [];
|
||||||
public string $base_dir;
|
public string $configuration_dir;
|
||||||
|
|
||||||
public function __invoke(Server $server, StandalonePostgresql $database)
|
public function __invoke(Server $server, StandalonePostgresql $database)
|
||||||
{
|
{
|
||||||
$this->database = $database;
|
$this->database = $database;
|
||||||
$container_name = generate_container_name($this->database->uuid);
|
$container_name = generate_container_name($this->database->uuid);
|
||||||
$this->base_dir = '/data/coolify/databases/' . $container_name;
|
$this->configuration_dir = database_configuration_dir() . '/' . $container_name;
|
||||||
|
|
||||||
$this->commands = [
|
$this->commands = [
|
||||||
"mkdir -p $this->base_dir",
|
"mkdir -p $this->configuration_dir",
|
||||||
"mkdir -p $this->base_dir/docker-entrypoint-initdb.d/"
|
"mkdir -p $this->configuration_dir/docker-entrypoint-initdb.d/"
|
||||||
];
|
];
|
||||||
|
|
||||||
$persistent_storages = $this->generate_local_persistent_volumes();
|
$persistent_storages = $this->generate_local_persistent_volumes();
|
||||||
@ -92,8 +92,10 @@ class StartPostgresql
|
|||||||
}
|
}
|
||||||
$docker_compose = Yaml::dump($docker_compose, 10);
|
$docker_compose = Yaml::dump($docker_compose, 10);
|
||||||
$docker_compose_base64 = base64_encode($docker_compose);
|
$docker_compose_base64 = base64_encode($docker_compose);
|
||||||
$this->commands[] = "echo '{$docker_compose_base64}' | base64 -d > $this->base_dir/docker-compose.yml";
|
$this->commands[] = "echo '{$docker_compose_base64}' | base64 -d > $this->configuration_dir/docker-compose.yml";
|
||||||
$this->commands[] = "docker compose -f $this->base_dir/docker-compose.yml up -d";
|
$readme = generate_readme_file($this->database->name, now());
|
||||||
|
$this->commands[] = "echo '{$readme}' > $this->configuration_dir/README.md";
|
||||||
|
$this->commands[] = "docker compose -f $this->configuration_dir/docker-compose.yml up -d";
|
||||||
return remote_process($this->commands, $server);
|
return remote_process($this->commands, $server);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,8 +157,8 @@ class StartPostgresql
|
|||||||
$filename = data_get($init_script, 'filename');
|
$filename = data_get($init_script, 'filename');
|
||||||
$content = data_get($init_script, 'content');
|
$content = data_get($init_script, 'content');
|
||||||
$content_base64 = base64_encode($content);
|
$content_base64 = base64_encode($content);
|
||||||
$this->commands[] = "echo '{$content_base64}' | base64 -d > $this->base_dir/docker-entrypoint-initdb.d/{$filename}";
|
$this->commands[] = "echo '{$content_base64}' | base64 -d > $this->configuration_dir/docker-entrypoint-initdb.d/{$filename}";
|
||||||
$this->init_scripts[] = "$this->base_dir/docker-entrypoint-initdb.d/{$filename}";
|
$this->init_scripts[] = "$this->configuration_dir/docker-entrypoint-initdb.d/{$filename}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,6 @@ class ApplicationController extends Controller
|
|||||||
if (!$application) {
|
if (!$application) {
|
||||||
return redirect()->route('dashboard');
|
return redirect()->route('dashboard');
|
||||||
}
|
}
|
||||||
ray($application->persistentStorages()->get());
|
|
||||||
return view('project.application.configuration', ['application' => $application]);
|
return view('project.application.configuration', ['application' => $application]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,6 +78,9 @@ class General extends Component
|
|||||||
$this->emit('error', 'Filename already exists.');
|
$this->emit('error', 'Filename already exists.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!isset($this->database->init_scripts)) {
|
||||||
|
$this->database->init_scripts = [];
|
||||||
|
}
|
||||||
$this->database->init_scripts = array_merge($this->database->init_scripts, [
|
$this->database->init_scripts = array_merge($this->database->init_scripts, [
|
||||||
[
|
[
|
||||||
'index' => count($this->database->init_scripts),
|
'index' => count($this->database->init_scripts),
|
||||||
|
@ -15,13 +15,13 @@ use App\Models\SwarmDocker;
|
|||||||
use App\Notifications\Application\DeploymentFailed;
|
use App\Notifications\Application\DeploymentFailed;
|
||||||
use App\Notifications\Application\DeploymentSuccess;
|
use App\Notifications\Application\DeploymentSuccess;
|
||||||
use App\Traits\ExecuteRemoteCommand;
|
use App\Traits\ExecuteRemoteCommand;
|
||||||
|
use Exception;
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Foundation\Bus\Dispatchable;
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Illuminate\Support\Facades\Storage;
|
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Spatie\Url\Url;
|
use Spatie\Url\Url;
|
||||||
use Symfony\Component\Yaml\Yaml;
|
use Symfony\Component\Yaml\Yaml;
|
||||||
@ -51,6 +51,7 @@ class ApplicationDeploymentJob implements ShouldQueue
|
|||||||
|
|
||||||
private string $container_name;
|
private string $container_name;
|
||||||
private string $workdir;
|
private string $workdir;
|
||||||
|
private string $configuration_dir;
|
||||||
private string $build_workdir;
|
private string $build_workdir;
|
||||||
private string $build_image_name;
|
private string $build_image_name;
|
||||||
private string $production_image_name;
|
private string $production_image_name;
|
||||||
@ -58,6 +59,7 @@ class ApplicationDeploymentJob implements ShouldQueue
|
|||||||
private $build_args;
|
private $build_args;
|
||||||
private $env_args;
|
private $env_args;
|
||||||
private $docker_compose;
|
private $docker_compose;
|
||||||
|
private $docker_compose_base64;
|
||||||
|
|
||||||
private $log_model;
|
private $log_model;
|
||||||
private Collection $saved_outputs;
|
private Collection $saved_outputs;
|
||||||
@ -78,9 +80,9 @@ class ApplicationDeploymentJob implements ShouldQueue
|
|||||||
$this->source = $this->application->source->getMorphClass()::where('id', $this->application->source->id)->first();
|
$this->source = $this->application->source->getMorphClass()::where('id', $this->application->source->id)->first();
|
||||||
$this->destination = $this->application->destination->getMorphClass()::where('id', $this->application->destination->id)->first();
|
$this->destination = $this->application->destination->getMorphClass()::where('id', $this->application->destination->id)->first();
|
||||||
$this->server = $this->destination->server;
|
$this->server = $this->destination->server;
|
||||||
$this->private_key_location = save_private_key_for_server($this->server);
|
|
||||||
|
|
||||||
$this->workdir = "/artifacts/{$this->deployment_uuid}";
|
$this->workdir = "/artifacts/{$this->deployment_uuid}";
|
||||||
|
$this->configuration_dir = application_configuration_dir() . "/{$this->application->uuid}";
|
||||||
$this->build_workdir = "{$this->workdir}" . rtrim($this->application->base_directory, '/');
|
$this->build_workdir = "{$this->workdir}" . rtrim($this->application->base_directory, '/');
|
||||||
$this->is_debug_enabled = $this->application->settings->is_debug_enabled;
|
$this->is_debug_enabled = $this->application->settings->is_debug_enabled;
|
||||||
|
|
||||||
@ -122,12 +124,23 @@ class ApplicationDeploymentJob implements ShouldQueue
|
|||||||
}
|
}
|
||||||
if ($this->application->fqdn) dispatch(new ProxyStartJob($this->server));
|
if ($this->application->fqdn) dispatch(new ProxyStartJob($this->server));
|
||||||
$this->next(ApplicationDeploymentStatus::FINISHED->value);
|
$this->next(ApplicationDeploymentStatus::FINISHED->value);
|
||||||
} catch (\Exception $e) {
|
} catch (Exception $e) {
|
||||||
ray($e);
|
ray($e);
|
||||||
$this->fail($e);
|
$this->fail($e);
|
||||||
} finally {
|
} finally {
|
||||||
if (isset($this->docker_compose)) {
|
if (isset($this->docker_compose_base64)) {
|
||||||
Storage::disk('deployments')->put(Str::kebab($this->application->name) . '/docker-compose.yml', $this->docker_compose);
|
$readme = generate_readme_file($this->application->name, $this->application_deployment_queue->updated_at);
|
||||||
|
$this->execute_remote_command(
|
||||||
|
[
|
||||||
|
"mkdir -p $this->configuration_dir"
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"echo '{$this->docker_compose_base64}' | base64 -d > $this->configuration_dir/docker-compose.yml",
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"echo '{$readme}' > $this->configuration_dir/README.md",
|
||||||
|
]
|
||||||
|
);
|
||||||
}
|
}
|
||||||
$this->execute_remote_command(
|
$this->execute_remote_command(
|
||||||
[
|
[
|
||||||
@ -135,7 +148,6 @@ class ApplicationDeploymentJob implements ShouldQueue
|
|||||||
"hidden" => true,
|
"hidden" => true,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
// ray()->measure();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -368,8 +380,8 @@ class ApplicationDeploymentJob implements ShouldQueue
|
|||||||
$docker_compose['volumes'] = $volume_names;
|
$docker_compose['volumes'] = $volume_names;
|
||||||
}
|
}
|
||||||
$this->docker_compose = Yaml::dump($docker_compose, 10);
|
$this->docker_compose = Yaml::dump($docker_compose, 10);
|
||||||
$docker_compose_base64 = base64_encode($this->docker_compose);
|
$this->docker_compose_base64 = base64_encode($this->docker_compose);
|
||||||
$this->execute_remote_command([$this->execute_in_builder("echo '{$docker_compose_base64}' | base64 -d > {$this->workdir}/docker-compose.yml"), "hidden" => true]);
|
$this->execute_remote_command([$this->execute_in_builder("echo '{$this->docker_compose_base64}' | base64 -d > {$this->workdir}/docker-compose.yml"), "hidden" => true]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function generate_local_persistent_volumes()
|
private function generate_local_persistent_volumes()
|
||||||
@ -591,7 +603,7 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf");
|
|||||||
$tag = Str::of("{$this->commit}-{$this->application->id}-{$this->pull_request_id}");
|
$tag = Str::of("{$this->commit}-{$this->application->id}-{$this->pull_request_id}");
|
||||||
if (strlen($tag) > 128) {
|
if (strlen($tag) > 128) {
|
||||||
$tag = $tag->substr(0, 128);
|
$tag = $tag->substr(0, 128);
|
||||||
};
|
}
|
||||||
|
|
||||||
$this->build_image_name = "{$this->application->git_repository}:{$tag}-build";
|
$this->build_image_name = "{$this->application->git_repository}:{$tag}-build";
|
||||||
$this->production_image_name = "{$this->application->uuid}:{$tag}";
|
$this->production_image_name = "{$this->application->uuid}:{$tag}";
|
||||||
|
@ -2,23 +2,66 @@
|
|||||||
|
|
||||||
namespace App\Jobs;
|
namespace App\Jobs;
|
||||||
|
|
||||||
|
use App\Models\ScheduledDatabaseBackup;
|
||||||
|
use App\Models\Server;
|
||||||
|
use App\Models\StandalonePostgresql;
|
||||||
|
use App\Models\Team;
|
||||||
|
use Carbon\Carbon;
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||||
use Illuminate\Foundation\Bus\Dispatchable;
|
use Illuminate\Foundation\Bus\Dispatchable;
|
||||||
use Illuminate\Queue\InteractsWithQueue;
|
use Illuminate\Queue\InteractsWithQueue;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
class BackupDatabaseJob implements ShouldQueue
|
class BackupDatabaseJob implements ShouldQueue
|
||||||
{
|
{
|
||||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||||
|
|
||||||
public function __construct(public $backup)
|
public Team|null $team = null;
|
||||||
|
public Server $server;
|
||||||
|
public ScheduledDatabaseBackup|null $backup;
|
||||||
|
public string $database_type;
|
||||||
|
public StandalonePostgresql $database;
|
||||||
|
public string $status;
|
||||||
|
|
||||||
|
public function __construct($backup)
|
||||||
{
|
{
|
||||||
|
$this->backup = $backup;
|
||||||
|
$this->team = Team::find($backup->team_id);
|
||||||
|
$this->database = $this->backup->database->first();
|
||||||
|
$this->database_type = $this->database->type();
|
||||||
|
$this->server = $this->database->destination->server;
|
||||||
|
$this->status = $this->database->status;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
ray('BackupDatabaseJob');
|
if ($this->status !== 'running') {
|
||||||
ray($this->backup);
|
ray('database not running');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if ($this->database_type === 'standalone-postgresql') {
|
||||||
|
$this->backup_standalone_postgresql();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private function backup_standalone_postgresql()
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$backup_filename = backup_dir() . "/{$this->database->uuid}/dumpall-" . Carbon::now()->timestamp . ".sql";
|
||||||
|
$commands[] = "mkdir -p " . backup_dir();
|
||||||
|
$commands[] = "mkdir -p " . backup_dir() . "/{$this->database->uuid}";
|
||||||
|
$commands[] = "docker exec {$this->database->uuid} pg_dumpall -U {$this->database->postgres_user} > $backup_filename";
|
||||||
|
instant_remote_process($commands, $this->server);
|
||||||
|
ray('Backup done for ' . $this->database->uuid . ' at ' . $this->server->name . ':' . $backup_filename);
|
||||||
|
if (!$this->backup->keep_locally) {
|
||||||
|
$commands[] = "rm -rf $backup_filename";
|
||||||
|
instant_remote_process($commands, $this->server);
|
||||||
|
}
|
||||||
|
} catch (Throwable $th) {
|
||||||
|
ray($th);
|
||||||
|
//throw $th;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,5 +30,4 @@ class S3Storage extends BaseModel
|
|||||||
set_s3_target($this);
|
set_s3_target($this);
|
||||||
return \Storage::disk('custom-s3')->files();
|
return \Storage::disk('custom-s3')->files();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ class StandalonePostgresql extends BaseModel
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function type()
|
public function type(): string
|
||||||
{
|
{
|
||||||
return 'standalone-postgresql';
|
return 'standalone-postgresql';
|
||||||
}
|
}
|
||||||
|
@ -83,4 +83,9 @@ class Team extends Model implements SendsDiscord, SendsEmail
|
|||||||
$sources = $sources->merge($github_apps)->merge($gitlab_apps);
|
$sources = $sources->merge($github_apps)->merge($gitlab_apps);
|
||||||
return $sources;
|
return $sources;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function s3()
|
||||||
|
{
|
||||||
|
return $this->hasOne(S3Storage::class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,19 @@ use Illuminate\Support\Facades\Route;
|
|||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Visus\Cuid2\Cuid2;
|
use Visus\Cuid2\Cuid2;
|
||||||
|
|
||||||
|
function application_configuration_dir() :string {
|
||||||
|
return '/data/coolify/applications';
|
||||||
|
}
|
||||||
|
function database_configuration_dir(): string {
|
||||||
|
return '/data/coolify/databases';
|
||||||
|
}
|
||||||
|
function backup_dir(): string {
|
||||||
|
return '/data/coolify/backups';
|
||||||
|
}
|
||||||
|
function generate_readme_file(string $name, string $updated_at): string {
|
||||||
|
return "Resource name: {$name}\nLatest Deployment Date: {$updated_at}";
|
||||||
|
}
|
||||||
|
|
||||||
function general_error_handler(\Throwable|null $err = null, $that = null, $isJson = false, $customErrorMessage = null)
|
function general_error_handler(\Throwable|null $err = null, $that = null, $isJson = false, $customErrorMessage = null)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
@ -62,6 +62,12 @@ return [
|
|||||||
'visibility' => 'private',
|
'visibility' => 'private',
|
||||||
'throw' => false,
|
'throw' => false,
|
||||||
],
|
],
|
||||||
|
'backups' => [
|
||||||
|
'driver' => 'local',
|
||||||
|
'root' => storage_path('app/backups'),
|
||||||
|
'visibility' => 'private',
|
||||||
|
'throw' => false,
|
||||||
|
],
|
||||||
|
|
||||||
's3' => [
|
's3' => [
|
||||||
'driver' => 's3',
|
'driver' => 's3',
|
||||||
|
@ -10,6 +10,8 @@ return new class extends Migration {
|
|||||||
Schema::create('scheduled_database_backups', function (Blueprint $table) {
|
Schema::create('scheduled_database_backups', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->boolean('enabled')->default(true);
|
$table->boolean('enabled')->default(true);
|
||||||
|
$table->boolean('keep_locally')->default(true);
|
||||||
|
$table->string('save_s3')->default(true);
|
||||||
$table->string('frequency');
|
$table->string('frequency');
|
||||||
$table->morphs('database');
|
$table->morphs('database');
|
||||||
$table->foreignId('team_id');
|
$table->foreignId('team_id');
|
||||||
|
@ -32,6 +32,7 @@ class DatabaseSeeder extends Seeder
|
|||||||
LocalPersistentVolumeSeeder::class,
|
LocalPersistentVolumeSeeder::class,
|
||||||
S3StorageSeeder::class,
|
S3StorageSeeder::class,
|
||||||
StandalonePostgresqlSeeder::class,
|
StandalonePostgresqlSeeder::class,
|
||||||
|
ScheduledDatabaseBackupSeeder::class
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,22 +13,11 @@ class ScheduledDatabaseBackupSeeder extends Seeder
|
|||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
ScheduledDatabaseBackup::create([
|
ScheduledDatabaseBackup::create([
|
||||||
|
'enabled' => true,
|
||||||
'frequency' => '* * * * *',
|
'frequency' => '* * * * *',
|
||||||
'database_id' => 1,
|
'database_id' => 1,
|
||||||
'database_type' => 'App\Models\StandalonePostgresql',
|
'database_type' => 'App\Models\StandalonePostgresql',
|
||||||
'team_id' => 0,
|
'team_id' => 0,
|
||||||
]);
|
]);
|
||||||
ScheduledDatabaseBackup::create([
|
|
||||||
'frequency' => '*/2 * * * *',
|
|
||||||
'database_id' => 1,
|
|
||||||
'database_type' => 'App\Models\StandalonePostgresql',
|
|
||||||
'team_id' => 0,
|
|
||||||
]);
|
|
||||||
ScheduledDatabaseBackup::create([
|
|
||||||
'frequency' => '*/3 * * * *',
|
|
||||||
'database_id' => 1,
|
|
||||||
'database_type' => 'App\Models\StandalonePostgresql',
|
|
||||||
'team_id' => 0,
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,13 +17,6 @@ class StandalonePostgresqlSeeder extends Seeder
|
|||||||
'environment_id' => 1,
|
'environment_id' => 1,
|
||||||
'destination_id' => 1,
|
'destination_id' => 1,
|
||||||
'destination_type' => StandaloneDocker::class,
|
'destination_type' => StandaloneDocker::class,
|
||||||
'init_scripts' => [
|
|
||||||
[
|
|
||||||
'index' => 0,
|
|
||||||
'filename' => 'init_test_db.sql',
|
|
||||||
'content' => 'CREATE DATABASE test;'
|
|
||||||
]
|
|
||||||
]
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,13 +54,13 @@ services:
|
|||||||
container_name: coolify-testing-host
|
container_name: coolify-testing-host
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
- "./_data/coolify/testing-local-docker-container/proxy:/data/coolify/proxy"
|
- "./_data/_servers/testing-local-docker-container:/data/coolify"
|
||||||
testing-host-2:
|
testing-host-2:
|
||||||
<<: *testing-host-base
|
<<: *testing-host-base
|
||||||
container_name: coolify-testing-host-2
|
container_name: coolify-testing-host-2
|
||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
- "./_data/coolify/testing-local-docker-container-2/proxy:/data/coolify/proxy"
|
- "./_data/_servers/testing-local-docker-container-2:/data/coolify"
|
||||||
mailpit:
|
mailpit:
|
||||||
image: "axllent/mailpit:latest"
|
image: "axllent/mailpit:latest"
|
||||||
container_name: coolify-mail
|
container_name: coolify-mail
|
||||||
|
@ -8,7 +8,9 @@ services:
|
|||||||
target: /var/www/html/.env
|
target: /var/www/html/.env
|
||||||
read_only: true
|
read_only: true
|
||||||
- /data/coolify/ssh:/var/www/html/storage/app/ssh
|
- /data/coolify/ssh:/var/www/html/storage/app/ssh
|
||||||
- /data/coolify/deployments:/var/www/html/storage/app/deployments
|
- /data/coolify/applications:/var/www/html/storage/app/applications
|
||||||
|
- /data/coolify/databases:/var/www/html/storage/app/databases
|
||||||
|
- /data/coolify/backups:/var/www/html/storage/app/backups
|
||||||
environment:
|
environment:
|
||||||
- APP_ID
|
- APP_ID
|
||||||
- APP_ENV=production
|
- APP_ENV=production
|
||||||
|
@ -64,7 +64,7 @@
|
|||||||
<x-forms.button class="btn" onclick="newInitScript.showModal()">+ Add</x-forms.button>
|
<x-forms.button class="btn" onclick="newInitScript.showModal()">+ Add</x-forms.button>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col gap-2">
|
<div class="flex flex-col gap-2">
|
||||||
@forelse(data_get($database,'init_scripts') as $script)
|
@forelse(data_get($database,'init_scripts', []) as $script)
|
||||||
<livewire:project.database.init-script :script="$script" :wire:key="$script['index']"/>
|
<livewire:project.database.init-script :script="$script" :wire:key="$script['index']"/>
|
||||||
@empty
|
@empty
|
||||||
<div>No initialization scripts found.</div>
|
<div>No initialization scripts found.</div>
|
||||||
|
@ -12,7 +12,7 @@ CDN="https://cdn.coollabs.io/coolify"
|
|||||||
OS_TYPE=$(cat /etc/os-release | grep -w "ID" | cut -d "=" -f 2 | tr -d '"')
|
OS_TYPE=$(cat /etc/os-release | grep -w "ID" | cut -d "=" -f 2 | tr -d '"')
|
||||||
OS_VERSION=$(cat /etc/os-release | grep -w "VERSION_ID" | cut -d "=" -f 2 | tr -d '"')
|
OS_VERSION=$(cat /etc/os-release | grep -w "VERSION_ID" | cut -d "=" -f 2 | tr -d '"')
|
||||||
LATEST_VERSION=$(curl --silent $CDN/versions.json | grep -i version | sed -n '2p' | xargs | awk '{print $2}' | tr -d ',')
|
LATEST_VERSION=$(curl --silent $CDN/versions.json | grep -i version | sed -n '2p' | xargs | awk '{print $2}' | tr -d ',')
|
||||||
DATE=$(date +"%Y%m%d-%H%M%S")
|
DATE=$(date +"%Y%m%d-%H%M%S")
|
||||||
|
|
||||||
if [ $EUID != 0 ]; then
|
if [ $EUID != 0 ]; then
|
||||||
echo "Please run as root"
|
echo "Please run as root"
|
||||||
@ -84,7 +84,6 @@ fi
|
|||||||
|
|
||||||
echo -e "-------------"
|
echo -e "-------------"
|
||||||
|
|
||||||
mkdir -p /data/coolify/deployments
|
|
||||||
mkdir -p /data/coolify/ssh/keys
|
mkdir -p /data/coolify/ssh/keys
|
||||||
mkdir -p /data/coolify/ssh/mux
|
mkdir -p /data/coolify/ssh/mux
|
||||||
mkdir -p /data/coolify/source
|
mkdir -p /data/coolify/source
|
||||||
|
Loading…
x
Reference in New Issue
Block a user