production modifications
This commit is contained in:
@@ -7,7 +7,7 @@ USERID=
|
|||||||
GROUPID=
|
GROUPID=
|
||||||
############################################################################################################
|
############################################################################################################
|
||||||
|
|
||||||
APP_NAME=Laravel
|
APP_NAME=Coolify
|
||||||
APP_SERVICE=php
|
APP_SERVICE=php
|
||||||
APP_ENV=local
|
APP_ENV=local
|
||||||
APP_KEY=
|
APP_KEY=
|
||||||
|
29
.github/workflows/production-build.yml
vendored
Normal file
29
.github/workflows/production-build.yml
vendored
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
name: Production Build (v4)
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: ["v4"]
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: ghcr.io
|
||||||
|
IMAGE_NAME: "coollabsio/coolify"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Login to ghcr.io
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: ${{ env.REGISTRY }}
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Build imaged and push to registry
|
||||||
|
uses: docker/build-push-action@v3
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: docker/prod-ssu/Dockerfile
|
||||||
|
platforms: linux/amd64
|
||||||
|
push: true
|
||||||
|
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:v4.0.0-nightly.0
|
@@ -33,7 +33,7 @@ class FortifyServiceProvider extends ServiceProvider
|
|||||||
Fortify::registerView(function () {
|
Fortify::registerView(function () {
|
||||||
$settings = InstanceSettings::find(0);
|
$settings = InstanceSettings::find(0);
|
||||||
if (!$settings->is_registration_enabled) {
|
if (!$settings->is_registration_enabled) {
|
||||||
abort(403);
|
return redirect()->route('login');
|
||||||
}
|
}
|
||||||
return view('auth.register');
|
return view('auth.register');
|
||||||
});
|
});
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use App\Models\InstanceSettings;
|
||||||
use App\Models\PrivateKey;
|
use App\Models\PrivateKey;
|
||||||
use App\Models\Project;
|
use App\Models\Project;
|
||||||
use App\Models\Server;
|
use App\Models\Server;
|
||||||
@@ -13,6 +14,21 @@ class ProductionSeeder extends Seeder
|
|||||||
{
|
{
|
||||||
public function run(): void
|
public function run(): void
|
||||||
{
|
{
|
||||||
|
if (InstanceSettings::find(0) == null) {
|
||||||
|
InstanceSettings::create([
|
||||||
|
'id' => 0
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add first Team if it doesn't exist
|
||||||
|
if (Team::find(0) == null) {
|
||||||
|
Team::create([
|
||||||
|
'id' => 0,
|
||||||
|
'name' => "Root's Team",
|
||||||
|
'personal_team' => true,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
// Save SSH Keys for the Coolify Host
|
// Save SSH Keys for the Coolify Host
|
||||||
$coolify_key_name = "id.root@host.docker.internal";
|
$coolify_key_name = "id.root@host.docker.internal";
|
||||||
$coolify_key = Storage::disk('local')->get("ssh-keys/{$coolify_key_name}");
|
$coolify_key = Storage::disk('local')->get("ssh-keys/{$coolify_key_name}");
|
||||||
@@ -27,17 +43,11 @@ class ProductionSeeder extends Seeder
|
|||||||
'name' => 'localhost\'s key',
|
'name' => 'localhost\'s key',
|
||||||
'description' => 'The private key for the Coolify host machine (localhost).',
|
'description' => 'The private key for the Coolify host machine (localhost).',
|
||||||
'private_key' => $coolify_key,
|
'private_key' => $coolify_key,
|
||||||
|
'team_id' => 0,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add first Team if it doesn't exist
|
|
||||||
if (Team::find(0) == null) {
|
|
||||||
Team::create([
|
|
||||||
'id' => 0,
|
|
||||||
'name' => "Root's Team",
|
|
||||||
'personal_team' => true,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
// Add Coolify host (localhost) as Server if it doesn't exist
|
// Add Coolify host (localhost) as Server if it doesn't exist
|
||||||
if (Server::find(0) == null) {
|
if (Server::find(0) == null) {
|
||||||
Server::create([
|
Server::create([
|
||||||
|
@@ -17,7 +17,6 @@ services:
|
|||||||
- DB_PASSWORD
|
- DB_PASSWORD
|
||||||
- QUEUE_CONNECTION
|
- QUEUE_CONNECTION
|
||||||
- SSL_MODE=off
|
- SSL_MODE=off
|
||||||
- AUTORUN_LARAVEL_MIGRATION=true
|
|
||||||
ports:
|
ports:
|
||||||
- "${APP_PORT:-8000}:80"
|
- "${APP_PORT:-8000}:80"
|
||||||
depends_on:
|
depends_on:
|
||||||
|
1
docker/prod-ssu/etc/s6-overlay/s6-rc.d/db-migration/type
Normal file
1
docker/prod-ssu/etc/s6-overlay/s6-rc.d/db-migration/type
Normal file
@@ -0,0 +1 @@
|
|||||||
|
oneshot
|
2
docker/prod-ssu/etc/s6-overlay/s6-rc.d/db-migration/up
Normal file
2
docker/prod-ssu/etc/s6-overlay/s6-rc.d/db-migration/up
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
#!/command/execlineb -P
|
||||||
|
php /var/www/html/artisan migrate --force --isolated
|
1
docker/prod-ssu/etc/s6-overlay/s6-rc.d/init-seeder/type
Normal file
1
docker/prod-ssu/etc/s6-overlay/s6-rc.d/init-seeder/type
Normal file
@@ -0,0 +1 @@
|
|||||||
|
oneshot
|
2
docker/prod-ssu/etc/s6-overlay/s6-rc.d/init-seeder/up
Normal file
2
docker/prod-ssu/etc/s6-overlay/s6-rc.d/init-seeder/up
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
#!/command/execlineb -P
|
||||||
|
php /var/www/html/artisan db:seed --class ProductionSeeder --force
|
@@ -1,4 +1,11 @@
|
|||||||
<x-layout>
|
<x-layout>
|
||||||
|
<div>v{{ config('coolify.version') }}</div>
|
||||||
|
<a href="/login">Login</a>
|
||||||
|
@if ($is_registration_enabled)
|
||||||
|
<a href="/register">Register</a>
|
||||||
|
@else
|
||||||
|
<span>Registration disabled</span>
|
||||||
|
@endif
|
||||||
<div>
|
<div>
|
||||||
<form action="/login" method="POST">
|
<form action="/login" method="POST">
|
||||||
@csrf
|
@csrf
|
||||||
|
@@ -1,4 +1,7 @@
|
|||||||
<x-layout>
|
<x-layout>
|
||||||
|
<div>v{{ config('coolify.version') }}</div>
|
||||||
|
<a href="/login">Login</a>
|
||||||
|
<a href="/register">Register</a>
|
||||||
<form action="/register" method="POST">
|
<form action="/register" method="POST">
|
||||||
@csrf
|
@csrf
|
||||||
<input type="text" name="name" placeholder="name" @env('local') value="Root" @endenv />
|
<input type="text" name="name" placeholder="name" @env('local') value="Root" @endenv />
|
||||||
|
@@ -16,7 +16,9 @@
|
|||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body x-data="confirmModal">
|
<body x-data="confirmModal">
|
||||||
|
@auth
|
||||||
<x-navbar />
|
<x-navbar />
|
||||||
|
@endauth
|
||||||
<main>
|
<main>
|
||||||
{{ $slot }}
|
{{ $slot }}
|
||||||
</main>
|
</main>
|
||||||
|
@@ -1,13 +1,5 @@
|
|||||||
<nav class="flex gap-2 ">
|
<nav class="flex gap-2 ">
|
||||||
<div>v{{ config('coolify.version') }}</div>
|
<div>v{{ config('coolify.version') }}</div>
|
||||||
@guest
|
|
||||||
<a href="/login">Login</a>
|
|
||||||
@isset($isRegistrationEnabled)
|
|
||||||
<a href="/register">Register</a>
|
|
||||||
@else
|
|
||||||
<div>Registration disabled</div>
|
|
||||||
@endisset
|
|
||||||
@endguest
|
|
||||||
@auth
|
@auth
|
||||||
<a href="/">Home</a>
|
<a href="/">Home</a>
|
||||||
@env('local')
|
@env('local')
|
||||||
|
66
scripts/install.sh
Normal file
66
scripts/install.sh
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
if [ "$EUID" -ne 0 ]; then
|
||||||
|
echo "Please run as root"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
COOLIFY_VERSION_BRANCH="v4"
|
||||||
|
OS=$(cat /etc/os-release | grep -w "ID" | cut -d "=" -f 2 | tr -d '"')
|
||||||
|
VERSION=$(cat /etc/os-release | grep -w "VERSION_ID" | cut -d "=" -f 2 | tr -d '"')
|
||||||
|
|
||||||
|
if ! [ -x "$(command -v docker)" ]; then
|
||||||
|
echo "Docker is not installed. Installing Docker..."
|
||||||
|
curl -fsSL https://get.docker.com -o get-docker.sh
|
||||||
|
sh get-docker.sh
|
||||||
|
rm get-docker.sh
|
||||||
|
echo "Docker installed successfully"
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p /data/coolify/deployments
|
||||||
|
mkdir -p /data/coolify/ssh-keys
|
||||||
|
mkdir -p /data/coolify/proxy
|
||||||
|
mkdir -p /data/coolify/source
|
||||||
|
|
||||||
|
chown -R root:root /data
|
||||||
|
chmod -R 700 /data
|
||||||
|
|
||||||
|
if [ ! -z "$(ls -A /data/coolify/source/.gitignore)" ]; then
|
||||||
|
git -C /data/coolify/source fetch --all
|
||||||
|
git -C /data/coolify/source reset --hard origin/${COOLIFY_VERSION_BRANCH}
|
||||||
|
else
|
||||||
|
git -C /data/coolify/source clone --branch ${COOLIFY_VERSION_BRANCH} https://github.com/coollabsio/coolify .
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Copy .env.example if .env does not exist
|
||||||
|
if [ ! -f /data/coolify/source/.env ]; then
|
||||||
|
cp /data/coolify/source/.env.example /data/coolify/source/.env
|
||||||
|
sed -i 's/APP_ENV=.*/APP_ENV=production/g' /data/coolify/source/.env
|
||||||
|
sed -i 's/APP_DEBUG=.*/APP_DEBUG=false/g' /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
|
||||||
|
|
||||||
|
# Generate an ssh key (ed25519) at /data/coolify/ssh-keys/id.root@host.docker.internal
|
||||||
|
if [ ! -f /data/coolify/ssh-keys/id.root@host.docker.internal ]; then
|
||||||
|
ssh-keygen -t ed25519 -f /data/coolify/ssh-keys/id.root@host.docker.internal -q -N "" -C root@coolify
|
||||||
|
fi
|
||||||
|
|
||||||
|
addSshKey() {
|
||||||
|
cat /data/coolify/ssh-keys/id.root@host.docker.internal.pub >>~/.ssh/authorized_keys
|
||||||
|
chmod 600 ~/.ssh/authorized_keys
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ ! -d ~/.ssh ]; then
|
||||||
|
mkdir -p ~/.ssh
|
||||||
|
chmod 700 ~/.ssh
|
||||||
|
touch ~/.ssh/authorized_keys
|
||||||
|
addSshKey
|
||||||
|
fi
|
||||||
|
if [ ! -f ~/.ssh/authorized_keys ]; then
|
||||||
|
touch ~/.ssh/authorized_keys
|
||||||
|
addSshKey
|
||||||
|
fi
|
||||||
|
if [ -z "$(grep -w "root@coolify" ~/.ssh/authorized_keys)" ]; then
|
||||||
|
addSshKey
|
||||||
|
fi
|
||||||
|
|
||||||
|
docker compose --env-file /data/coolify/source/.env -f /data/coolify/source/docker-compose.yml -f /data/coolify/source/docker-compose.prod.yml up -d
|
Reference in New Issue
Block a user