whoami

Lucas Jenß

cat /etc/motd

The Coding Journal ツ — Notes taken on an epic coding journey. Technical solutions, debugging notes, and practical guides from the trenches of software development.

Close-up of white dominoes with black dots standing on green felt surface, shallow depth of field, focused mood

ls -la ~/languages/

total 8
drwxr-xr-x
▶ PHP
▶ Ruby
▶ Scala
▶ C#
▶ JavaScript
▶ Objective-C
▶ Shell Scripting

ls -la ~/toolchain/

total 7
drwxr-xr-x
▶ Typo3
▶ Akka
▶ Capistrano
▶ Git
▶ MAMP
▶ Adobe Illustrator
▶ NSTrackingArea (Cocoa)

uname -a

platforms
drwxr-xr-x
▶ Mac OS X
▶ Unix

A practical TYPO3 Docker setup with database snapshots

A repeatable local environment makes TYPO3 development much easier to maintain. Docker can provide the web server, PHP runtime, database, and supporting services without requiring every developer to reproduce the same stack manually. When the project is stored in a Git repository and its database can be restored from a known snapshot, testing becomes safer and troubleshooting becomes far less mysterious.

This approach suits the kind of practical development notes collected on Coding Journal, especially when a project involves older TYPO3 installations, custom extensions, or a local reproduction of a production issue. The goal is not to create a perfect hosting platform on a laptop, but to build a dependable workstation that can be discarded and recreated.

Approach Best use Main advantage Main limitation
Docker Compose with MariaDB Daily TYPO3 development Consistent PHP and database services Requires basic Docker knowledge
Local PHP and database installation Small experiments Quick access to native tools Versions can drift between machines
Full database dump Backup and project handover Portable and easy to archive Restores can take time for large databases
Compressed SQL snapshot Regular development resets Fast, repeatable refreshes Must be matched with compatible files
Shared remote development database Team testing Common data set Network dependency and risk of accidental changes

Choose compatible project versions

Start by identifying the TYPO3 major version, PHP requirement, database engine, and package manager configuration. TYPO3 v11, v12, and v13 projects can have substantially different PHP requirements, so using the newest PHP image available is not necessarily helpful. Check composer.json, the lock file, the project documentation, and any deployment configuration before selecting Docker images.

A typical modern setup might use PHP-FPM with Apache or Nginx, MariaDB, and Composer. For a legacy installation, the correct combination could be PHP 7.4 and an older MariaDB release. Compatibility matters more than novelty: a container that runs PHP 8.3 may expose errors that do not exist in the production environment, while an old application may fail before TYPO3 can display a useful exception.

Create a .env file for local values such as the database name, user, password, and exposed port. Keep secrets out of Git, even when they are used only for development. Australian teams often work across Sydney, Melbourne, Brisbane, and remote locations, so predictable configuration is particularly useful when a project moves between laptops or contractors.

Build the Compose services

A compact compose.yaml can define the database and application services. The exact web server arrangement depends on the project, but the database should have a named volume so that ordinary container restarts do not remove local data.

services:
  db:
    image: mariadb:10.11
    environment:
      MARIADB_DATABASE: typo3
      MARIADB_USER: typo3
      MARIADB_PASSWORD: localpass
      MARIADB_ROOT_PASSWORD: rootpass
    ports:
      - "3307:3306"
    volumes:
      - db_data:/var/lib/mysql

  php:
    build: .
    volumes:
      - ./:/var/www/html
    depends_on:
      - db

volumes:
  db_data:

The Dockerfile should install the PHP extensions TYPO3 requires, commonly including PDO MySQL, GD, Intl, Zip, and mbstring. Composer can be installed in the image or run through a dedicated Composer container. Mounting the project directory keeps source changes visible immediately, while the database volume preserves records, pages, users, and configuration between sessions.

Run docker compose up -d --build, then inspect the logs with docker compose logs -f. A healthy database container does not always mean TYPO3 is ready; the application may still need Composer dependencies, an environment-specific configuration file, file permissions, and an initial cache flush. Treat each service as a separate failure point rather than assuming every problem belongs to TYPO3.

Connect TYPO3 to the container database

Inside the PHP container, the database host is the Compose service name, such as db, not localhost. The port is normally 3306 inside the Docker network, even if the host exposes it as 3307 for local tools. This distinction causes many first-start connection errors.

Configure the TYPO3 database connection with the correct host, database name, username, password, and driver. Depending on the TYPO3 release, settings may live in config/system/settings.php, environment-specific configuration, or an installer-generated file. Keep machine-specific values outside version control where practical, while committing the configuration needed to explain how the application is assembled.

File storage must be treated separately from the database. A SQL dump contains pages, content elements, users, categories, and extension records, but it does not automatically contain fileadmin, processed assets, uploaded media, or private application files. If a snapshot is intended to reproduce a real issue, copy the matching file tree as well. This is especially important for image-heavy sites operated by Australian retailers, universities, and government suppliers.

TYPO3’s install tool and backend may also need a writable var directory. In a development container, use a suitable user or correct the permissions during image creation rather than applying broad write access to the entire project. Avoid casually using chmod -R 777; it can hide ownership mistakes and create habits that are unsafe in a deployed environment.

Create reliable database snapshots

A database snapshot for local TYPO3 work is usually a logical SQL export. Create it from the running MariaDB service rather than relying on a raw copy of the database volume. A portable dump can be imported into another machine, archived with a project handover, or used to reset a broken test environment.

docker compose exec db mariadb-dump \
  -u typo3 -plocalpass typo3 \
  --single-transaction --routines --triggers \
  > snapshots/typo3-$(date +%Y%m%d-%H%M).sql

For a larger database, compress the result immediately:

gzip snapshots/typo3-20250308-1030.sql

Use a naming convention that records the date, project, and perhaps the source environment. Do not place real production credentials in shell history or commit a dump containing personal information. Australian privacy obligations can apply to customer names, email addresses, addresses, and support records, so sanitise exported data before giving it to developers or uploading it to a shared drive.

A snapshot is useful only when its boundaries are clear. Record the TYPO3 version, Composer lock file, extension revisions, and related fileadmin archive alongside the SQL file. A database from one code revision can behave unpredictably with another, particularly when an extension has changed its database schema. For regular local resets, keep one known-good baseline and generate temporary snapshots before risky migrations.

Restore and refresh without surprises

Before restoring, stop requests that could write to the database and make a safety copy of the current local state. Then recreate the database or remove its existing tables, depending on how isolated the environment is. A clean restore avoids confusing old records with data from the snapshot.

docker compose exec -T db mariadb \
  -u typo3 -plocalpass typo3 \
  < snapshots/typo3-20250308-1030.sql

If the dump is compressed, pipe it through gzip -d:

gzip -dc snapshots/typo3-20250308-1030.sql.gz | \
  docker compose exec -T db mariadb -u typo3 -plocalpass typo3

After importing, copy the matching assets into fileadmin and restore private files where the project requires them. Clear TYPO3 caches through the backend, the Install Tool, or the command-line tooling available in that release. If the site reports missing database fields, check extension activation and schema updates before changing application code.

A restored environment should then be tested like a small deployment. Open the frontend, sign in to the backend, edit a content element, upload an image, run a search, and check scheduled tasks if they are part of the project. When a browser rendering issue appears, notes such as these SVG debugging notes can help separate an asset problem from a TYPO3 or Docker problem.

Make the workflow safe for daily development

Keep compose.yaml, the Dockerfile, Composer files, setup scripts, and a sanitised example environment in version control. Exclude database dumps, .env files, cache directories, logs, and generated assets from the normal repository unless the team has a deliberate reason to store them. A short README.md should explain the required Docker version, startup command, backend URL, database reset procedure, and snapshot location.

Add a simple Makefile or shell wrapper so common operations are consistent:

up:
	docker compose up -d --build

logs:
	docker compose logs -f

snapshot:
	mkdir -p snapshots
	docker compose exec db mariadb-dump -u typo3 -plocalpass typo3 > snapshots/latest.sql

down:
	docker compose down

For collaborative work, distinguish between a disposable local snapshot and an approved shared baseline. A developer in Perth may need a different timezone or mail-capture setup from someone in Melbourne, but those differences should be explicit configuration rather than undocumented edits. Mailhog or a similar local mail service can prevent test messages from reaching real customers, while a local reverse proxy can reproduce hostname-dependent behaviour.

Use health checks and document recovery steps. If the database volume becomes corrupt, the team should know whether to restore a dump, rebuild the volume, or obtain a fresh sanitised snapshot. Keep at least one recent backup outside the laptop, and test restoration periodically. A snapshot that has never been imported is only an assumption about recoverability.

Build the environment once, then use snapshots to return it to a known state whenever an experiment goes wrong. Store the Compose files and setup notes with the project, create a sanitised baseline, and verify both the database and uploaded files during every restore. This gives TYPO3 developers a practical local system that is consistent enough for debugging and disposable enough for fast experimentation.


cat ~/interests.json

KeyValue
editorTerminal-first workflow
osMac OS X / Unix
vcsGit, distributed version control
deployCapistrano, cron automation
graphicsSVG, Adobe Illustrator troubleshooting
networkingIP validation, SSH, VPN

git log --oneline --reverse

2013-10-30

Solving SVG import issues in Adobe Illustrator CS6 and CC

When importing an SVG into Illustrator, the operation fails with an unknown error [CANT]. A workaround for this Adobe-side bug.

2013

Solving NDK build issues on OS X

Troubleshooting native development kit compilation problems on Mac OS X.

2013

Programmatically adding PHP generated TypoScript to the backend configuration

Integrating dynamically generated TypoScript into Typo3 backend setups using PHP.

2013

ArgumentError: Could not parse PKey: no start line

Debugging an SSH key parsing error encountered during deployment.

2011-08-04

Validating IP-Addresses in PHP

Using PHP filter functions with flags like FILTER_FLAG_IPV4 and FILTER_FLAG_IPV6, and understanding how filter_var handles reserved IP addresses.

2011-07-09

Cocoa: Using NSTrackingArea

A short tutorial on using Cocoa's NSTrackingArea to capture mouseEntered and mouseExited events.


cat ~/contact.txt

github: github.com/x3ro
stackoverflow: x3ro
coderwall: coderwall.com/x3ro
twitter: @x3rames