Merge pull request #1037 from coollabsio/spin
Introduce SSU image + spin
This commit is contained in:
commit
f5741a2a89
23
.dockerignore
Normal file
23
.dockerignore
Normal file
@ -0,0 +1,23 @@
|
||||
/.phpunit.cache
|
||||
/node_modules
|
||||
/public/build
|
||||
/public/hot
|
||||
/public/storage
|
||||
/storage/*.key
|
||||
/vendor
|
||||
.env
|
||||
.env.backup
|
||||
.env.production
|
||||
.phpunit.result.cache
|
||||
Homestead.json
|
||||
Homestead.yaml
|
||||
auth.json
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
/.fleet
|
||||
/.idea
|
||||
/.vscode
|
||||
/.npm
|
||||
/.bash_history
|
||||
/_volumes/*
|
||||
|
@ -14,6 +14,7 @@ APP_KEY=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
APP_PORT=8000
|
||||
|
||||
DUSK_DRIVER_URL=http://selenium:4444
|
||||
|
||||
DB_CONNECTION=pgsql
|
||||
|
10
.github/workflows/docker-image.yml
vendored
10
.github/workflows/docker-image.yml
vendored
@ -29,12 +29,12 @@ jobs:
|
||||
-v "$(pwd):/app" \
|
||||
-w /app composer:2 \
|
||||
composer install --ignore-platform-reqs
|
||||
./vendor/bin/sail build
|
||||
./vendor/bin/spin build
|
||||
- name: Start the stack
|
||||
run: |
|
||||
./vendor/bin/sail up -d
|
||||
./vendor/bin/sail artisan key:generate
|
||||
./vendor/bin/sail artisan migrate:fresh --seed
|
||||
./vendor/bin/spin up -d
|
||||
./vendor/bin/spin exec coolify php artisan key:generate
|
||||
./vendor/bin/spin exec coolify php artisan migrate:fresh --seed
|
||||
- name: Test (missing E2E tests)
|
||||
run: |
|
||||
./vendor/bin/sail artisan test
|
||||
./vendor/bin/spin exec coolify php artisan test
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -19,3 +19,4 @@ yarn-error.log
|
||||
/.vscode
|
||||
/.npm
|
||||
/.bash_history
|
||||
/_volumes/*
|
||||
|
@ -2,7 +2,9 @@
|
||||
|
||||
namespace App\Actions\Fortify;
|
||||
|
||||
use App\Models\Team;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Validation\Rule;
|
||||
@ -31,10 +33,24 @@ class CreateNewUser implements CreatesNewUsers
|
||||
'password' => $this->passwordRules(),
|
||||
])->validate();
|
||||
|
||||
return User::create([
|
||||
$team = Team::create([
|
||||
'name' => explode(' ', $input['name'], 2)[0] . "'s Team",
|
||||
'personal_team' => true,
|
||||
]);
|
||||
|
||||
$user = User::create([
|
||||
'name' => $input['name'],
|
||||
'email' => $input['email'],
|
||||
'password' => Hash::make($input['password']),
|
||||
'is_root_user' => User::count() == 0 ? true : false,
|
||||
]);
|
||||
|
||||
DB::table('team_user')->insert([
|
||||
'user_id' => $user->id,
|
||||
'team_id' => $team->id,
|
||||
'role' => 'admin',
|
||||
]);
|
||||
session(['currentTeam' => $user->currentTeam = $team]);
|
||||
return $user;
|
||||
}
|
||||
}
|
||||
|
@ -8,10 +8,11 @@ class ProjectController extends Controller
|
||||
{
|
||||
public function environments()
|
||||
{
|
||||
$project = session('currentTeam')->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first()->load(['environments']);
|
||||
$project = session('currentTeam')->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
|
||||
if (!$project) {
|
||||
return redirect()->route('home');
|
||||
}
|
||||
$project->load(['environments']);
|
||||
return view('project.environments', ['project' => $project]);
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@ class Team extends BaseModel
|
||||
];
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'personal_team'
|
||||
];
|
||||
public function projects() {
|
||||
return $this->hasMany(Project::class);
|
||||
|
@ -6,28 +6,29 @@
|
||||
"license": "MIT",
|
||||
"require": {
|
||||
"php": "^8.2",
|
||||
"guzzlehttp/guzzle": "^7.2",
|
||||
"laravel/fortify": "^1.16",
|
||||
"laravel/framework": "^10.0",
|
||||
"laravel/sanctum": "^3.2",
|
||||
"laravel/tinker": "^2.8",
|
||||
"lcobucci/jwt": "^5.0",
|
||||
"livewire/livewire": "^2.12",
|
||||
"spatie/laravel-activitylog": "^4.7",
|
||||
"spatie/laravel-data": "^3.2",
|
||||
"spatie/laravel-ray": "^1.32",
|
||||
"visus/cuid2": "^2.0"
|
||||
"guzzlehttp/guzzle": "^7.5.0",
|
||||
"laravel/fortify": "^v1.16.0",
|
||||
"laravel/framework": "^v10.7.1",
|
||||
"laravel/sanctum": "^v3.2.1",
|
||||
"laravel/tinker": "^v2.8.1",
|
||||
"lcobucci/jwt": "^5.0.0",
|
||||
"livewire/livewire": "^v2.12.3",
|
||||
"spatie/laravel-activitylog": "^4.7.3",
|
||||
"spatie/laravel-data": "^3.4.3",
|
||||
"spatie/laravel-ray": "^1.32.4",
|
||||
"visus/cuid2": "^2.0.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"fakerphp/faker": "^1.9.1",
|
||||
"laravel/dusk": "^7.7",
|
||||
"laravel/pint": "^1.0",
|
||||
"laravel/sail": "^1.18",
|
||||
"mockery/mockery": "^1.4.4",
|
||||
"nunomaduro/collision": "^7.0",
|
||||
"pestphp/pest": "^2.0",
|
||||
"phpunit/phpunit": "^10.0",
|
||||
"spatie/laravel-ignition": "^2.0"
|
||||
"fakerphp/faker": "^v1.21.0",
|
||||
"laravel/dusk": "^v7.7.0",
|
||||
"laravel/pint": "^v1.8.0",
|
||||
"laravel/sail": "^v1.21.4",
|
||||
"mockery/mockery": "^1.5.1",
|
||||
"nunomaduro/collision": "^v7.4.0",
|
||||
"pestphp/pest": "^v2.4.0",
|
||||
"phpunit/phpunit": "^10.0.19",
|
||||
"serversideup/spin": "^v1.1.0",
|
||||
"spatie/laravel-ignition": "^2.1.0"
|
||||
},
|
||||
"autoload": {
|
||||
"files": [
|
||||
|
455
composer.lock
generated
455
composer.lock
generated
File diff suppressed because it is too large
Load Diff
60
docker-compose.dev.yml
Normal file
60
docker-compose.dev.yml
Normal file
@ -0,0 +1,60 @@
|
||||
version: '3.8'
|
||||
|
||||
x-testing-host: &testing-host-base
|
||||
image: coolify-testing-host
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
context: ./docker/testing-host
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- ./docker/testing-host/supervisord.conf:/etc/supervisor/conf.d/supervisord.conf
|
||||
networks:
|
||||
- coolify
|
||||
|
||||
|
||||
services:
|
||||
coolify:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./docker/dev-ssu/Dockerfile
|
||||
ports:
|
||||
- "${APP_PORT:-8000}:80"
|
||||
environment:
|
||||
PUID: "${USERID:-1000}"
|
||||
PGID: "${GROUPID:-1000}"
|
||||
SSL_MODE: "off"
|
||||
AUTORUN_LARAVEL_STORAGE_LINK: "false"
|
||||
AUTORUN_LARAVEL_MIGRATION: "false"
|
||||
env_file:
|
||||
- .env
|
||||
volumes:
|
||||
- .:/var/www/html/:cached
|
||||
postgres:
|
||||
ports:
|
||||
- "${FORWARD_DB_PORT:-5432}:5432"
|
||||
env_file:
|
||||
- .env
|
||||
environment:
|
||||
POSTGRES_USER: "${DB_USERNAME}"
|
||||
POSTGRES_PASSWORD: "${DB_PASSWORD}"
|
||||
POSTGRES_DB: "${DB_DATABASE}"
|
||||
POSTGRES_HOST_AUTH_METHOD: "trust"
|
||||
volumes:
|
||||
- ./_volumes/database/:/var/lib/postgresql/data
|
||||
vite:
|
||||
image: node:19
|
||||
working_dir: /var/www/html
|
||||
ports:
|
||||
- "${VITE_PORT:-5173}:${VITE_PORT:-5173}"
|
||||
volumes:
|
||||
- .:/var/www/html:cached
|
||||
command: sh -c "npm install && npm run dev"
|
||||
testing-host:
|
||||
<<: *testing-host-base
|
||||
container_name: coolify-testing-host
|
||||
testing-host2:
|
||||
<<: *testing-host-base
|
||||
container_name: coolify-testing-host-2
|
||||
|
||||
|
||||
|
49
docker-compose.prod.yml
Normal file
49
docker-compose.prod.yml
Normal file
@ -0,0 +1,49 @@
|
||||
version: '3.8'
|
||||
services:
|
||||
coolify:
|
||||
container_name: coolify
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./docker/prod-ssu/Dockerfile
|
||||
environment:
|
||||
- APP_ENV=production
|
||||
- APP_DEBUG
|
||||
- APP_NAME
|
||||
- APP_KEY
|
||||
- APP_URL
|
||||
- DB_CONNECTION
|
||||
- DB_HOST
|
||||
- DB_PORT
|
||||
- DB_DATABASE
|
||||
- DB_USERNAME
|
||||
- DB_PASSWORD
|
||||
- QUEUE_CONNECTION
|
||||
- SSL_MODE=off
|
||||
- AUTORUN_LARAVEL_MIGRATION=true
|
||||
ports:
|
||||
- "${APP_PORT:-8000}:80"
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
postgres:
|
||||
container_name: coolify-db
|
||||
volumes:
|
||||
- coolify-db:/var/lib/postgresql/data
|
||||
environment:
|
||||
POSTGRES_USER: "${DB_USERNAME}"
|
||||
POSTGRES_PASSWORD: "${DB_PASSWORD}"
|
||||
POSTGRES_DB: "${DB_DATABASE}"
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
"CMD-SHELL",
|
||||
"pg_isready -U ${DB_USERNAME}",
|
||||
"-d",
|
||||
"${DB_DATABASE}"
|
||||
]
|
||||
interval: 2s
|
||||
retries: 5
|
||||
timeout: 2s
|
||||
volumes:
|
||||
coolify-db:
|
||||
name: coolify-db
|
@ -1,86 +0,0 @@
|
||||
version: '3.8'
|
||||
|
||||
x-testing-host: &testing-host-base
|
||||
image: coolify-testing-host
|
||||
build:
|
||||
dockerfile: Dockerfile
|
||||
context: ./docker/testing-host
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
- ./docker/testing-host/supervisord.conf:/etc/supervisor/conf.d/supervisord.conf
|
||||
networks:
|
||||
- coolify
|
||||
|
||||
services:
|
||||
php:
|
||||
hostname: coolify.test
|
||||
image: "coolify:${TAG:-4}"
|
||||
extra_hosts:
|
||||
- 'host.docker.internal:host-gateway'
|
||||
build:
|
||||
context: ./docker/dev
|
||||
dockerfile: Dockerfile
|
||||
args:
|
||||
WWWGROUP: '${WWWGROUP}'
|
||||
ports:
|
||||
- "${APP_PORT:-8000}:80"
|
||||
- "${VITE_PORT:-5173}:${VITE_PORT:-5173}"
|
||||
environment:
|
||||
WWWUSER: "${WWWUSER}"
|
||||
LARAVEL_SAIL: 1
|
||||
XDEBUG_MODE: "${SAIL_XDEBUG_MODE:-off}"
|
||||
XDEBUG_CONFIG: "${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}"
|
||||
volumes:
|
||||
- .:/var/www/html
|
||||
networks:
|
||||
- coolify
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
selenium:
|
||||
condition: service_started
|
||||
postgres:
|
||||
image: postgres:15-alpine
|
||||
ports:
|
||||
- "${FORWARD_DB_PORT:-5432}:5432"
|
||||
volumes:
|
||||
- db-coolify:/var/lib/postgresql/data
|
||||
networks:
|
||||
- coolify
|
||||
environment:
|
||||
POSTGRES_USER: "${DB_USERNAME}"
|
||||
POSTGRES_PASSWORD: "${DB_PASSWORD}"
|
||||
POSTGRES_DB: "${DB_DATABASE}"
|
||||
POSTGRES_HOST_AUTH_METHOD: "trust"
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
"CMD-SHELL",
|
||||
"pg_isready -U coolify",
|
||||
"-d",
|
||||
"coolify"
|
||||
]
|
||||
retries: 5
|
||||
timeout: 10s
|
||||
selenium:
|
||||
image: seleniarm/standalone-chromium
|
||||
extra_hosts:
|
||||
- 'host.docker.internal:host-gateway'
|
||||
volumes:
|
||||
- '/dev/shm:/dev/shm'
|
||||
networks:
|
||||
- coolify
|
||||
testing-host:
|
||||
<<: *testing-host-base
|
||||
container_name: coolify-testing-host
|
||||
testing-host2:
|
||||
<<: *testing-host-base
|
||||
container_name: coolify-testing-host-2
|
||||
|
||||
volumes:
|
||||
db-coolify:
|
||||
driver: local
|
||||
|
||||
networks:
|
||||
coolify:
|
||||
driver: bridge
|
16
docker-compose.yml
Normal file
16
docker-compose.yml
Normal file
@ -0,0 +1,16 @@
|
||||
version: '3.8'
|
||||
services:
|
||||
coolify:
|
||||
working_dir: /var/www/html
|
||||
networks:
|
||||
- coolify
|
||||
depends_on:
|
||||
- postgres
|
||||
|
||||
postgres:
|
||||
image: postgres:15-alpine
|
||||
networks:
|
||||
- coolify
|
||||
networks:
|
||||
coolify:
|
||||
driver: bridge
|
8
docker/dev-ssu/Dockerfile
Normal file
8
docker/dev-ssu/Dockerfile
Normal file
@ -0,0 +1,8 @@
|
||||
FROM serversideup/php:8.2-fpm-nginx
|
||||
ARG POSTGRES_VERSION=15
|
||||
RUN apt-get update && apt-get install -y php-pgsql openssh-client
|
||||
RUN apt-get -y autoremove \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
|
||||
|
||||
COPY --chmod=755 docker/dev-ssu/etc/s6-overlay/ /etc/s6-overlay/
|
2
docker/dev-ssu/etc/s6-overlay/s6-rc.d/queue-worker/run
Normal file
2
docker/dev-ssu/etc/s6-overlay/s6-rc.d/queue-worker/run
Normal file
@ -0,0 +1,2 @@
|
||||
#!/command/execlineb -P
|
||||
su - webuser -c "php /var/www/html/artisan queue:listen --timeout=600 --rest=1 --memory=512"
|
1
docker/dev-ssu/etc/s6-overlay/s6-rc.d/queue-worker/type
Normal file
1
docker/dev-ssu/etc/s6-overlay/s6-rc.d/queue-worker/type
Normal file
@ -0,0 +1 @@
|
||||
longrun
|
@ -0,0 +1,2 @@
|
||||
#!/command/execlineb -P
|
||||
su - webuser -c "php /var/www/html/artisan schedule:work"
|
@ -0,0 +1 @@
|
||||
longrun
|
21
docker/prod-ssu/Dockerfile
Normal file
21
docker/prod-ssu/Dockerfile
Normal file
@ -0,0 +1,21 @@
|
||||
FROM node:19 as static-assets
|
||||
WORKDIR /app
|
||||
COPY . .
|
||||
RUN npm install
|
||||
RUN npm run build
|
||||
|
||||
FROM serversideup/php:8.2-fpm-nginx
|
||||
WORKDIR /var/www/html
|
||||
ARG POSTGRES_VERSION=15
|
||||
RUN apt-get update && apt-get install -y php-pgsql openssh-client git git-lfs
|
||||
RUN apt-get -y autoremove \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
|
||||
|
||||
COPY --chmod=755 docker/prod-ssu/etc/s6-overlay/ /etc/s6-overlay/
|
||||
COPY --chown=9999:9999 . .
|
||||
COPY --from=static-assets --chown=9999:9999 /app/public/build /var/www/html/public/build
|
||||
|
||||
RUN composer install --no-dev --optimize-autoloader
|
||||
RUN php artisan route:cache
|
||||
RUN php artisan view:cache
|
2
docker/prod-ssu/etc/s6-overlay/s6-rc.d/queue-worker/run
Normal file
2
docker/prod-ssu/etc/s6-overlay/s6-rc.d/queue-worker/run
Normal file
@ -0,0 +1,2 @@
|
||||
#!/command/execlineb -P
|
||||
su - webuser -c "php /var/www/html/artisan queue:work --timeout=600 --rest=1 --memory=512"
|
1
docker/prod-ssu/etc/s6-overlay/s6-rc.d/queue-worker/type
Normal file
1
docker/prod-ssu/etc/s6-overlay/s6-rc.d/queue-worker/type
Normal file
@ -0,0 +1 @@
|
||||
longrun
|
@ -0,0 +1,2 @@
|
||||
#!/command/execlineb -P
|
||||
su - webuser -c "php /var/www/html/artisan schedule:work"
|
@ -0,0 +1 @@
|
||||
longrun
|
@ -1,3 +1,3 @@
|
||||
<div>
|
||||
<pre style="width: 100%;overflow-y: scroll;" @if ($isKeepAliveOn) wire:poll.3750ms="polling" @endif>{{ \App\Actions\RemoteProcess\RunRemoteProcess::decodeOutput($activity) }}</pre>
|
||||
<pre style="width: 100%;overflow-y: scroll;" @if ($isKeepAliveOn) wire:poll.750ms="polling" @endif>{{ \App\Actions\RemoteProcess\RunRemoteProcess::decodeOutput($activity) }}</pre>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user