Skip to content

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.

db sessions

Andras Bacsai98983bb60472
diff --git a/.env.example b/.env.development.example
similarity index 96%
rename from .env.example
rename to .env.development.example
index a28a1c17ab..d76fdd0746 100644
--- a/.env.example
+++ b/.env.development.example
@@ -15,6 +15,7 @@ APP_DEBUG=true
APP_URL=http://localhost
APP_PORT=8000
+SESSION_DRIVER=database
DUSK_DRIVER_URL=http://selenium:4444
DB_CONNECTION=pgsql
diff --git a/.env.production.example b/.env.production.example
deleted file mode 100644
index 02d3ec366b..0000000000
--- a/.env.production.example
+++ /dev/null
@@ -1,16 +0,0 @@
-APP_NAME=Coolify
-APP_SERVICE=php
-APP_ENV=local
-APP_KEY=
-APP_DEBUG=false
-APP_URL=http://localhost
-APP_PORT=3000
-
-DB_CONNECTION=pgsql
-DB_HOST=postgres
-DB_PORT=5432
-DB_DATABASE=coolify
-DB_USERNAME=
-DB_PASSWORD=
-
-QUEUE_CONNECTION=database
diff --git a/config/session.php b/config/session.php
index 8fed97c014..b6f484a9d4 100644
--- a/config/session.php
+++ b/config/session.php
@@ -46,7 +46,7 @@ return [
|
*/
- 'encrypt' => false,
+ 'encrypt' => true,
/*
|--------------------------------------------------------------------------
@@ -128,7 +128,7 @@ return [
'cookie' => env(
'SESSION_COOKIE',
- Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
+ Str::slug(env('APP_NAME', 'laravel'), '_') . '_session'
),
/*
diff --git a/database/migrations/2023_03_20_112809_create_sessions_table.php b/database/migrations/2023_03_20_112809_create_sessions_table.php
new file mode 100644
index 0000000000..f60625bb57
--- /dev/null
+++ b/database/migrations/2023_03_20_112809_create_sessions_table.php
@@ -0,0 +1,31 @@
+<?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::create('sessions', function (Blueprint $table) {
+ $table->string('id')->primary();
+ $table->foreignId('user_id')->nullable()->index();
+ $table->string('ip_address', 45)->nullable();
+ $table->text('user_agent')->nullable();
+ $table->longText('payload');
+ $table->integer('last_activity')->index();
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::dropIfExists('sessions');
+ }
+};
diff --git a/scripts/install.sh b/scripts/install.sh
index 114693f5f7..47021b3dcc 100644
--- a/scripts/install.sh
+++ b/scripts/install.sh
@@ -29,12 +29,12 @@ chmod -R 700 /data
echo "Downloading required files from GitHub..."
curl -fsSL https://raw.githubusercontent.com/coollabsio/coolify/${COOLIFY_VERSION_BRANCH}/docker-compose.yml -o /data/coolify/source/docker-compose.yml
curl -fsSL https://raw.githubusercontent.com/coollabsio/coolify/${COOLIFY_VERSION_BRANCH}/docker-compose.prod.yml -o /data/coolify/source/docker-compose.prod.yml
-curl -fsSL https://raw.githubusercontent.com/coollabsio/coolify/${COOLIFY_VERSION_BRANCH}/.env.production.example -o /data/coolify/source/.env.production.example
+curl -fsSL https://raw.githubusercontent.com/coollabsio/coolify/${COOLIFY_VERSION_BRANCH}/.env.production -o /data/coolify/source/.env.production
curl -fsSL https://raw.githubusercontent.com/coollabsio/coolify/v4/scripts/upgrade.sh -o /data/coolify/source/upgrade.sh
# Copy .env.example if .env does not exist
if [ ! -f /data/coolify/source/.env ]; then
- cp /data/coolify/source/.env.production.example /data/coolify/source/.env
+ cp /data/coolify/source/.env.production /data/coolify/source/.env
sed -i "s|APP_KEY=.*|APP_KEY=base64:$(openssl rand -base64 32)|g" /data/coolify/source/.env
sed -i "s|DB_PASSWORD=.*|DB_PASSWORD=$(openssl rand -base64 32)|g" /data/coolify/source/.env
fi