Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ fly.toml
**/Thumbs.db
public/hot
docker-compose.yml
docker-compose.dev.yml


# 3. Copy over top-level .gitignore
Expand Down
39 changes: 39 additions & 0 deletions Caddyfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

{
admin off

frankenphp {
worker "{$APP_PUBLIC_PATH}/frankenphp-worker.php" {$CADDY_SERVER_WORKER_COUNT}
}
}

localhost:80 {
log {
level {$CADDY_SERVER_LOG_LEVEL}

# Redact the authorization query parameter that can be set by Mercure...
format filter {
wrap {$CADDY_SERVER_LOGGER}
fields {
uri query {
replace authorization REDACTED
}
}
}
}

route {
root * "{$APP_PUBLIC_PATH}"
encode zstd br gzip

# Mercure configuration is injected here...
{$CADDY_SERVER_EXTRA_DIRECTIVES}

php_server {
index frankenphp-worker.php
# Required for the public/storage/ directory...
resolve_root_symlink
}
}
}

21 changes: 21 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# https://taskfile.dev

version: "3"

tasks:
format:
cmds:
- ./vendor/bin/pint
- npm run format

dev:docker:build:
cmd: docker builder build -t davidhartingdotcom:latest -f Dockerfile .

dev:docker:down:
cmd: docker-compose down -v

dev:docker:up:
cmd: docker-compose -f docker-compose.yml -f docker-compose.dev.yml up -d
deps:
- dev:docker:down
- dev:docker:build
34 changes: 34 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
x-laravel-dev-env: &laravel-dev-env
environment:
APP_ENV: local
APP_DEBUG: "true"
APP_URL: http://localhost
MAIL_MAILER: log
MAIL_FROM_ADDRESS: "hello@localhost"
OCTANE_HTTPS: false

services:
web:
<<: *laravel-dev-env
command:
[
"php",
"artisan",
"octane:frankenphp",
"--caddyfile",
"Caddyfile.dev",
"--host",
"localhost",
]
ports:
- "8080:80"

worker:
<<: *laravel-dev-env

cron:
<<: *laravel-dev-env

migrations:
<<: *laravel-dev-env
command: ["php", "artisan", "migrate:fresh", "--seed"]
26 changes: 18 additions & 8 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
volumes:
db_data:
caddy_data:
# TODO: private and public disks

secrets:
DB_PASSWORD:
Expand Down Expand Up @@ -73,7 +74,6 @@ services:

migrations:
<<: *laravel-config
# TODO: seed in dev
command: ["php", "artisan", "migrate", "--force"]
restart: no

Expand Down Expand Up @@ -102,12 +102,22 @@ services:
volumes:
- caddy_data:/data

# cron:
# <<: *laravel-config
# command: ["php", "artisan", "schedule:work"]
# depends_on:
# migrations:
# condition: service_completed_successfully
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost/healthz || exit 1"]
interval: 30s
timeout: 5s
retries: 5
cron:
<<: *laravel-config
command: ["php", "artisan", "schedule:work"]
depends_on:
migrations:
condition: service_completed_successfully
healthcheck:
test: ["CMD-SHELL", 'pgrep -fl "php artisan schedule:work"']
interval: 30s
timeout: 5s
retries: 5

worker:
<<: *laravel-config
Expand All @@ -118,6 +128,6 @@ services:

healthcheck:
test: ["CMD-SHELL", 'pgrep -fl "php artisan queue:work"']
interval: 1s
interval: 30s
timeout: 5s
retries: 5
3 changes: 3 additions & 0 deletions routes/console.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use Illuminate\Foundation\Inspiring;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Schedule;

/*
|--------------------------------------------------------------------------
Expand All @@ -17,3 +18,5 @@
Artisan::command('inspire', function () {
$this->comment(Inspiring::quote());
})->purpose('Display an inspiring quote');

Schedule::command('pulse:check --once')->everyMinute();
4 changes: 4 additions & 0 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@

Route::feeds();

Route::get('/healthz', function () {
return response('OK', 200);
});

Route::get('/', function () {
return view('welcome');
})->name('home');
Expand Down