Merge branch 'next' into feat/deployment-token
This commit is contained in:
22
database/factories/ApplicationFactory.php
Normal file
22
database/factories/ApplicationFactory.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class ApplicationFactory extends Factory
|
||||
{
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => fake()->unique()->name(),
|
||||
'destination_id' => 1,
|
||||
'git_repository' => fake()->url(),
|
||||
'git_branch' => fake()->word(),
|
||||
'build_pack' => 'nixpacks',
|
||||
'ports_exposes' => '3000',
|
||||
'environment_id' => 1,
|
||||
'destination_id' => 1,
|
||||
];
|
||||
}
|
||||
}
|
||||
17
database/factories/ServerFactory.php
Normal file
17
database/factories/ServerFactory.php
Normal file
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class ServerFactory extends Factory
|
||||
{
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => fake()->unique()->name(),
|
||||
'ip' => fake()->unique()->ipv4(),
|
||||
'private_key_id' => 1,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ use App\Models\Server;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Visus\Cuid2\Cuid2;
|
||||
|
||||
@@ -52,7 +53,7 @@ return new class extends Migration
|
||||
|
||||
DB::table('server_settings')->update(['metrics_history_days' => 7]);
|
||||
} catch (\Exception $e) {
|
||||
loggy($e);
|
||||
Log::error('Error updating db: '.$e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?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->longText('custom_nginx_configuration')->nullable()->after('static_image');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('applications', function (Blueprint $table) {
|
||||
$table->dropColumn('custom_nginx_configuration');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class AddIndexToActivityLog extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
try {
|
||||
DB::statement('ALTER TABLE activity_log ALTER COLUMN properties TYPE jsonb USING properties::jsonb');
|
||||
DB::statement('CREATE INDEX idx_activity_type_uuid ON activity_log USING GIN (properties jsonb_path_ops)');
|
||||
} catch (\Exception $e) {
|
||||
Log::error('Error adding index to activity_log: '.$e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
try {
|
||||
DB::statement('DROP INDEX IF EXISTS idx_activity_type_uuid');
|
||||
DB::statement('ALTER TABLE activity_log ALTER COLUMN properties TYPE json USING properties::json');
|
||||
} catch (\Exception $e) {
|
||||
Log::error('Error dropping index from activity_log: '.$e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('teams', function (Blueprint $table) {
|
||||
$table->boolean('slack_enabled')->default(false);
|
||||
$table->string('slack_webhook_url')->nullable();
|
||||
$table->boolean('slack_notifications_test')->default(true);
|
||||
$table->boolean('slack_notifications_deployments')->default(true);
|
||||
$table->boolean('slack_notifications_status_changes')->default(true);
|
||||
$table->boolean('slack_notifications_database_backups')->default(true);
|
||||
$table->boolean('slack_notifications_scheduled_tasks')->default(true);
|
||||
$table->boolean('slack_notifications_server_disk_usage')->default(true);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('teams', function (Blueprint $table) {
|
||||
$table->dropColumn([
|
||||
'slack_enabled',
|
||||
'slack_webhook_url',
|
||||
'slack_notifications_test',
|
||||
'slack_notifications_deployments',
|
||||
'slack_notifications_status_changes',
|
||||
'slack_notifications_database_backups',
|
||||
'slack_notifications_scheduled_tasks',
|
||||
'slack_notifications_server_disk_usage',
|
||||
]);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('application_settings', function (Blueprint $table) {
|
||||
$table->boolean('disable_build_cache')->default(false);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('application_settings', function (Blueprint $table) {
|
||||
$table->dropColumn('disable_build_cache');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -23,6 +23,7 @@ class GithubAppSeeder extends Seeder
|
||||
GithubApp::create([
|
||||
'name' => 'coolify-laravel-development-public',
|
||||
'uuid' => '69420',
|
||||
'organization' => 'coollabsio',
|
||||
'api_url' => 'https://api.github.com',
|
||||
'html_url' => 'https://github.com',
|
||||
'is_public' => false,
|
||||
|
||||
@@ -24,9 +24,8 @@ 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'));
|
||||
Process::run('chown -R 9999:9999 '.storage_path('app/ssh/keys'));
|
||||
Process::run('chown -R 9999:9999 '.storage_path('app/ssh/mux'));
|
||||
} else {
|
||||
Process::run('chown -R 9999:root '.storage_path('app/ssh/keys'));
|
||||
Process::run('chown -R 9999:root '.storage_path('app/ssh/mux'));
|
||||
|
||||
@@ -22,9 +22,9 @@ class ProductionSeeder extends Seeder
|
||||
public function run(): void
|
||||
{
|
||||
if (isCloud()) {
|
||||
echo "Running in cloud mode.\n";
|
||||
echo "[x]: Running in cloud mode.\n";
|
||||
} else {
|
||||
echo "Running in self-hosted mode.\n";
|
||||
echo "[x]: Running in self-hosted mode.\n";
|
||||
}
|
||||
|
||||
// Fix for 4.0.0-beta.37
|
||||
@@ -100,7 +100,7 @@ class ProductionSeeder extends Seeder
|
||||
}
|
||||
}
|
||||
|
||||
if (! isCloud() && config('coolify.is_windows_docker_desktop') == false) {
|
||||
if (! isCloud() && config('constants.coolify.is_windows_docker_desktop') == false) {
|
||||
$coolify_key_name = '@host.docker.internal';
|
||||
$ssh_keys_directory = Storage::disk('ssh-keys')->files();
|
||||
$coolify_key = collect($ssh_keys_directory)->firstWhere(fn ($item) => str($item)->contains($coolify_key_name));
|
||||
@@ -127,7 +127,7 @@ class ProductionSeeder extends Seeder
|
||||
}
|
||||
}
|
||||
}
|
||||
if (config('coolify.is_windows_docker_desktop')) {
|
||||
if (config('constants.coolify.is_windows_docker_desktop')) {
|
||||
PrivateKey::updateOrCreate(
|
||||
[
|
||||
'id' => 0,
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace Database\Seeders;
|
||||
|
||||
use App\Models\Server;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class SentinelSeeder extends Seeder
|
||||
{
|
||||
@@ -13,17 +14,17 @@ class SentinelSeeder extends Seeder
|
||||
foreach ($servers as $server) {
|
||||
try {
|
||||
if (str($server->settings->sentinel_token)->isEmpty()) {
|
||||
$server->settings->generateSentinelToken();
|
||||
$server->settings->generateSentinelToken(ignoreEvent: true);
|
||||
}
|
||||
if (str($server->settings->sentinel_custom_url)->isEmpty()) {
|
||||
$url = $server->settings->generateSentinelUrl();
|
||||
$url = $server->settings->generateSentinelUrl(ignoreEvent: true);
|
||||
if (str($url)->isEmpty()) {
|
||||
$server->settings->is_sentinel_enabled = false;
|
||||
$server->settings->save();
|
||||
}
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
loggy("Error: {$e->getMessage()}\n");
|
||||
Log::error('Error seeding sentinel: '.$e->getMessage());
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user