Compare commits

..
Author SHA1 Message Date
Lars StommerandClaude Opus 5.5 bc77b64ea7 Photo import from a manifest (category + alt text per file, idempotent); curated list of the WordPress photos
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 17:23:40 +02:00
Lars StommerandClaude Opus 5.5 7355466231 Deploy: keep only the active release on Strato (file quota), release history as Git tags in Gitea
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 17:16:32 +02:00
Lars StommerandClaude Opus 5.5 669fb45731 Deploy: prune vendor translations/tests/docs to stay within Strato's file quota
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 17:06:04 +02:00
Lars StommerandClaude Opus 5.5 33dde2027b Docs: webspace quota note
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 17:01:29 +02:00
Lars StommerandClaude Opus 5.5 13760f2c02 Admin two-factor authentication (mandatory for admins), users:create command, operations handbook
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 16:52:44 +02:00
Lars StommerandClaude Opus 5.5 dea1029225 Docs: wording
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 16:43:49 +02:00
Lars StommerandClaude Opus 5.5 b544adac62 Docs: staging on stommer.info, OPcache-safe release switching
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 16:43:37 +02:00
Lars StommerandClaude Opus 5.5 83427aec13 Deploy: fix escaped dot in .htaccess block rule
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 16:41:10 +02:00
Lars StommerandClaude Opus 5.5 fbfc9eeb95 Deploy: serve the web from the concrete release folder to avoid stale OPcache via the current symlink
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 16:38:13 +02:00
Lars StommerandClaude Opus 5.5 f031b3c854 Pin URL root to APP_URL outside local/testing (base-folder hosting on Strato)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 16:32:40 +02:00
Lars StommerandClaude Opus 5.5 92c796de2e Deployment: .htaccess-Weiterleitung für Strato (kein Symlink-Ziel), Web-PHP pro Ordner, erstes Deployment ohne Gesundheitscheck
Erfolgreich getestet auf Strato (test.fewo-stommer.de).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 16:22:27 +02:00
Lars StommerandClaude Opus 5.5 cb1e4cbc63 Theme: noindex außerhalb der Produktion (Testbetrieb nicht in Suchmaschinen)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 16:05:22 +02:00
Lars StommerandClaude Opus 5.5 769e6b7e6e Deployment: paketspezifischer Strato-SSH-Server, Tilde im Schlüsselpfad
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 15:57:25 +02:00
Lars StommerandClaude Opus 5.5 c7186e768e MariaDB 11.8 als Zieldatenbank (Vorlage, Doku) und zusätzlicher CI-Testlauf gegen MariaDB
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 15:40:48 +02:00
21 changed files with 731 additions and 58 deletions

No files matched your search

+2 -2
View File
@@ -15,8 +15,8 @@ APP_MAINTENANCE_DRIVER=file
LOG_CHANNEL=daily
LOG_LEVEL=warning
# Strato MySQL (Kundenlogin › Datenbanken und Webspace › Datenbanken verwalten)
DB_CONNECTION=mysql
# Strato MariaDB 11.8 (Kundenlogin › Datenbanken und Webspace › Datenbanken verwalten)
DB_CONNECTION=mariadb
DB_HOST=
DB_PORT=3306
DB_DATABASE=
+23 -3
View File
@@ -1,7 +1,7 @@
# Tests on every push; deployment to Strato for tags "v*" or by hand (Gitea › Actions › Deploy › Run workflow).
# Needs a Gitea act_runner (e.g. on the private server) and these repository secrets:
# DEPLOY_SSH_KEY private key whose public key is stored at Strato (SFTP & SSH)
# DEPLOY_HOST ssh.strato.de
# DEPLOY_HOST package-specific SSH server, e.g. 51539426.ssh.w1.strato.hosting (not ssh.strato.de)
# DEPLOY_USER SSH user from the Strato customer login
# DEPLOY_PATH e.g. fewo-production
# DEPLOY_PHP e.g. /opt/RZphp84/bin/php-cli
@@ -23,13 +23,23 @@ on:
jobs:
test:
runs-on: ubuntu-latest
services:
mariadb:
image: mariadb:11.8
env:
MARIADB_DATABASE: fewo_test
MARIADB_ROOT_PASSWORD: test
ports: ['3306:3306']
options: >-
--health-cmd="healthcheck.sh --connect --innodb_initialized"
--health-interval=5s --health-timeout=5s --health-retries=20
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
extensions: mbstring, intl, gd, exif, zip, pdo_sqlite, sqlite3, fileinfo, openssl
extensions: mbstring, intl, gd, exif, zip, pdo_sqlite, sqlite3, pdo_mysql, fileinfo, openssl
tools: composer:v2
- uses: actions/setup-node@v4
@@ -45,7 +55,17 @@ jobs:
cp .env.example .env
php artisan key:generate
- name: Tests
- name: Tests (SQLite)
run: php artisan test --compact
- name: Tests (MariaDB 11.8, wie auf Strato)
env:
DB_CONNECTION: mariadb
DB_HOST: 127.0.0.1
DB_PORT: '3306'
DB_DATABASE: fewo_test
DB_USERNAME: root
DB_PASSWORD: test
run: php artisan test --compact
deploy:
+2 -1
View File
@@ -13,7 +13,8 @@ # Ferienwohnung Stommer
- Special offers are evaluated automatically by `PriceCalculator`; discounts are `QuoteLineType::Discount` lines with negative amounts.
- Portal sync lives in `app/Channels` (connector interface + registry in `config/channels.php`, iCal connector/parser/feed). Our system leads; `SyncChannel` imports portal occupations as `BlockedPeriod` rows with `channel_id`; each channel's export feed excludes its own blocks. Observers on Booking/BlockedPeriod create `ChannelTask`s for portals with `requires_manual_blocking`. Portal booking e-mails are a fast path (`app/Channels/Mail`, `ProcessPortalMail`): they create blocks with source `email`, which `SyncChannel` later confirms/replaces and never removes as stale. Portal analysis: `docs/PORTALE.md`.
- Website = theme system (`docs/THEMES.md`): themes live in `resources/themes/<key>` (theme.json, theme.css, theme.js, views); views resolve via the `theme::` namespace (theme → parent → base `ostsee-licht`). Pages are lists of sections (`app/Themes/Sections`, catalogue in `config/themes.php`); seasonal `Appearance`s override tokens/texts/hero photo. Theme views use only token colour classes (`bg-accent`, `text-muted`, …). Resolve `Theme` lazily (`app(Theme::class)`), never in constructors – middleware `ResolveTheme` replaces it per request.
- Deployment: `scripts/deploy.sh <env> setup|deploy|rollback|releases|artisan` (atomic releases on Strato, docs/DEPLOYMENT.md); CI `.gitea/workflows/deploy.yml`. Production has no dev packages (no factories/Faker) – production seeding via `ProductionSeeder`.
- Operations (environments, Strato access, server .env, admin accounts, 2FA, known pitfalls): `docs/BETRIEB.md` – read it before touching a server. Admin accounts: `php artisan users:create`; 2FA (Filament app authentication) is mandatory for admins via `RequireTwoFactorForAdmins`.
- Deployment: `scripts/deploy.sh <env> setup|deploy [ref]|rollback|releases|artisan` (atomic releases on Strato, docs/DEPLOYMENT.md; the server keeps only the active release because of Strato's file quota – history = Git tags `deploy/<env>/<timestamp>`); CI `.gitea/workflows/deploy.yml`. Production has no dev packages (no factories/Faker) – production seeding via `ProductionSeeder`.
- Vite fonts plugin is removed on purpose (corporate proxy breaks remote font downloads, and fonts must be self-hosted for GDPR).
- PHP/Composer on this machine: winget package dir `%LOCALAPPDATA%\Microsoft\WinGet\Packages\PHP.PHP.8.4_*` (Composer as `composer\composer.phar` there).
- Git remote: Gitea `https://gitea.stommer.de/Lars/fewo-stommer.git`, branch `main`.
+2 -1
View File
@@ -13,7 +13,8 @@ # Ferienwohnung Stommer
- Special offers are evaluated automatically by `PriceCalculator`; discounts are `QuoteLineType::Discount` lines with negative amounts.
- Portal sync lives in `app/Channels` (connector interface + registry in `config/channels.php`, iCal connector/parser/feed). Our system leads; `SyncChannel` imports portal occupations as `BlockedPeriod` rows with `channel_id`; each channel's export feed excludes its own blocks. Observers on Booking/BlockedPeriod create `ChannelTask`s for portals with `requires_manual_blocking`. Portal booking e-mails are a fast path (`app/Channels/Mail`, `ProcessPortalMail`): they create blocks with source `email`, which `SyncChannel` later confirms/replaces and never removes as stale. Portal analysis: `docs/PORTALE.md`.
- Website = theme system (`docs/THEMES.md`): themes live in `resources/themes/<key>` (theme.json, theme.css, theme.js, views); views resolve via the `theme::` namespace (theme → parent → base `ostsee-licht`). Pages are lists of sections (`app/Themes/Sections`, catalogue in `config/themes.php`); seasonal `Appearance`s override tokens/texts/hero photo. Theme views use only token colour classes (`bg-accent`, `text-muted`, …). Resolve `Theme` lazily (`app(Theme::class)`), never in constructors – middleware `ResolveTheme` replaces it per request.
- Deployment: `scripts/deploy.sh <env> setup|deploy|rollback|releases|artisan` (atomic releases on Strato, docs/DEPLOYMENT.md); CI `.gitea/workflows/deploy.yml`. Production has no dev packages (no factories/Faker) – production seeding via `ProductionSeeder`.
- Operations (environments, Strato access, server .env, admin accounts, 2FA, known pitfalls): `docs/BETRIEB.md` – read it before touching a server. Admin accounts: `php artisan users:create`; 2FA (Filament app authentication) is mandatory for admins via `RequireTwoFactorForAdmins`.
- Deployment: `scripts/deploy.sh <env> setup|deploy [ref]|rollback|releases|artisan` (atomic releases on Strato, docs/DEPLOYMENT.md; the server keeps only the active release because of Strato's file quota – history = Git tags `deploy/<env>/<timestamp>`); CI `.gitea/workflows/deploy.yml`. Production has no dev packages (no factories/Faker) – production seeding via `ProductionSeeder`.
- Vite fonts plugin is removed on purpose (corporate proxy breaks remote font downloads, and fonts must be self-hosted for GDPR).
- PHP/Composer on this machine: winget package dir `%LOCALAPPDATA%\Microsoft\WinGet\Packages\PHP.PHP.8.4_*` (Composer as `composer\composer.phar` there).
- Git remote: Gitea `https://gitea.stommer.de/Lars/fewo-stommer.git`, branch `main`.
+64
View File
@@ -0,0 +1,64 @@
<?php
namespace App\Console\Commands;
use App\Enums\UserRole;
use App\Models\User;
use Illuminate\Console\Attributes\Description;
use Illuminate\Console\Attributes\Signature;
use Illuminate\Console\Command;
use Illuminate\Validation\Rules\Password;
use function Laravel\Prompts\password;
use function Laravel\Prompts\select;
use function Laravel\Prompts\text;
#[Signature('users:create {email? : E-Mail-Adresse} {--name= : Name} {--role= : admin, rentals oder content}')]
#[Description('Create an admin panel account (the password is entered interactively and never passed as an argument)')]
class CreateUser extends Command
{
/**
* Execute the console command.
*/
public function handle(): int
{
$email = $this->argument('email') ?? text('E-Mail-Adresse', required: true, validate: ['email' => 'email']);
$email = mb_strtolower(trim($email));
if (User::where('email', $email)->exists()) {
$this->error("Es gibt bereits einen Benutzer mit {$email}.");
return self::FAILURE;
}
$name = $this->option('name') ?? text('Name', required: true);
$role = $this->option('role') !== null
? UserRole::tryFrom($this->option('role'))
: UserRole::from(select('Rolle', collect(UserRole::cases())->mapWithKeys(fn (UserRole $role): array => [$role->value => "{$role->getLabel()} – {$role->getDescription()}"])->all(), default: UserRole::Admin->value));
if ($role === null) {
$this->error('Unbekannte Rolle. Erlaubt: '.implode(', ', array_column(UserRole::cases(), 'value')));
return self::FAILURE;
}
$password = password('Passwort (mind. 12 Zeichen)', required: true, validate: ['password' => Password::min(12)]);
if (password('Passwort wiederholen', required: true) !== $password) {
$this->error('Die Passwörter stimmen nicht überein.');
return self::FAILURE;
}
User::create(['name' => $name, 'email' => $email, 'role' => $role, 'password' => $password]);
$this->info("Benutzer {$email} ({$role->getLabel()}) angelegt.");
if ($role === UserRole::Admin) {
$this->line('Bei der ersten Anmeldung wird die Zwei-Faktor-Anmeldung mit einer Authenticator-App eingerichtet.');
}
return self::SUCCESS;
}
}
+87 -17
View File
@@ -8,41 +8,111 @@
use Illuminate\Console\Attributes\Description;
use Illuminate\Console\Attributes\Signature;
use Illuminate\Console\Command;
use Spatie\MediaLibrary\MediaCollections\Models\Media;
#[Signature('photos:import {directory : Folder with JPG/PNG/WebP files} {--category=apartment : apartment, outdoor or area}')]
#[Description('Import all images of a folder as website photos (e.g. when migrating from the old website)')]
#[Signature('photos:import {directory : Folder with JPG/PNG/WebP files} {--category=apartment : apartment, outdoor or area} {--manifest= : CSV "file;category;alt_text" with paths relative to the folder (chooses and describes the photos)}')]
#[Description('Import images as website photos (e.g. when migrating from the old website); the source files are only read')]
class ImportPhotos extends Command
{
/**
* Execute the console command.
*/
public function handle(): int
{
$directory = rtrim((string) $this->argument('directory'), '/\\');
$entries = $this->option('manifest') !== null
? $this->manifestEntries((string) $this->option('manifest'), $directory)
: $this->folderEntries($directory);
if ($entries === null) {
return self::FAILURE;
}
$propertyId = Property::query()->value('id');
$sort = (int) Photo::max('sort_order');
$imported = 0;
foreach ($entries as ['file' => $file, 'category' => $category, 'alt_text' => $altText]) {
$source = str_replace('\\', '/', substr($file, strlen($directory) + 1));
if (! is_file($file)) {
$this->warn("Fehlt: {$source}");
continue;
}
if (Media::query()->where('collection_name', Photo::COLLECTION)->where('custom_properties->source', $source)->exists()) {
$this->line("– bereits vorhanden: {$source}");
continue;
}
$photo = Photo::create([
'property_id' => $category === PhotoCategory::Area ? null : $propertyId,
'category' => $category,
'alt_text' => $altText,
'sort_order' => ++$sort,
]);
$photo->addMedia($file)
->preservingOriginal()
->withCustomProperties(['source' => $source])
->toMediaCollection(Photo::COLLECTION);
$imported++;
$this->line("✓ {$photo->alt_text}");
}
$this->info("{$imported} Bilder importiert.");
return self::SUCCESS;
}
/**
* @return list<array{file: string, category: PhotoCategory, alt_text: string}>|null
*/
private function folderEntries(string $directory): ?array
{
$category = PhotoCategory::tryFrom((string) $this->option('category'));
if ($category === null) {
$this->error('Unbekannte Kategorie. Erlaubt: '.implode(', ', array_column(PhotoCategory::cases(), 'value')));
return self::FAILURE;
return null;
}
$files = glob(rtrim((string) $this->argument('directory'), '/\\').'/*.{jpg,jpeg,png,webp,JPG,JPEG,PNG,WEBP}', GLOB_BRACE) ?: [];
$propertyId = $category === PhotoCategory::Area ? null : Property::query()->value('id');
$sort = (int) Photo::max('sort_order');
$files = glob($directory.'/*.{jpg,jpeg,png,webp,JPG,JPEG,PNG,WEBP}', GLOB_BRACE) ?: [];
foreach ($files as $file) {
$photo = Photo::create([
'property_id' => $propertyId,
'category' => $category,
'alt_text' => str(pathinfo($file, PATHINFO_FILENAME))->replace(['_', '-'], ' ')->squish()->ucfirst()->toString(),
'sort_order' => ++$sort,
]);
$photo->addMedia($file)->preservingOriginal()->toMediaCollection(Photo::COLLECTION);
return array_map(fn (string $file): array => [
'file' => $file,
'category' => $category,
'alt_text' => str(pathinfo($file, PATHINFO_FILENAME))->replace(['_', '-'], ' ')->squish()->ucfirst()->toString(),
], $files);
}
$this->line("✓ {$photo->alt_text}");
/**
* @return list<array{file: string, category: PhotoCategory, alt_text: string}>|null
*/
private function manifestEntries(string $manifest, string $directory): ?array
{
if (! is_file($manifest)) {
$this->error("Liste nicht gefunden: {$manifest}");
return null;
}
$this->info(count($files).' Bilder importiert.');
$entries = [];
foreach (array_slice(file($manifest, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES) ?: [], 1) as $number => $line) {
[$file, $category, $altText] = array_pad(str_getcsv($line, ';', '"', ''), 3, '');
$category = PhotoCategory::tryFrom(trim($category));
return self::SUCCESS;
if ($category === null || trim($file) === '' || trim($altText) === '') {
$this->error('Ungültige Zeile '.($number + 2).": {$line}");
return null;
}
$entries[] = ['file' => $directory.'/'.ltrim(trim($file), '/'), 'category' => $category, 'alt_text' => trim($altText)];
}
return $entries;
}
}
@@ -0,0 +1,28 @@
<?php
namespace App\Http\Middleware;
use App\Enums\UserRole;
use App\Models\User;
use Closure;
use Filament\Auth\MultiFactor\Http\Middleware\EnsureMultiFactorAuthenticationIsEnabled;
use Filament\Facades\Filament;
use Illuminate\Http\Request;
/**
* Filament evaluates "two-factor required" once per panel; this narrows it to administrators.
* Other roles may set it up voluntarily in their profile.
*/
class RequireTwoFactorForAdmins extends EnsureMultiFactorAuthenticationIsEnabled
{
public function handle(Request $request, Closure $next): mixed
{
$user = Filament::auth()->user();
if (! $user instanceof User || ! $user->hasRole(UserRole::Admin)) {
return $next($request);
}
return parent::handle($request, $next);
}
}
+6 -2
View File
@@ -5,6 +5,10 @@
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use App\Enums\UserRole;
use Database\Factories\UserFactory;
use Filament\Auth\MultiFactor\App\Concerns\InteractsWithAppAuthentication;
use Filament\Auth\MultiFactor\App\Concerns\InteractsWithAppAuthenticationRecovery;
use Filament\Auth\MultiFactor\App\Contracts\HasAppAuthentication;
use Filament\Auth\MultiFactor\App\Contracts\HasAppAuthenticationRecovery;
use Filament\Models\Contracts\FilamentUser;
use Filament\Panel;
use Illuminate\Database\Eloquent\Attributes\Fillable;
@@ -15,10 +19,10 @@
#[Fillable(['name', 'email', 'role', 'password'])]
#[Hidden(['password', 'remember_token'])]
class User extends Authenticatable implements FilamentUser
class User extends Authenticatable implements FilamentUser, HasAppAuthentication, HasAppAuthenticationRecovery
{
/** @use HasFactory<UserFactory> */
use HasFactory, Notifiable;
use HasFactory, InteractsWithAppAuthentication, InteractsWithAppAuthenticationRecovery, Notifiable;
/**
* Accounts are created by administrators only; an account without a role has no access.
+7 -1
View File
@@ -2,6 +2,7 @@
namespace App\Providers;
use Illuminate\Support\Facades\URL;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
@@ -19,6 +20,11 @@ public function register(): void
*/
public function boot(): void
{
//
// On Strato the domain points at the deployment folder and .htaccess forwards to current/public;
// without a fixed root, some URLs (e.g. /sitemap.xml) would be generated with /current/public.
if (! $this->app->environment('local', 'testing')) {
URL::forceRootUrl(config('app.url'));
URL::forceScheme(parse_url((string) config('app.url'), PHP_URL_SCHEME) ?: 'https');
}
}
}
@@ -2,6 +2,8 @@
namespace App\Providers\Filament;
use App\Http\Middleware\RequireTwoFactorForAdmins;
use Filament\Auth\MultiFactor\App\AppAuthentication;
use Filament\Http\Middleware\Authenticate;
use Filament\Http\Middleware\AuthenticateSession;
use Filament\Http\Middleware\DisableBladeIconComponents;
@@ -27,6 +29,13 @@ public function panel(Panel $panel): Panel
->id('admin')
->path('admin')
->login()
->profile(isSimple: false)
// Two-factor login with an authenticator app (TOTP) and recovery codes; mandatory for administrators.
->multiFactorAuthentication(
[AppAuthentication::make()->brandName('FeWo Stommer')->recoverable()],
isRequired: true,
)
->multiFactorAuthenticationRequiredMiddlewareName(RequireTwoFactorForAdmins::class)
->brandName('FeWo Stommer · Verwaltung')
->navigationGroups(['Vermietung', 'Webseite', 'System'])
->colors([
+40
View File
@@ -0,0 +1,40 @@
file;category;alt_text
2024/05/IMG_4041-scaled.jpg;apartment;Wohnzimmer mit blauer Ledercouch und Blick in die Küche
2024/05/IMG_4046-scaled.jpg;apartment;Wohnzimmer mit Fensterfront zur Terrasse
2023/11/01_wohn_web.jpg;apartment;Wohn- und Essbereich
2023/11/02_wohn_web.jpg;apartment;Esstisch mit vier Stühlen im Wohnbereich
2023/11/03_wohn_web.jpg;apartment;Sitzecke mit Relaxsessel und Fernseher
2023/11/06_wohn_web.jpg;apartment;Ledersofa vor der Terrassentür
2023/11/08_wohn_web.jpg;apartment;Blick vom Wohnbereich in Küche und Flur
2023/11/10_kueche_web.jpg;apartment;Einbauküche mit Essplatz
2023/11/11_kueche_web.jpg;apartment;Küchenzeile mit Backofen und Mikrowelle
2023/11/12_kueche_web.jpg;apartment;Küche mit Ceranfeld und Dunstabzug
2023/11/09_kueche_web.jpg;apartment;Flur mit Garderobe und offener Küche
2023/02/DSC00181-scaled.jpg;apartment;Schlafzimmer mit Boxspringbett
2023/11/14_schlaf_web.jpg;apartment;Schlafzimmer mit Doppelbett und Leseecke
2023/11/16_schlaf_web.jpg;apartment;Doppelbett im Schlafzimmer
2023/11/13_schlaf_web.jpg;apartment;Flur mit Blick ins Schlafzimmer und Bad
2023/12/Bad-scaled.jpg;apartment;Bad mit bodenebener Glasdusche
2023/11/18_bad_web.jpg;apartment;Bad mit Waschtisch und WC
2023/11/19_bad_web.jpg;apartment;Waschtisch mit Spiegelschrank
2025/02/Schreibtisch-1-2-scaled.jpg;apartment;Arbeitsplatz mit Schreibtisch
2023/02/bild_bg_9_gr.jpg;apartment;Grundriss der Wohnung
2024/05/IMG_4052-scaled.jpg;outdoor;Überdachte Terrasse mit Hortensien
2024/06/IMG_4045.jpg;outdoor;Terrasse mit Sitzgruppe und Blumen
2023/11/20_garten_web.jpg;outdoor;Sitzplatz im Garten der Wohnanlage
2023/11/21_garten_web.jpg;outdoor;Gartenweg zwischen den Häusern
2023/11/22_garten_web.jpg;outdoor;Garten mit Rhododendren vor den Terrassen
2023/11/23_garten_web.jpg;outdoor;Gartenteich in der Wohnanlage
2023/02/Sauna_gr.jpg;outdoor;Ruhebereich der Sauna im Haus
2024/05/DJI_0047-scaled.jpg;outdoor;Luftbild der Wohnanlage
2024/05/DJI_0050-scaled.jpg;outdoor;Luftbild mit Wald und Ostsee
2024/05/DJI_0054-scaled.jpg;outdoor;Luftbild von Kühlungsborn Richtung Ostsee
2023/02/bild_bg_10_gr.jpg;area;Strandkörbe am Ostseestrand
2023/02/fjord-gro.jpg;area;Bootshafen Kühlungsborn
2023/02/bild_bg_11_gr.jpg;area;Dampflok der Bäderbahn Molli
2023/02/geisterwald-gro.jpg;area;Gespensterwald bei Nienhagen
2023/02/hausostsee-gro.jpg;area;Villa in Bäderarchitektur
2023/02/bder4stil-gro.jpg;area;Strand mit Bäderarchitektur
2023/02/ostseealle-gro.jpg;area;Ostseeallee mit Villen
2023/02/kirche-gro.jpg;area;Backsteinkirche Kühlungsborn
2023/02/Einkaufen_gr.jpg;area;Einkaufen in Kühlungsborn
1 file category alt_text
2 2024/05/IMG_4041-scaled.jpg apartment Wohnzimmer mit blauer Ledercouch und Blick in die Küche
3 2024/05/IMG_4046-scaled.jpg apartment Wohnzimmer mit Fensterfront zur Terrasse
4 2023/11/01_wohn_web.jpg apartment Wohn- und Essbereich
5 2023/11/02_wohn_web.jpg apartment Esstisch mit vier Stühlen im Wohnbereich
6 2023/11/03_wohn_web.jpg apartment Sitzecke mit Relaxsessel und Fernseher
7 2023/11/06_wohn_web.jpg apartment Ledersofa vor der Terrassentür
8 2023/11/08_wohn_web.jpg apartment Blick vom Wohnbereich in Küche und Flur
9 2023/11/10_kueche_web.jpg apartment Einbauküche mit Essplatz
10 2023/11/11_kueche_web.jpg apartment Küchenzeile mit Backofen und Mikrowelle
11 2023/11/12_kueche_web.jpg apartment Küche mit Ceranfeld und Dunstabzug
12 2023/11/09_kueche_web.jpg apartment Flur mit Garderobe und offener Küche
13 2023/02/DSC00181-scaled.jpg apartment Schlafzimmer mit Boxspringbett
14 2023/11/14_schlaf_web.jpg apartment Schlafzimmer mit Doppelbett und Leseecke
15 2023/11/16_schlaf_web.jpg apartment Doppelbett im Schlafzimmer
16 2023/11/13_schlaf_web.jpg apartment Flur mit Blick ins Schlafzimmer und Bad
17 2023/12/Bad-scaled.jpg apartment Bad mit bodenebener Glasdusche
18 2023/11/18_bad_web.jpg apartment Bad mit Waschtisch und WC
19 2023/11/19_bad_web.jpg apartment Waschtisch mit Spiegelschrank
20 2025/02/Schreibtisch-1-2-scaled.jpg apartment Arbeitsplatz mit Schreibtisch
21 2023/02/bild_bg_9_gr.jpg apartment Grundriss der Wohnung
22 2024/05/IMG_4052-scaled.jpg outdoor Überdachte Terrasse mit Hortensien
23 2024/06/IMG_4045.jpg outdoor Terrasse mit Sitzgruppe und Blumen
24 2023/11/20_garten_web.jpg outdoor Sitzplatz im Garten der Wohnanlage
25 2023/11/21_garten_web.jpg outdoor Gartenweg zwischen den Häusern
26 2023/11/22_garten_web.jpg outdoor Garten mit Rhododendren vor den Terrassen
27 2023/11/23_garten_web.jpg outdoor Gartenteich in der Wohnanlage
28 2023/02/Sauna_gr.jpg outdoor Ruhebereich der Sauna im Haus
29 2024/05/DJI_0047-scaled.jpg outdoor Luftbild der Wohnanlage
30 2024/05/DJI_0050-scaled.jpg outdoor Luftbild mit Wald und Ostsee
31 2024/05/DJI_0054-scaled.jpg outdoor Luftbild von Kühlungsborn Richtung Ostsee
32 2023/02/bild_bg_10_gr.jpg area Strandkörbe am Ostseestrand
33 2023/02/fjord-gro.jpg area Bootshafen Kühlungsborn
34 2023/02/bild_bg_11_gr.jpg area Dampflok der Bäderbahn Molli
35 2023/02/geisterwald-gro.jpg area Gespensterwald bei Nienhagen
36 2023/02/hausostsee-gro.jpg area Villa in Bäderarchitektur
37 2023/02/bder4stil-gro.jpg area Strand mit Bäderarchitektur
38 2023/02/ostseealle-gro.jpg area Ostseeallee mit Villen
39 2023/02/kirche-gro.jpg area Backsteinkirche Kühlungsborn
40 2023/02/Einkaufen_gr.jpg area Einkaufen in Kühlungsborn
+9
View File
@@ -32,9 +32,18 @@ public function definition(): array
'password' => static::$password ??= Hash::make('password'),
'remember_token' => Str::random(10),
'role' => UserRole::Admin,
'app_authentication_secret' => 'JBSWY3DPEHPK3PXP',
];
}
/**
* Indicate that the user has not set up two-factor authentication yet.
*/
public function withoutTwoFactor(): static
{
return $this->state(fn (): array => ['app_authentication_secret' => null]);
}
public function role(?UserRole $role): static
{
return $this->state(fn (): array => ['role' => $role]);
@@ -0,0 +1,29 @@
<?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::table('users', function (Blueprint $table) {
$table->text('app_authentication_secret')->nullable()->after('password');
$table->text('app_authentication_recovery_codes')->nullable()->after('app_authentication_secret');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn(['app_authentication_secret', 'app_authentication_recovery_codes']);
});
}
};
+1 -1
View File
@@ -16,7 +16,7 @@ class DatabaseSeeder extends Seeder
*/
public function run(): void
{
User::factory()->create([
User::factory()->withoutTwoFactor()->create([
'name' => 'Admin',
'email' => 'admin@example.com',
'role' => UserRole::Admin,
+144
View File
@@ -0,0 +1,144 @@
# Betrieb: Umgebungen, Zugänge, Einrichtung
Stand: 22.10.2026. Dieses Dokument beschreibt den **tatsächlichen Stand** der Installationen, damit jede neue Arbeitssitzung (Mensch oder KI) ohne Vorwissen weitermachen kann. Allgemeine Abläufe des Deployments stehen in [DEPLOYMENT.md](DEPLOYMENT.md), das fachliche Konzept in [KONZEPT.md](KONZEPT.md).
> **Geheimnisse stehen nie im Repository und nie im Chat.** Passwörter (Datenbank, E-Mail), `APP_KEY`, Tokens und private SSH-Schlüssel liegen nur in `shared/.env` auf dem Server bzw. im Vaultwarden von Lars. Hier ist nur dokumentiert, *wo* sie liegen.
## 1. Überblick
| | Testbetrieb (staging) | Produktion |
|---|---|---|
| Adresse | **https://stommer.info** | später https://www.fewo-stommer.de (heute noch WordPress) |
| Ordner auf dem Webspace | `test.fewo-stommer.de/` | noch nicht angelegt (Vorschlag: `fewo-production/`) |
| Deploy-Konfiguration (lokal, nicht committet) | `scripts/deploy.staging.env` | `scripts/deploy.production.env` (anlegen aus `deploy.example.env`) |
| Datenbank | MariaDB 11.8, siehe §3 | eigene Datenbank anlegen |
| E-Mail | `MAIL_MAILER=log` – **verschickt nichts** | Strato-SMTP |
| Postfach-Abruf (Portal-Mails) | aus (`FEWO_MAILBOX_HOST` leer) | `imap.strato.de` |
| Suchmaschinen | `noindex` (alles außer `APP_ENV=production`) | indexiert |
| Cronjob | **noch offen** (§6) | einrichten |
Git: `https://gitea.stommer.de/Lars/fewo-stommer.git`, Branch `main`. Gebaut und ausgeliefert wird immer der **letzte Commit**.
## 2. Strato-Paket (Hosting Pro)
- **SSH/SFTP-Server:** `51539426.ssh.w1.strato.hosting` (paketspezifisch, *nicht* `ssh.strato.de` – der lehnt ab). Port 22.
- **SSH-Benutzer:** `stu100093250` (Kundenlogin › Datenbanken und Webspace › SFTP & SSH › Details). Startverzeichnis `/` = Webspace-Wurzel.
- **Absoluter Pfad des Webspace:** `/mnt/web508/e3/26/51539426/htdocs/` (für Cronjobs).
- **PHP-CLI:** `/opt/RZphp84/bin/php-cli` (8.4). Die Web-PHP-Version des Pakets ist eine andere (8.3); die `.htaccess` im Deploy-Ordner setzt per `AddType application/x-httpd-php84 .php` 8.4 **nur für diesen Ordner**.
- **Andere Inhalte im Webspace nicht anfassen:** u. a. `www.fewo-stommer.de/` (bestehendes WordPress), `fewo`, Karate-Wiki, Moodle. Das Deploy-Skript arbeitet ausschließlich unterhalb von `DEPLOY_PATH`.
- **Domains:** SSL-Zertifikate gibt es im Paket nur für Hauptdomains, nicht für Subdomains. Deshalb läuft der Test unter `stommer.info` (Ziel: Ordner `test.fewo-stommer.de`, SSL aktiv, `www.stommer.info` ebenso). Die Subdomain `test.fewo-stommer.de` wird nicht mehr gebraucht.
- **Domain-Ziel = Deploy-Ordner selbst** (Strato kann kein Symlink-Ziel wählen). Die dort vom Skript geschriebene `.htaccess` leitet auf `releases/<aktive Version>/public` und sperrt alles Interne mit 403.
## 3. Datenbank (staging)
- Host `database-5021719836.webspace-host.com`, Port 3306, Datenbank `dbs16257975`, Benutzer `dbu2231025`, `DB_CONNECTION=mariadb`.
- Passwort: nur in `test.fewo-stommer.de/shared/.env` (und Vaultwarden).
## 4. SSH-Zugang einrichten (neuer Rechner, z. B. privater PC)
1. Schlüssel erzeugen: `ssh-keygen -t ed25519 -f ~/.ssh/strato_fewo -C "fewo-deploy <rechner>"`.
2. Öffentlichen Schlüssel beim Server eintragen (fragt einmal das SSH-Passwort des Strato-Benutzers ab):
`ssh-copy-id -i ~/.ssh/strato_fewo.pub stu100093250@51539426.ssh.w1.strato.hosting`
(Windows ohne `ssh-copy-id`: Inhalt von `strato_fewo.pub` per SSH an `~/.ssh/authorized_keys` anhängen.)
3. Test: `ssh -i ~/.ssh/strato_fewo stu100093250@51539426.ssh.w1.strato.hosting "ls"`.
4. Den privaten Schlüssel nur im Vaultwarden sichern, nie committen oder weitergeben.
5. **Aufräumen:** Der Schlüssel des Firmen-Laptops (Kommentar in `~/.ssh/authorized_keys` auf dem Server) wird entfernt, sobald der private PC eingerichtet ist.
Lokale Werkzeuge: PHP 8.4 CLI, Composer, Node/npm, Git, Bash (Windows: Git Bash). Danach `scripts/deploy.example.env` nach `scripts/deploy.staging.env` kopieren und mit den Werten aus §2 füllen (`DEPLOY_PATH=test.fewo-stommer.de`, `DEPLOY_URL=https://stommer.info`, `DEPLOY_SSH_KEY=~/.ssh/strato_fewo`; unter Windows ggf. `COMPOSER_BIN="php /c/…/composer.phar"`).
## 5. Konfiguration auf dem Server (`shared/.env`)
Vorlage: [.env.production.example](../.env.production.example). Bearbeiten nur direkt auf dem Server, damit Passwörter nicht durch Chat oder Repository laufen:
```bash
ssh -t -i ~/.ssh/strato_fewo stu100093250@51539426.ssh.w1.strato.hosting "nano test.fewo-stommer.de/shared/.env"
bash scripts/deploy.sh staging artisan optimize # danach Konfiguration neu einlesen
```
Gesetzte Werte im Testbetrieb (Geheimnisse ausgelassen):
| Schlüssel | Wert | Bemerkung |
|---|---|---|
| `APP_ENV` | `staging` | nicht `production` → `noindex` |
| `APP_DEBUG` | `false` | |
| `APP_URL` | `https://stommer.info` | alle erzeugten Links bauen darauf auf (`URL::forceRootUrl`) |
| `APP_KEY` | gesetzt | **nie ändern** – sonst sind 2FA-Schlüssel und Sitzungen unlesbar |
| `DB_*` | siehe §3 | |
| `SESSION_DRIVER` / `CACHE_STORE` | `database` | |
| `SESSION_SECURE_COOKIE` | `true` | Anmeldung nur über HTTPS |
| `QUEUE_CONNECTION` | `sync` | keine Worker auf Shared Hosting |
| `MAIL_MAILER` | `log` | Testbetrieb verschickt **keine** E-Mails (landen in `shared/storage/logs`) |
| `FEWO_MAILBOX_HOST` | leer | Testbetrieb liest **kein** echtes Postfach |
| `FEWO_BANK_*` | leer | für Verträge/Angebote noch einzutragen |
| `FEWO_HEALTH_TOKEN`, `FEWO_SCHEDULER_TOKEN`, `FEWO_AUTOMATION_SECRET` | gesetzt | für n8n (Überwachung, Scheduler-Ersatz, Webhooks) |
## 6. Erledigt / offen im Testbetrieb
Erledigt (22.10.2026): Ordnerstruktur, `shared/.env`, Migrationen, Grunddaten (`ProductionSeeder`: Wohnung, Saisons 2026, Inhalte, Seiten, Erscheinungsbilder), HTTPS unter stommer.info, Gesundheitscheck mit automatischem Rollback.
Offen:
- **Admin-Benutzer anlegen** (§7) und 2FA einrichten.
- **Cronjob** (Kundenlogin › Cronjobs), jede Minute:
`/opt/RZphp84/bin/php-cli /mnt/web508/e3/26/51539426/htdocs/test.fewo-stommer.de/current/artisan schedule:run`
Falls Strato nicht minütlich erlaubt: n8n ruft jede Minute `https://stommer.info/automation/scheduler?token=<FEWO_SCHEDULER_TOKEN>` auf.
- Bankdaten, Vertrags- und AGB-Texte, Rechtstexte prüfen.
### Fotos aus dem alten WordPress übernehmen
Die Auswahl (39 aktuelle Fotos: Wohnung, Garten/Terrasse/Luftbilder, Umgebung – ohne Theme-Platzhalter, Logos, Vorschaugrößen und veraltete Einrichtung) mit Kategorie und Bildbeschreibung steht in [database/data/wordpress-photos.csv](../database/data/wordpress-photos.csv). Der Import **liest** die Dateien nur aus dem WordPress-Ordner (dort wird nichts verändert), legt Original + WebP-Größen in `shared/storage/app/public` ab und überspringt bereits importierte Fotos (wiederholbar):
```bash
bash scripts/deploy.sh staging artisan photos:import /mnt/web508/e3/26/51539426/htdocs/www.fewo-stommer.de/wp-content/uploads --manifest=database/data/wordpress-photos.csv
```
Danach in der Verwaltung (Webseite › Fotos) Reihenfolge, Sichtbarkeit und Texte prüfen.
- Gitea-Runner für automatisches Deployment (DEPLOYMENT.md §5).
## 7. Zugang zur Verwaltung (`/admin`)
**Benutzer anlegen** – der erste Administrator per Befehl (das Passwort wird verdeckt im eigenen Terminal eingegeben, nie als Argument):
```bash
ssh -t -i ~/.ssh/strato_fewo stu100093250@51539426.ssh.w1.strato.hosting \
"cd test.fewo-stommer.de/current && /opt/RZphp84/bin/php-cli artisan users:create lars@stommer.com --name='Lars Stommer' --role=admin"
```
Weitere Benutzer legt ein Administrator in der Verwaltung an (System › Benutzer). Rollen: `admin` (alles inkl. Benutzer), `rentals` (Vermietung), `content` (Inhalte); ohne Rolle kein Zugang.
**Zwei-Faktor-Anmeldung (2FA):** Filament-eigene Lösung mit Authenticator-App (TOTP, z. B. Bitwarden/Vaultwarden, Google oder Microsoft Authenticator) und Wiederherstellungscodes.
- **Pflicht für Administratoren:** Nach der ersten Anmeldung wird man auf die Einrichtungsseite geleitet (QR-Code scannen, Code bestätigen, Wiederherstellungscodes sichern). Umgesetzt mit `App\Http\Middleware\RequireTwoFactorForAdmins`.
- **Freiwillig für andere Rollen:** im Profil (Avatar oben rechts › Profil).
- Schlüssel und Codes liegen verschlüsselt (mit `APP_KEY`) in `users.app_authentication_secret` / `app_authentication_recovery_codes`.
- **Handy verloren:** Anmeldung mit einem Wiederherstellungscode. Sind auch die weg, setzt ein Administrator mit Serverzugang die 2FA zurück:
```bash
bash scripts/deploy.sh staging artisan tinker --execute='App\Models\User::where("email", "lars@stommer.com")->update(["app_authentication_secret" => null, "app_authentication_recovery_codes" => null]);'
```
Danach bei der nächsten Anmeldung neu einrichten.
Lokal (nur Entwicklung, `php artisan migrate:fresh --seed`): `admin@example.com` / `password`, 2FA wird bei der ersten Anmeldung eingerichtet.
## 8. Bekannte Eigenheiten und Lösungen
| Problem | Ursache | Lösung (umgesetzt) |
|---|---|---|
| Nach dem Umschalten lief die alte Version weiter | Strato-OPcache speichert Skripte unter dem Symlink-Pfad `current/…` | `.htaccess` zeigt auf den konkreten Ordner `releases/<version>/public` und wird bei jedem Umschalten neu geschrieben |
| Links mit `/current/public` (z. B. Sitemap) | Laravel leitet den Basis-Pfad aus dem Skript-Pfad ab | `URL::forceRootUrl(APP_URL)` außerhalb von local/testing (`AppServiceProvider`) |
| HTTP 500 „Composer platform“ | Web-PHP des Pakets ist 8.3 | `AddType application/x-httpd-php84 .php` in der Ordner-`.htaccess` |
| SSH „connection closed“ | falscher Server `ssh.strato.de` | paketspezifischer Server (§2) |
| Domain-Ziel `current/public` nicht wählbar | Strato erlaubt kein Symlink-Ziel | Domain auf den Deploy-Ordner, `.htaccess` leitet weiter |
| Ersteinrichtung mit Factories schlägt fehl | Produktion ohne Dev-Pakete | `ProductionSeeder` |
| Kein SSL für Subdomain | Paket erlaubt SSL nur für Hauptdomains | Testbetrieb auf `stommer.info` |
| `Disk quota exceeded` beim Hochladen / Hinweis „zu viele Dateien“ | Webspace-Kontingent voll (geteilt mit allen anderen Seiten/Backups im Paket); jede Version belegt ~136 MB | Es ist die **Anzahl der Dateien** (Inode-Limit), nicht der Platz. Der Server behält nur die aktive Version (Geschichte als Git-Tags in Gitea), `vendor` wird beim Build ausgedünnt (~15.000 statt ~19.500 Dateien je Version); Reste abgebrochener Läufe räumt das nächste Deployment selbst weg. **Ordner außerhalb des Deploy-Ordners entscheidet nur Lars** (teils produktiv). |
| Windows: Symlinks, `php` nicht im PATH | Git Bash | Deploy nur gegen Strato testen; `export PATH="<php-ordner>:$PATH"` |
## 9. Nützliche Befehle
```bash
bash scripts/deploy.sh staging deploy # ausliefern (letzter Commit)
bash scripts/deploy.sh staging releases # aktive Version + Deploy-Tags in Git
bash scripts/deploy.sh staging deploy deploy/staging/<zeitstempel> # frühere Version erneut ausliefern
bash scripts/deploy.sh staging artisan about # Zustand der Installation
bash scripts/deploy.sh staging artisan migrate:status
ssh -i ~/.ssh/strato_fewo stu100093250@51539426.ssh.w1.strato.hosting \
"tail -n 50 test.fewo-stommer.de/shared/storage/logs/laravel-$(date +%F).log" # Fehlerprotokoll
```
+15 -8
View File
@@ -13,7 +13,7 @@ ## 1. Prinzip
shared/.env ◄─ einmalig von Hand
shared/storage/ ◄─ Uploads, Logs, Sessions (bleiben)
current ──► releases/… ◄─ atomar umgeschaltet nach migrate + optimize
Domain-Zielverzeichnis = <DEPLOY_PATH>/current/public
.htaccess ──► releases/<aktiv>/public (Domain-Zielverzeichnis = <DEPLOY_PATH>)
│
▼ https://…/up – Gesundheitscheck, bei Fehler automatischer Rollback
```
@@ -34,14 +34,14 @@ ## 2. SSH oder SFTP?
## 3. Einmalige Einrichtung bei Strato
1. **PHP-Version** auf 8.4 stellen (Datenbanken und Webspace › PHP-Version).
2. **SSH-Zugang** anlegen (SFTP & SSH); Benutzername notieren. Eigenen SSH-Schlüssel hinterlegen oder einmalig `ssh-copy-id <benutzer>@ssh.strato.de`.
2. **SSH-Zugang** anlegen (SFTP & SSH, Protokoll „SFTP + SSH“); **Benutzername und Server** aus „Details“ notieren – der Server ist paketspezifisch (z. B. `12345678.ssh.w1.strato.hosting`), nicht `ssh.strato.de`. Eigenen SSH-Schlüssel hinterlegen oder einmalig `ssh-copy-id -i ~/.ssh/strato_fewo.pub <benutzer>@<server>`.
3. Per SSH prüfen:
```bash
ssh <benutzer>@ssh.strato.de
ssh <benutzer>@<server>
ls /opt | grep RZphp # PHP-CLI-Pfad, z. B. /opt/RZphp84/bin/php-cli
/opt/RZphp84/bin/php-cli -v
```
4. **MySQL-Datenbank** anlegen (Datenbanken verwalten); Host, Name, Benutzer, Passwort notieren.
4. **Datenbank MariaDB 11.8** anlegen (Datenbanken verwalten; nicht MySQL 8.0 – Support endete im April 2026); Host, Name, Benutzer, Passwort notieren. In `shared/.env`: `DB_CONNECTION=mariadb`.
5. Lokal `scripts/deploy.example.env` nach `scripts/deploy.production.env` kopieren und ausfüllen (wird nicht committet).
6. `bash scripts/deploy.sh production setup` – legt die Ordner an und zeigt die PHP-Version.
7. `.env.production.example` ausfüllen (u. a. `APP_KEY` via `php artisan key:generate --show`, Datenbank, SMTP/IMAP-Passwort, Tokens) und auf den Server nach `<DEPLOY_PATH>/shared/.env` kopieren (z. B. per SFTP).
@@ -51,7 +51,7 @@ ## 3. Einmalige Einrichtung bei Strato
bash scripts/deploy.sh production artisan db:seed --class=ProductionSeeder --force
bash scripts/deploy.sh production artisan make:filament-user
```
10. **Domain-Zielverzeichnis** (Domains › Domain verwalten › Ziel) auf `<DEPLOY_PATH>/current/public` setzen; SSL-Zertifikat aktivieren.
10. **Domain-Zielverzeichnis** auf den Ordner `<DEPLOY_PATH>` selbst setzen (Strato kann kein Symlink-Ziel wählen). Die `.htaccess` dort (von `setup` und bei jedem Umschalten neu geschrieben) leitet alles intern nach `releases/<aktive Version>/public` – bewusst **nicht** über den Symlink `current`, weil der OPcache von Strato Skripte unter dem Symlink-Pfad zwischenspeichert und sonst nach dem Umschalten die alte Version ausliefert. Sie sperrt interne Dateien (403) und setzt per `AddType application/x-httpd-php84 .php` die Web-PHP-Version **nur für diesen Ordner** auf die CLI-Version – andere Anwendungen im Paket bleiben unberührt. SSL-Zertifikat für die Domain aktivieren.
11. **Cronjob** (Kundenlogin › Cronjobs), jede Minute:
```
/opt/RZphp84/bin/php-cli <home>/<DEPLOY_PATH>/current/artisan schedule:run
@@ -66,8 +66,11 @@ ## 4. Tägliche Nutzung
| Aufgabe | Befehl |
|---|---|
| Neue Version ausliefern | `bash scripts/deploy.sh production deploy` (baut den **letzten Commit**) |
| Zurück zur vorigen Version | `bash scripts/deploy.sh production rollback` (Migrationen bleiben bestehen) |
| Versionen anzeigen | `bash scripts/deploy.sh production releases` |
| Bestimmten Stand ausliefern | `bash scripts/deploy.sh production deploy <commit oder tag>` |
| Zurück zu einer früheren Version | `bash scripts/deploy.sh production releases` zeigt die Deploy-Tags; dann `bash scripts/deploy.sh production deploy deploy/production/<zeitstempel>` (Migrationen werden nicht zurückgenommen) |
| Sofort zurück, solange die alte Version noch auf dem Server liegt (nur während eines laufenden Deployments) | `bash scripts/deploy.sh production rollback` |
**Versionsgeschichte in Gitea statt auf Strato:** Strato begrenzt die Anzahl der Dateien im Paket (eine Version ≈ 15.000 Dateien). Auf dem Server liegt deshalb nur die **aktive** Version, während eines Deployments kurz zusätzlich die neue. Die alte wird erst gelöscht, wenn die neue den Gesundheitscheck bestanden hat – schlägt er fehl, wird automatisch zurückgeschaltet. Jede erfolgreiche Auslieferung wird als Tag `deploy/<umgebung>/<zeitstempel>` in Gitea festgehalten; ein Build ist durch `composer.lock`/`package-lock.json` reproduzierbar. Außerdem entfernt der Build Sprachdateien außer de/en sowie Tests/Doku aus `vendor` (~4.800 Dateien weniger).
| Artisan auf dem Server | `bash scripts/deploy.sh production artisan about` |
Windows: in Git Bash ausführen; `COMPOSER_BIN="php /c/…/composer.phar"` in der `.env`-Datei des Deployments setzen, falls `composer` nicht im PATH ist.
@@ -82,4 +85,8 @@ ## 6. Getestet / offen
- Lokal im Testmodus (`DEPLOY_HOST=local`) erfolgreich: Build (~19 MB), Upload, Entpacken, alle Migrationen auf frischer Datenbank, `optimize`, Ersteinrichtung per `ProductionSeeder`, alle Seiten und Admin-Login liefern 200.
- **Nicht** unter Windows prüfbar: der Symlink-Wechsel von `current` (Git Bash legt Kopien statt Symlinks an). Unter Linux (Strato) ist das Standardverhalten; der erste Lauf auf dem Testbetrieb bestätigt es – bei Fehler greift der automatische Rollback.
- Bei Strato zu prüfen: SSH im Tarif, PHP-CLI-Pfad, ob das Domain-Ziel einem Symlink (`current`) folgt, minütliche Cronjobs.
- **Auf Strato erfolgreich (22.10.2026, test.fewo-stommer.de):** SSH mit Schlüssel (paketspezifischer Server), PHP-CLI `/opt/RZphp84/bin/php-cli`, Migrationen auf MariaDB, Symlink-Umschaltung, `.htaccess`-Weiterleitung, Web-PHP 8.4 per `AddType`, `ProductionSeeder`; alle Seiten 200.
- Testbetrieb läuft unter **https://stommer.info** (Domain-Ziel: Ordner `test.fewo-stommer.de`; SSL für Subdomains ist im Paket nicht verfügbar). Gesundheitscheck über HTTPS mit automatischem Rollback funktioniert.
- Behoben: OPcache lieferte nach dem Umschalten die alte Version (→ `.htaccess` zeigt auf den konkreten Release-Ordner); URLs mit `/current/public` (→ `URL::forceRootUrl(APP_URL)` außerhalb von local/testing).
- Noch offen: Cronjob.
- Erstes Deployment auf ein neues Ziel: `SKIP_HEALTH_CHECK=1 bash scripts/deploy.sh <env> deploy` (die Domain zeigt da noch nicht auf die neue Installation).
@@ -20,7 +20,7 @@
<meta property="og:image" content="{{ $ogImage }}">
@endisset
<link rel="canonical" href="{{ url()->current() }}">
@if ($theme->isPreview)
@if ($theme->isPreview || ! app()->isProduction())
<meta name="robots" content="noindex">
@endif
@vite($theme->assets())
+6 -5
View File
@@ -1,8 +1,8 @@
# Copy to scripts/deploy.production.env (or deploy.staging.env) and fill in. These files are not committed.
# SSH access (Strato: Kundenlogin › Datenbanken und Webspace › SFTP & SSH)
DEPLOY_HOST=ssh.strato.de
DEPLOY_USER=www.fewo-stommer.de
# SSH access (Strato: Kundenlogin › Datenbanken und Webspace › SFTP & SSH › Details › "Server", e.g. 12345678.ssh.w1.strato.hosting)
DEPLOY_HOST=12345678.ssh.w1.strato.hosting
DEPLOY_USER=stu123456789
DEPLOY_PORT=22
# Optional: private key file (otherwise the SSH agent / default key is used)
# DEPLOY_SSH_KEY=~/.ssh/strato_fewo
@@ -16,8 +16,9 @@ DEPLOY_PHP=/opt/RZphp84/bin/php-cli
# Public address for the health check after switching (empty = no check, no automatic rollback)
DEPLOY_URL=https://www.fewo-stommer.de
# Number of releases kept on the server for rollbacks
DEPLOY_KEEP=5
# After a successful deployment, tag the commit as deploy/<environment>/<timestamp> and push the tag to Gitea
# (the server keeps only the active release; going back = deploy an older tag). 0 = no tags.
DEPLOY_TAG=1
# Local build: how Composer is called (Windows example: "php /c/path/to/composer.phar")
# COMPOSER_BIN=composer
+91 -16
View File
@@ -3,18 +3,22 @@
# Deployment to Strato (or any SSH host offering bash, tar and a PHP CLI) with atomic releases.
#
# scripts/deploy.sh <environment> setup create the folder structure on the server (once)
# scripts/deploy.sh <environment> deploy build, upload, migrate, switch, health check (rollback on failure)
# scripts/deploy.sh <environment> rollback switch back to the previous release
# scripts/deploy.sh <environment> releases list releases on the server
# scripts/deploy.sh <environment> deploy [ref] build a Git commit/tag (default HEAD), upload, migrate, switch,
# health check (switch back on failure), tag it in Gitea
# scripts/deploy.sh <environment> rollback switch back while the previous release is still on the server
# scripts/deploy.sh <environment> releases active release on the server and deployment tags in Git
# scripts/deploy.sh <environment> artisan <args> run an artisan command in the active release
#
# Settings come from scripts/deploy.<environment>.env (not committed, see scripts/deploy.example.env)
# or from environment variables (CI). Server layout below DEPLOY_PATH:
#
# releases/<timestamp>/ one folder per release (code, vendor, built assets)
# releases/<timestamp>/ the active release (code, vendor, built assets); during a deployment also the new one.
# Older releases are not kept (Strato file quota) – history lives in Git as tags
# deploy/<environment>/<timestamp>; going back = deploy that tag again.
# shared/.env production settings – created by hand once
# shared/storage/ uploads, logs, sessions, cache – survive every release
# current -> releases/… active release; the domain's target directory is current/public
# current -> releases/… active release (CLI, cron); the domain points at DEPLOY_PATH, whose .htaccess
# forwards to the active release's public folder
#
set -euo pipefail
@@ -34,9 +38,10 @@ fi
DEPLOY_USER="${DEPLOY_USER:-}"
DEPLOY_PORT="${DEPLOY_PORT:-22}"
DEPLOY_PHP="${DEPLOY_PHP:-/opt/RZphp84/bin/php-cli}"
DEPLOY_KEEP="${DEPLOY_KEEP:-5}"
DEPLOY_TAG="${DEPLOY_TAG:-1}"
DEPLOY_URL="${DEPLOY_URL:-}"
DEPLOY_SSH_KEY="${DEPLOY_SSH_KEY:-}"
DEPLOY_SSH_KEY="${DEPLOY_SSH_KEY/#\~/$HOME}"
COMPOSER_BIN="${COMPOSER_BIN:-composer}"
say() { printf '\n\033[1;34m▶ %s\033[0m\n' "$*"; }
@@ -50,25 +55,62 @@ base="$1"; php="$2"; cmd="$3"; shift 3
mkdir -p "$base"
cd "$base"
# The web is served from the concrete release folder, not through the "current" symlink: Strato's
# OPcache keys scripts by the symlinked path and would keep serving the previous release.
# Strato: the web server's PHP version can be chosen per folder; use the same version as the CLI.
write_htaccess() {
local target="$1"
local web_php
web_php="$(printf '%s' "$php" | grep -oE 'RZphp[0-9]+' | grep -oE '[0-9]+' || true)"
{ [[ -n "$web_php" ]] && echo "AddType application/x-httpd-php$web_php .php"; cat <<HTACCESS
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(releases/(?!$target/public/)|shared(/|$)|current(/|$)|\.|upload-) - [F,L]
RewriteCond %{REQUEST_URI} !^/releases/$target/public/
RewriteRule ^(.*)\$ releases/$target/public/\$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
Require all denied
</IfModule>
HTACCESS
} > .htaccess.new
mv -f .htaccess.new .htaccess
}
switch_to() {
ln -sfn "$1" current.new
mv -Tf current.new current
write_htaccess "$(basename "$1")"
}
case "$cmd" in
setup)
mkdir -p releases shared/storage/app/public shared/storage/framework/cache/data shared/storage/framework/sessions shared/storage/framework/views shared/storage/logs
# For hosting panels that cannot point a domain at a symlink: the domain points at this folder,
# .htaccess forwards to the active release's public folder and blocks all internal files.
active="$(readlink current 2>/dev/null || true)"
if [[ -n "$active" ]]; then write_htaccess "$(basename "$active")"; else printf 'Require all denied
' > .htaccess; fi
echo ".htaccess angelegt (Domain-Ziel: $base)."
if [[ -f shared/.env ]]; then echo "shared/.env vorhanden."; else echo "HINWEIS: Bitte $base/shared/.env anlegen (Vorlage: .env.production.example)."; fi
echo "PHP: $("$php" -v | head -n 1)"
;;
receive)
release="$1"
mkdir -p "releases/$release"
tar -xzf "upload-$release.tgz" -C "releases/$release"
tar -xzf "upload-$release.tgz" -C "releases/$release" || { rm -rf "releases/$release" "upload-$release.tgz"; exit 1; }
rm -f "upload-$release.tgz"
;;
cleanup)
# Everything except the active release: older releases, leftovers of aborted uploads.
active="$(basename "$(readlink current 2>/dev/null || echo none)")"
for dir in releases/*; do
[[ -d "$dir" && "$(basename "$dir")" != "$active" ]] && rm -rf "$dir" && echo "Entfernt: $dir"
done
rm -f upload-*.tgz
;;
activate)
release="$1"; keep="$2"; dir="releases/$release"
release="$1"; dir="releases/$release"
[[ -f shared/.env ]] || { echo "shared/.env fehlt – erst anlegen (siehe docs/DEPLOYMENT.md)." >&2; exit 1; }
rm -rf "$dir/storage"
ln -s ../../shared/storage "$dir/storage"
@@ -83,7 +125,6 @@ case "$cmd" in
)
readlink current > .previous_release 2>/dev/null || true
switch_to "$dir"
ls -1d releases/* | sort | head -n -"$keep" | xargs -r rm -rf
echo "Aktiv: $release"
;;
rollback)
@@ -92,13 +133,13 @@ case "$cmd" in
if [[ -z "$target" || "$target" == "$active" || ! -d "$target" ]]; then
target="$(ls -1d releases/* | sort | grep -vx "$active" | tail -n 1 || true)"
fi
[[ -n "$target" && -d "$target" ]] || { echo "Keine frühere Version vorhanden." >&2; exit 1; }
[[ -n "$target" && -d "$target" ]] || { echo "Keine frühere Version mehr auf dem Server – stattdessen einen Deploy-Tag erneut ausliefern (siehe: releases)." >&2; exit 1; }
switch_to "$target"
echo "$active" > .previous_release
echo "Zurückgeschaltet auf: $target (Datenbank-Migrationen werden dabei nicht zurückgenommen)"
;;
releases)
ls -1 releases
echo "Auf dem Server: $(ls -1 releases | tr '\n' ' ')"
echo "Aktiv: $(readlink current 2>/dev/null || echo '–')"
;;
artisan)
@@ -140,29 +181,54 @@ upload() {
fi
}
# Strato limits the number of files per package (inode quota), and every release carries ~19,000 files.
# Removes what the application never loads at runtime: translations other than de/en, tests and docs.
prune_vendor() {
local before
before="$(find vendor -type f | wc -l)"
find vendor -mindepth 5 -maxdepth 5 -type d -path '*/resources/lang/*' ! -name de ! -name en -exec rm -rf {} +
find vendor/nesbot/carbon/src/Carbon/Lang -type f ! -name 'de*' ! -name 'en*' -delete 2>/dev/null || true
find vendor -mindepth 3 -maxdepth 3 -type d \( -name tests -o -name docs -o -name .github \) -exec rm -rf {} +
find vendor -type f \( -iname '*.md' -o -name 'phpunit.xml*' -o -name '.gitattributes' -o -name '.editorconfig' \) -delete
echo "vendor: $before → $(find vendor -type f | wc -l) Dateien"
}
build() {
say "Baue Version aus Git-Stand $(git -C "$ROOT" rev-parse --short HEAD)"
if [[ -n "$(git -C "$ROOT" status --porcelain)" ]]; then
REVISION="$(git -C "$ROOT" rev-parse --verify "$REF^{commit}")" || fail "Unbekannter Git-Stand: $REF"
say "Baue Version aus Git-Stand $REF (${REVISION:0:7})"
if [[ "$REF" == "HEAD" && -n "$(git -C "$ROOT" status --porcelain)" ]]; then
echo "Hinweis: Nicht committete Änderungen werden NICHT ausgeliefert (gebaut wird der letzte Commit)."
fi
BUILD_DIR="$(mktemp -d)"
git -C "$ROOT" archive --format=tar HEAD | tar -x -C "$BUILD_DIR"
git -C "$ROOT" archive --format=tar "$REVISION" | tar -x -C "$BUILD_DIR"
(
cd "$BUILD_DIR"
$COMPOSER_BIN install --no-dev --prefer-dist --optimize-autoloader --no-interaction --no-progress
npm ci --no-audit --no-fund
npm run build
rm -rf node_modules tests docs .gitea .github scripts storage .env.example .env.production.example .ai .claude .cursor AGENTS.md CLAUDE.md boost.json phpunit.xml
git -C "$ROOT" rev-parse HEAD > REVISION
prune_vendor
echo "$REVISION" > REVISION
)
ARCHIVE="$BUILD_DIR.tgz"
tar -czf "$ARCHIVE" -C "$BUILD_DIR" .
echo "Paket: $(du -h "$ARCHIVE" | cut -f1)"
}
# Records the live version in Git (and Gitea) – the release history, since the server keeps no old releases.
tag_release() {
[[ "$DEPLOY_TAG" == "1" ]] || return 0
local tag="deploy/$ENVIRONMENT/$1"
git -C "$ROOT" -c user.name="${GIT_AUTHOR_NAME:-deploy}" -c user.email="${GIT_AUTHOR_EMAIL:-deploy@localhost}" tag -a "$tag" -m "Deployed to $ENVIRONMENT" "$REVISION" || { echo "Hinweis: Git-Tag $tag konnte nicht angelegt werden."; return 0; }
git -C "$ROOT" push -q origin "$tag" 2>/dev/null || git -C "$ROOT" push -q origin "$tag" || echo "Hinweis: Tag $tag nur lokal angelegt – bitte später 'git push origin $tag'."
echo "Git-Tag: $tag"
}
health_check() {
[[ -n "$DEPLOY_URL" ]] || { echo "Kein DEPLOY_URL gesetzt – Gesundheitscheck übersprungen."; return 0; }
# First deployment: the domain does not point to current/public yet.
[[ "${SKIP_HEALTH_CHECK:-}" == "1" ]] && { echo "SKIP_HEALTH_CHECK=1 – Gesundheitscheck übersprungen."; return 0; }
say "Prüfe $DEPLOY_URL/up"
for attempt in 1 2 3 4 5; do
if curl -fsS --max-time 15 "$DEPLOY_URL/up" > /dev/null; then
@@ -180,18 +246,24 @@ case "$COMMAND" in
remote setup
;;
deploy)
REF="${1:-HEAD}"
build
RELEASE="$(date -u +%Y%m%d%H%M%S)"
say "Räume Server auf (nur die aktive Version bleibt)"
remote cleanup
say "Übertrage Version $RELEASE"
upload "$ARCHIVE" "$RELEASE"
remote receive "$RELEASE"
say "Migrieren, Caches aufwärmen, umschalten"
remote activate "$RELEASE" "$DEPLOY_KEEP"
remote activate "$RELEASE"
if ! health_check; then
say "Gesundheitscheck fehlgeschlagen – schalte zurück"
remote rollback
remote cleanup
fail "Deployment zurückgerollt. Logs: scripts/deploy.sh $ENVIRONMENT artisan about / shared/storage/logs"
fi
remote cleanup
tag_release "$RELEASE"
rm -rf "$BUILD_DIR" "$ARCHIVE"
say "Fertig: Version $RELEASE ist live."
;;
@@ -201,6 +273,9 @@ case "$COMMAND" in
;;
releases)
remote releases
echo "Deploy-Tags in Git (neueste zuerst; zurück mit: scripts/deploy.sh $ENVIRONMENT deploy <tag>):"
git -C "$ROOT" fetch -q --tags origin 2>/dev/null || true
git -C "$ROOT" tag -l "deploy/$ENVIRONMENT/*" --sort=-refname | head -n 10
;;
artisan)
remote artisan "$@"
+93
View File
@@ -0,0 +1,93 @@
<?php
namespace Tests\Feature;
use App\Enums\PhotoCategory;
use App\Models\Photo;
use App\Models\Property;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Storage;
use Tests\TestCase;
class PhotoImportTest extends TestCase
{
use RefreshDatabase;
private string $sourceDirectory;
protected function setUp(): void
{
parent::setUp();
Storage::fake('public');
$this->sourceDirectory = storage_path('framework/testing/photo-import');
File::ensureDirectoryExists($this->sourceDirectory.'/2023/11');
foreach (['2023/11/01_wohn_web.jpg', '2023/11/20_garten_web.jpg'] as $file) {
$image = UploadedFile::fake()->image(basename($file), 1200, 800);
File::copy($image->getPathname(), $this->sourceDirectory.'/'.$file);
}
}
protected function tearDown(): void
{
File::deleteDirectory($this->sourceDirectory);
parent::tearDown();
}
public function test_manifest_import_uses_categories_and_descriptions_and_keeps_the_sources(): void
{
$property = Property::factory()->create();
$manifest = $this->manifest([
'2023/11/01_wohn_web.jpg;apartment;Wohn- und Essbereich',
'2023/11/20_garten_web.jpg;outdoor;Sitzplatz im Garten',
'2023/11/fehlt.jpg;area;Gibt es nicht',
]);
$this->artisan('photos:import', ['directory' => $this->sourceDirectory, '--manifest' => $manifest])
->expectsOutputToContain('Fehlt: 2023/11/fehlt.jpg')
->expectsOutputToContain('2 Bilder importiert.')
->assertSuccessful();
$photos = Photo::orderBy('sort_order')->get();
$this->assertSame(['Wohn- und Essbereich', 'Sitzplatz im Garten'], $photos->pluck('alt_text')->all());
$this->assertSame([PhotoCategory::Apartment, PhotoCategory::Outdoor], $photos->pluck('category')->all());
$this->assertTrue($photos->every(fn (Photo $photo): bool => $photo->property_id === $property->id));
$this->assertFileExists($this->sourceDirectory.'/2023/11/01_wohn_web.jpg');
}
public function test_running_the_import_again_skips_photos_already_imported(): void
{
Property::factory()->create();
$manifest = $this->manifest(['2023/11/01_wohn_web.jpg;apartment;Wohn- und Essbereich']);
$this->artisan('photos:import', ['directory' => $this->sourceDirectory, '--manifest' => $manifest])->assertSuccessful();
$this->artisan('photos:import', ['directory' => $this->sourceDirectory, '--manifest' => $manifest])
->expectsOutputToContain('bereits vorhanden: 2023/11/01_wohn_web.jpg')
->assertSuccessful();
$this->assertSame(1, Photo::count());
}
public function test_invalid_manifest_line_aborts_before_importing(): void
{
$manifest = $this->manifest(['2023/11/01_wohn_web.jpg;keller;Unbekannte Kategorie']);
$this->artisan('photos:import', ['directory' => $this->sourceDirectory, '--manifest' => $manifest])->assertFailed();
$this->assertSame(0, Photo::count());
}
/**
* @param list<string> $lines
*/
private function manifest(array $lines): string
{
$path = $this->sourceDirectory.'/photos.csv';
File::put($path, implode("\n", ['file;category;alt_text', ...$lines])."\n");
return $path;
}
}
@@ -0,0 +1,72 @@
<?php
namespace Tests\Feature;
use App\Enums\UserRole;
use App\Filament\Resources\Bookings\BookingResource;
use App\Models\User;
use Filament\Facades\Filament;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Hash;
use Tests\TestCase;
class TwoFactorAuthenticationTest extends TestCase
{
use RefreshDatabase;
public function test_admin_without_two_factor_must_set_it_up_first(): void
{
$this->actingAs(User::factory()->withoutTwoFactor()->create());
$setUpUrl = Filament::getPanel('admin')->getSetUpRequiredMultiFactorAuthenticationUrl();
$this->get(BookingResource::getUrl('index'))->assertRedirect($setUpUrl);
$this->get($setUpUrl)->assertOk()->assertSee('Authenticator', false);
}
public function test_admin_with_two_factor_enters_the_admin(): void
{
$this->actingAs(User::factory()->create());
$this->get(BookingResource::getUrl('index'))->assertOk();
}
public function test_other_roles_may_work_without_two_factor(): void
{
$this->actingAs(User::factory()->role(UserRole::Rentals)->withoutTwoFactor()->create());
$this->get(BookingResource::getUrl('index'))->assertOk();
}
public function test_two_factor_secret_is_stored_encrypted(): void
{
$user = User::factory()->create();
$this->assertNotSame('JBSWY3DPEHPK3PXP', $user->getRawOriginal('app_authentication_secret'));
$this->assertSame('JBSWY3DPEHPK3PXP', $user->fresh()->getAppAuthenticationSecret());
}
public function test_command_creates_an_admin_with_interactively_entered_password(): void
{
$this->artisan('users:create', ['email' => 'Lars@Example.com', '--name' => 'Lars', '--role' => 'admin'])
->expectsQuestion('Passwort (mind. 12 Zeichen)', 'ein-sicheres-passwort')
->expectsQuestion('Passwort wiederholen', 'ein-sicheres-passwort')
->assertSuccessful();
$user = User::firstWhere('email', 'lars@example.com');
$this->assertSame(UserRole::Admin, $user->role);
$this->assertTrue(Hash::check('ein-sicheres-passwort', $user->password));
$this->assertNull($user->getAppAuthenticationSecret());
}
public function test_command_rejects_mismatching_passwords(): void
{
$this->artisan('users:create', ['email' => 'lars@example.com', '--name' => 'Lars', '--role' => 'admin'])
->expectsQuestion('Passwort (mind. 12 Zeichen)', 'ein-sicheres-passwort')
->expectsQuestion('Passwort wiederholen', 'etwas-anderes-passwort')
->assertFailed();
$this->assertDatabaseCount('users', 0);
}
}