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.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
feat(database): add sqlite as a standalone database type
peaklabs-deva33fd9a36e8f
diff --git a/app/Enums/NewDatabaseTypes.php b/app/Enums/NewDatabaseTypes.phpindex 3563146ff1..8ab3682598 100644--- a/app/Enums/NewDatabaseTypes.php+++ b/app/Enums/NewDatabaseTypes.php@@ -12,4 +12,5 @@ enum NewDatabaseTypes: stringcase KEYDB = 'keydb';case DRAGONFLY = 'dragonfly';case CLICKHOUSE = 'clickhouse';+ case SQLITE = 'sqlite';}diff --git a/app/Enums/NewResourceTypes.php b/app/Enums/NewResourceTypes.phpindex d806a46ed0..4fee12e131 100644--- a/app/Enums/NewResourceTypes.php+++ b/app/Enums/NewResourceTypes.php@@ -19,4 +19,5 @@ enum NewResourceTypes: stringcase KEYDB = 'keydb';case DRAGONFLY = 'dragonfly';case CLICKHOUSE = 'clickhouse';+ case SQLITE = 'sqlite';}diff --git a/app/Livewire/Project/Service/FileStorage.php b/app/Livewire/Project/Service/FileStorage.phpindex cd209f6ae9..9ad6e4d2f4 100644--- a/app/Livewire/Project/Service/FileStorage.php+++ b/app/Livewire/Project/Service/FileStorage.php@@ -15,6 +15,7 @@ use App\Models\StandaloneMongodb;use App\Models\StandaloneMysql;use App\Models\StandalonePostgresql;use App\Models\StandaloneRedis;+use App\Models\StandaloneSqlite;use Illuminate\Foundation\Auth\Access\AuthorizesRequests;use Livewire\Attributes\On;use Livewire\Attributes\Validate;@@ -26,7 +27,7 @@ class FileStorage extends Componentpublic LocalFileVolume $fileStorage;- public ServiceApplication|StandaloneRedis|StandalonePostgresql|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|StandaloneKeydb|StandaloneDragonfly|StandaloneClickhouse|ServiceDatabase|Application $resource;+ public ServiceApplication|StandaloneRedis|StandalonePostgresql|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|StandaloneKeydb|StandaloneDragonfly|StandaloneClickhouse|StandaloneSqlite|ServiceDatabase|Application $resource;public string $fs_path;diff --git a/app/Livewire/Project/Shared/ConfigurationChecker.php b/app/Livewire/Project/Shared/ConfigurationChecker.phpindex fb3360c184..fd6e7f618e 100644--- a/app/Livewire/Project/Shared/ConfigurationChecker.php+++ b/app/Livewire/Project/Shared/ConfigurationChecker.php@@ -12,6 +12,7 @@ use App\Models\StandaloneMongodb;use App\Models\StandaloneMysql;use App\Models\StandalonePostgresql;use App\Models\StandaloneRedis;+use App\Models\StandaloneSqlite;use Illuminate\Contracts\View\View;use Livewire\Component;@@ -25,7 +26,7 @@ class ConfigurationChecker extends Componentpublic array $missingRequiredEnvironmentVariableNames = [];- public Application|Service|StandaloneRedis|StandalonePostgresql|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|StandaloneKeydb|StandaloneDragonfly|StandaloneClickhouse $resource;+ public Application|Service|StandaloneRedis|StandalonePostgresql|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|StandaloneKeydb|StandaloneDragonfly|StandaloneClickhouse|StandaloneSqlite $resource;public function getListeners(): array{diff --git a/app/Livewire/Project/Shared/Danger.php b/app/Livewire/Project/Shared/Danger.phpindex 7fb477fd6c..e9b3cffa22 100644--- a/app/Livewire/Project/Shared/Danger.php+++ b/app/Livewire/Project/Shared/Danger.php@@ -72,7 +72,8 @@ class Danger extends Component'standalone-mariadb','standalone-keydb','standalone-dragonfly',- 'standalone-clickhouse' => $this->resource->name ?? 'Database',+ 'standalone-clickhouse',+ 'standalone-sqlite' => $this->resource->name ?? 'Database','service' => $this->resource->name ?? 'Service','service-application' => $this->resource->name ?? 'Service Application','service-database' => $this->resource->name ?? 'Service Database',diff --git a/app/Livewire/Project/Shared/GetLogs.php b/app/Livewire/Project/Shared/GetLogs.phpindex 3da0c75876..6a1d3b8760 100644--- a/app/Livewire/Project/Shared/GetLogs.php+++ b/app/Livewire/Project/Shared/GetLogs.php@@ -16,6 +16,7 @@ use App\Models\StandaloneMongodb;use App\Models\StandaloneMysql;use App\Models\StandalonePostgresql;use App\Models\StandaloneRedis;+use App\Models\StandaloneSqlite;use App\Support\ValidationPatterns;use Illuminate\Foundation\Auth\Access\AuthorizesRequests;use Illuminate\Support\Facades\Process;@@ -37,7 +38,7 @@ class GetLogs extends Componentpublic string $errors = '';#[Locked]- public Application|Service|StandalonePostgresql|StandaloneRedis|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|StandaloneKeydb|StandaloneDragonfly|StandaloneClickhouse|null $resource = null;+ public Application|Service|StandalonePostgresql|StandaloneRedis|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|StandaloneKeydb|StandaloneDragonfly|StandaloneClickhouse|StandaloneSqlite|null $resource = null;#[Locked]public ServiceApplication|ServiceDatabase|null $servicesubtype = null;diff --git a/app/Livewire/Project/Shared/Logs.php b/app/Livewire/Project/Shared/Logs.phpindex 24306a7bcd..2b7c21836a 100644--- a/app/Livewire/Project/Shared/Logs.php+++ b/app/Livewire/Project/Shared/Logs.php@@ -12,6 +12,7 @@ use App\Models\StandaloneMongodb;use App\Models\StandaloneMysql;use App\Models\StandalonePostgresql;use App\Models\StandaloneRedis;+use App\Models\StandaloneSqlite;use Illuminate\Support\Collection;use Livewire\Component;@@ -19,7 +20,7 @@ class Logs extends Component{public ?string $type = null;- public Application|Service|StandalonePostgresql|StandaloneRedis|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|StandaloneKeydb|StandaloneDragonfly|StandaloneClickhouse $resource;+ public Application|Service|StandalonePostgresql|StandaloneRedis|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|StandaloneKeydb|StandaloneDragonfly|StandaloneClickhouse|StandaloneSqlite $resource;public Collection $servers;diff --git a/app/Models/Environment.php b/app/Models/Environment.phpindex e98f13d21f..0120461040 100644--- a/app/Models/Environment.php+++ b/app/Models/Environment.php@@ -64,6 +64,7 @@ class Environment extends BaseModel$this->clickhouses()->count() == 0 &&$this->mariadbs()->count() == 0 &&$this->mongodbs()->count() == 0 &&+ $this->sqlites()->count() == 0 &&$this->services()->count() == 0;}@@ -117,6 +118,11 @@ class Environment extends BaseModelreturn $this->hasMany(StandaloneClickhouse::class);}+ public function sqlites()+ {+ return $this->hasMany(StandaloneSqlite::class);+ }+public function databases(){$postgresqls = $this->postgresqls;@@ -127,8 +133,9 @@ class Environment extends BaseModel$keydbs = $this->keydbs;$dragonflies = $this->dragonflies;$clickhouses = $this->clickhouses;+ $sqlites = $this->sqlites;- return $postgresqls->concat($redis)->concat($mongodbs)->concat($mysqls)->concat($mariadbs)->concat($keydbs)->concat($dragonflies)->concat($clickhouses);+ return $postgresqls->concat($redis)->concat($mongodbs)->concat($mysqls)->concat($mariadbs)->concat($keydbs)->concat($dragonflies)->concat($clickhouses)->concat($sqlites);}public function project()diff --git a/app/Models/Project.php b/app/Models/Project.phpindex 65c21c1e78..7df5ecad50 100644--- a/app/Models/Project.php+++ b/app/Models/Project.php@@ -130,6 +130,11 @@ class Project extends BaseModelreturn $this->hasManyThrough(StandaloneClickhouse::class, Environment::class);}+ public function sqlites()+ {+ return $this->hasManyThrough(StandaloneSqlite::class, Environment::class);+ }+public function mongodbs(){return $this->hasManyThrough(StandaloneMongodb::class, Environment::class);@@ -156,6 +161,7 @@ class Project extends BaseModel$this->clickhouses()->count() == 0 &&$this->mariadbs()->count() == 0 &&$this->mongodbs()->count() == 0 &&+ $this->sqlites()->count() == 0 &&$this->services()->count() == 0;}@@ -168,7 +174,8 @@ class Project extends BaseModel->concat($this->mariadbs()->with($with)->get())->concat($this->keydbs()->with($with)->get())->concat($this->dragonflies()->with($with)->get())- ->concat($this->clickhouses()->with($with)->get());+ ->concat($this->clickhouses()->with($with)->get())+ ->concat($this->sqlites()->with($with)->get());}public function navigateTo()diff --git a/app/Models/Server.php b/app/Models/Server.phpindex 20952d5598..8268d44c9b 100644--- a/app/Models/Server.php+++ b/app/Models/Server.php@@ -1194,6 +1194,7 @@ $siteAddress {$keydbs = StandaloneKeydb::where($destinationCondition)->get();$dragonflies = StandaloneDragonfly::where($destinationCondition)->get();$clickhouses = StandaloneClickhouse::where($destinationCondition)->get();+ $sqlites = StandaloneSqlite::where($destinationCondition)->get();return $postgresqls->concat($redis)@@ -1203,6 +1204,7 @@ $siteAddress {->concat($keydbs)->concat($dragonflies)->concat($clickhouses)+ ->concat($sqlites)->filter(fn ($item) => data_get($item, 'name') !== 'coolify-db');}diff --git a/app/Models/StandaloneDocker.php b/app/Models/StandaloneDocker.phpindex e7e0a8c108..27483542da 100644--- a/app/Models/StandaloneDocker.php+++ b/app/Models/StandaloneDocker.php@@ -111,6 +111,11 @@ class StandaloneDocker extends BaseModelreturn $this->morphMany(StandaloneClickhouse::class, 'destination');}+ public function sqlites()+ {+ return $this->morphMany(StandaloneSqlite::class, 'destination');+ }+public function server(){return $this->belongsTo(Server::class);@@ -163,8 +168,9 @@ class StandaloneDocker extends BaseModel$keydbs = $this->keydbs;$dragonflies = $this->dragonflies;$clickhouses = $this->clickhouses;+ $sqlites = $this->sqlites;- return $postgresqls->concat($redis)->concat($mongodbs)->concat($mysqls)->concat($mariadbs)->concat($keydbs)->concat($dragonflies)->concat($clickhouses);+ return $postgresqls->concat($redis)->concat($mongodbs)->concat($mysqls)->concat($mariadbs)->concat($keydbs)->concat($dragonflies)->concat($clickhouses)->concat($sqlites);}public function attachedTo()diff --git a/app/Models/SwarmDocker.php b/app/Models/SwarmDocker.phpindex 02b8381d99..ec4a0568e0 100644--- a/app/Models/SwarmDocker.php+++ b/app/Models/SwarmDocker.php@@ -51,6 +51,11 @@ class SwarmDocker extends BaseModelreturn $this->morphMany(StandaloneClickhouse::class, 'destination');}+ public function sqlites()+ {+ return $this->morphMany(StandaloneSqlite::class, 'destination');+ }+public function mongodbs(){return $this->morphMany(StandaloneMongodb::class, 'destination');@@ -118,8 +123,9 @@ class SwarmDocker extends BaseModel$keydbs = $this->keydbs;$dragonflies = $this->dragonflies;$clickhouses = $this->clickhouses;+ $sqlites = $this->sqlites;- return $postgresqls->concat($redis)->concat($mongodbs)->concat($mysqls)->concat($mariadbs)->concat($keydbs)->concat($dragonflies)->concat($clickhouses);+ return $postgresqls->concat($redis)->concat($mongodbs)->concat($mysqls)->concat($mariadbs)->concat($keydbs)->concat($dragonflies)->concat($clickhouses)->concat($sqlites);}public function attachedTo()diff --git a/bootstrap/helpers/constants.php b/bootstrap/helpers/constants.phpindex 79049e8c71..4ab7d74698 100644--- a/bootstrap/helpers/constants.php+++ b/bootstrap/helpers/constants.php@@ -8,9 +8,10 @@ use App\Models\StandaloneMongodb;use App\Models\StandaloneMysql;use App\Models\StandalonePostgresql;use App\Models\StandaloneRedis;+use App\Models\StandaloneSqlite;const REDACTED = '<REDACTED>';-const DATABASE_TYPES = ['postgresql', 'redis', 'mongodb', 'mysql', 'mariadb', 'keydb', 'dragonfly', 'clickhouse'];+const DATABASE_TYPES = ['postgresql', 'redis', 'mongodb', 'mysql', 'mariadb', 'keydb', 'dragonfly', 'clickhouse', 'sqlite'];const STANDALONE_DATABASE_MODELS = ['postgresql' => StandalonePostgresql::class,'redis' => StandaloneRedis::class,@@ -20,6 +21,7 @@ const STANDALONE_DATABASE_MODELS = ['keydb' => StandaloneKeydb::class,'dragonfly' => StandaloneDragonfly::class,'clickhouse' => StandaloneClickhouse::class,+ 'sqlite' => StandaloneSqlite::class,];const VALID_CRON_STRINGS = ['every_minute' => '* * * * *',diff --git a/bootstrap/helpers/databases.php b/bootstrap/helpers/databases.phpindex 03a2e4fa3d..87c359fd07 100644--- a/bootstrap/helpers/databases.php+++ b/bootstrap/helpers/databases.php@@ -13,6 +13,7 @@ use App\Models\StandaloneMongodb;use App\Models\StandaloneMysql;use App\Models\StandalonePostgresql;use App\Models\StandaloneRedis;+use App\Models\StandaloneSqlite;use App\Models\SwarmDocker;use Illuminate\Support\Collection;use Illuminate\Support\Facades\Storage;@@ -181,6 +182,23 @@ function create_standalone_clickhouse($environment_id, StandaloneDocker|SwarmDocreturn $database;}+function create_standalone_sqlite($environment_id, StandaloneDocker|SwarmDocker $destination, ?array $otherData = null): StandaloneSqlite+{+ $database = new StandaloneSqlite;+ $database->uuid = new_public_id();+ $database->name = 'sqlite-database-'.$database->uuid;+ $database->image = 'peakimages/sqlite:3.53.4-v0.1.0';+ $database->environment_id = $environment_id;+ $database->destination_id = $destination->id;+ $database->destination_type = $destination->getMorphClass();+ if ($otherData) {+ $database->fill($otherData);+ }+ $database->save();++ return $database;+}+function deleteBackupsLocally(string|array|null $filenames, Server $server, bool $throwError = false): void{if (empty($filenames)) {diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.phpindex 9eee10d6ec..88bdf12038 100644--- a/bootstrap/helpers/shared.php+++ b/bootstrap/helpers/shared.php@@ -28,6 +28,7 @@ use App\Models\StandaloneMongodb;use App\Models\StandaloneMysql;use App\Models\StandalonePostgresql;use App\Models\StandaloneRedis;+use App\Models\StandaloneSqlite;use App\Models\SwarmDocker;use App\Models\Team;use App\Models\User;@@ -4142,7 +4143,7 @@ function isAssociativeArray($array)** Theses variables are added in place to the $where_to_add array.*/-function add_coolify_default_environment_variables(StandaloneRedis|StandalonePostgresql|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|StandaloneKeydb|StandaloneDragonfly|StandaloneClickhouse|Application|Service $resource, Collection &$where_to_add, ?Collection $where_to_check = null)+function add_coolify_default_environment_variables(StandaloneRedis|StandalonePostgresql|StandaloneMongodb|StandaloneMysql|StandaloneMariadb|StandaloneKeydb|StandaloneDragonfly|StandaloneClickhouse|StandaloneSqlite|Application|Service $resource, Collection &$where_to_add, ?Collection $where_to_check = null){// Currently disabledreturn;