commit
ff7fccb6a2
@ -41,35 +41,39 @@ class Backup extends Component
|
|||||||
}
|
}
|
||||||
public function add_coolify_database()
|
public function add_coolify_database()
|
||||||
{
|
{
|
||||||
$server = Server::find(0);
|
try {
|
||||||
$out = instant_remote_process(['docker inspect coolify-db'], $server);
|
$server = Server::findOrFail(0);
|
||||||
$envs = format_docker_envs_to_json($out);
|
$out = instant_remote_process(['docker inspect coolify-db'], $server);
|
||||||
$postgres_password = $envs['POSTGRES_PASSWORD'];
|
$envs = format_docker_envs_to_json($out);
|
||||||
$postgres_user = $envs['POSTGRES_USER'];
|
$postgres_password = $envs['POSTGRES_PASSWORD'];
|
||||||
$postgres_db = $envs['POSTGRES_DB'];
|
$postgres_user = $envs['POSTGRES_USER'];
|
||||||
$this->database = StandalonePostgresql::create([
|
$postgres_db = $envs['POSTGRES_DB'];
|
||||||
'id' => 0,
|
$this->database = StandalonePostgresql::create([
|
||||||
'name' => 'coolify-db',
|
'id' => 0,
|
||||||
'description' => 'Coolify database',
|
'name' => 'coolify-db',
|
||||||
'postgres_user' => $postgres_user,
|
'description' => 'Coolify database',
|
||||||
'postgres_password' => $postgres_password,
|
'postgres_user' => $postgres_user,
|
||||||
'postgres_db' => $postgres_db,
|
'postgres_password' => $postgres_password,
|
||||||
'status' => 'running',
|
'postgres_db' => $postgres_db,
|
||||||
'destination_type' => 'App\Models\StandaloneDocker',
|
'status' => 'running',
|
||||||
'destination_id' => 0,
|
'destination_type' => 'App\Models\StandaloneDocker',
|
||||||
]);
|
'destination_id' => 0,
|
||||||
$this->backup = ScheduledDatabaseBackup::create([
|
]);
|
||||||
'id' => 0,
|
$this->backup = ScheduledDatabaseBackup::create([
|
||||||
'enabled' => true,
|
'id' => 0,
|
||||||
'save_s3' => false,
|
'enabled' => true,
|
||||||
'frequency' => '0 0 * * *',
|
'save_s3' => false,
|
||||||
'database_id' => $this->database->id,
|
'frequency' => '0 0 * * *',
|
||||||
'database_type' => 'App\Models\StandalonePostgresql',
|
'database_id' => $this->database->id,
|
||||||
'team_id' => currentTeam()->id,
|
'database_type' => 'App\Models\StandalonePostgresql',
|
||||||
]);
|
'team_id' => currentTeam()->id,
|
||||||
$this->database->refresh();
|
]);
|
||||||
$this->backup->refresh();
|
$this->database->refresh();
|
||||||
$this->s3s = S3Storage::whereTeamId(0)->get();
|
$this->backup->refresh();
|
||||||
|
$this->s3s = S3Storage::whereTeamId(0)->get();
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
return handleError($e, $this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function backup_now()
|
public function backup_now()
|
||||||
|
@ -621,7 +621,6 @@ class Application extends BaseModel
|
|||||||
$commands->push("cd {$baseDir} && git fetch origin {$branch} && $git_checkout_command");
|
$commands->push("cd {$baseDir} && git fetch origin {$branch} && $git_checkout_command");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ray($commands);
|
|
||||||
return [
|
return [
|
||||||
'commands' => $commands->implode(' && '),
|
'commands' => $commands->implode(' && '),
|
||||||
'branch' => $branch,
|
'branch' => $branch,
|
||||||
|
@ -29,7 +29,7 @@ function generate_github_installation_token(GithubApp $source)
|
|||||||
'Accept' => 'application/vnd.github.machine-man-preview+json'
|
'Accept' => 'application/vnd.github.machine-man-preview+json'
|
||||||
])->post("{$source->api_url}/app/installations/{$source->installation_id}/access_tokens");
|
])->post("{$source->api_url}/app/installations/{$source->installation_id}/access_tokens");
|
||||||
if ($token->failed()) {
|
if ($token->failed()) {
|
||||||
throw new RuntimeException("Failed to get access token for " . $source->name . " with error: " . $token->json()['message']);
|
throw new RuntimeException("Failed to get access token for " . $source->name . " with error: " . data_get($token->json(),'message','no error message found'));
|
||||||
}
|
}
|
||||||
return $token->json()['token'];
|
return $token->json()['token'];
|
||||||
}
|
}
|
||||||
|
@ -7,11 +7,10 @@ use App\Models\Application;
|
|||||||
use App\Models\ApplicationDeploymentQueue;
|
use App\Models\ApplicationDeploymentQueue;
|
||||||
use App\Models\PrivateKey;
|
use App\Models\PrivateKey;
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
use App\Notifications\Server\Revived;
|
|
||||||
use App\Notifications\Server\Unreachable;
|
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
use Illuminate\Support\Facades\Hash;
|
||||||
use Illuminate\Support\Facades\Process;
|
use Illuminate\Support\Facades\Process;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
@ -135,7 +134,6 @@ function generateSshCommand(Server $server, string $command)
|
|||||||
$connectionTimeout = config('constants.ssh.connection_timeout');
|
$connectionTimeout = config('constants.ssh.connection_timeout');
|
||||||
$serverInterval = config('constants.ssh.server_interval');
|
$serverInterval = config('constants.ssh.server_interval');
|
||||||
|
|
||||||
$delimiter = 'EOF-COOLIFY-SSH';
|
|
||||||
$ssh_command = "timeout $timeout ssh ";
|
$ssh_command = "timeout $timeout ssh ";
|
||||||
|
|
||||||
if (config('coolify.mux_enabled') && config('coolify.is_windows_docker_desktop') == false) {
|
if (config('coolify.mux_enabled') && config('coolify.is_windows_docker_desktop') == false) {
|
||||||
@ -145,6 +143,9 @@ function generateSshCommand(Server $server, string $command)
|
|||||||
$ssh_command .= '-o ProxyCommand="/usr/local/bin/cloudflared access ssh --hostname %h" ';
|
$ssh_command .= '-o ProxyCommand="/usr/local/bin/cloudflared access ssh --hostname %h" ';
|
||||||
}
|
}
|
||||||
$command = "PATH=\$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/host/usr/local/sbin:/host/usr/local/bin:/host/usr/sbin:/host/usr/bin:/host/sbin:/host/bin && $command";
|
$command = "PATH=\$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/host/usr/local/sbin:/host/usr/local/bin:/host/usr/sbin:/host/usr/bin:/host/sbin:/host/bin && $command";
|
||||||
|
|
||||||
|
$delimiter = Hash::make($command);
|
||||||
|
$command = str_replace($delimiter, '', $command);
|
||||||
$ssh_command .= "-i {$privateKeyLocation} "
|
$ssh_command .= "-i {$privateKeyLocation} "
|
||||||
. '-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null '
|
. '-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null '
|
||||||
. '-o PasswordAuthentication=no '
|
. '-o PasswordAuthentication=no '
|
||||||
@ -158,6 +159,7 @@ function generateSshCommand(Server $server, string $command)
|
|||||||
. $command . PHP_EOL
|
. $command . PHP_EOL
|
||||||
. $delimiter;
|
. $delimiter;
|
||||||
// ray($ssh_command);
|
// ray($ssh_command);
|
||||||
|
ray($delimiter);
|
||||||
return $ssh_command;
|
return $ssh_command;
|
||||||
}
|
}
|
||||||
function instant_remote_process(Collection|array $command, Server $server, $throwError = true)
|
function instant_remote_process(Collection|array $command, Server $server, $throwError = true)
|
||||||
|
@ -7,7 +7,7 @@ return [
|
|||||||
|
|
||||||
// The release version of your application
|
// The release version of your application
|
||||||
// Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD'))
|
// Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD'))
|
||||||
'release' => '4.0.0-beta.252',
|
'release' => '4.0.0-beta.253',
|
||||||
// When left empty or `null` the Laravel environment will be used
|
// When left empty or `null` the Laravel environment will be used
|
||||||
'environment' => config('app.env'),
|
'environment' => config('app.env'),
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
return '4.0.0-beta.252';
|
return '4.0.0-beta.253';
|
||||||
|
@ -0,0 +1,29 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::table('applications', function (Blueprint $table) {
|
||||||
|
$table->text('custom_docker_run_options')->nullable()->change();
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('applications', function (Blueprint $table) {
|
||||||
|
$table->string('custom_docker_run_options')->nullable()->change();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"coolify": {
|
"coolify": {
|
||||||
"v4": {
|
"v4": {
|
||||||
"version": "4.0.0-beta.252"
|
"version": "4.0.0-beta.253"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user