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
21 changes: 21 additions & 0 deletions src/typo3/.devcontainer/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.git
.gitignore
.github
.devcontainer
.vscode
*.md
*.txt
.DS_Store
Thumbs.db
node_modules
.npm
.eslintcache
.next
dist
build
coverage
.env.local
.env.*.local
*.log
tmp
temp
4 changes: 4 additions & 0 deletions src/typo3/.devcontainer/.env
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,15 @@ DB_CONNECTION_ROOT_PASSWORD=dbroot
TYPO3_CONTEXT=Development
#TYPO3_CONTEXT=Production

# backend docker containers are NOT started if TYPO3_INSTALL_DB_DRIVER is set to 'pdo_sqlite'
TYPO3_INSTALL_DB_DRIVER=mysqli
TYPO3_INSTALL_DB_USER=db
TYPO3_INSTALL_DB_PASSWORD=db

# DO NOT MODIFY THE HOST AND PORT SETTINGS, UNLESS YOU KNOW WHAT YOU ARE DOING. THEY ARE USED TO CONNECT TO THE DATABASE CONTAINER.
TYPO3_INSTALL_DB_HOST=127.0.0.1
TYPO3_INSTALL_DB_PORT=3306

TYPO3_INSTALL_DB_USE_EXISTING=true
TYPO3_INSTALL_DB_DBNAME=db
TYPO3_INSTALL_ADMIN_USER=admin
Expand Down
56 changes: 0 additions & 56 deletions src/typo3/.devcontainer/README.md

This file was deleted.

Binary file not shown.
Binary file not shown.
2 changes: 2 additions & 0 deletions src/typo3/.devcontainer/docker/docker-compose.backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ services:
target: /docker-entrypoint-initdb.d
networks:
- devcontainer
profiles: [mysql]
ports:
- 3306:3306
env_file:
Expand All @@ -66,6 +67,7 @@ services:
TZ: "Europe/Berlin"
networks:
- devcontainer
profiles: [mysql, mariadb]
ports:
- 8080:8080
depends_on:
Expand Down
6 changes: 6 additions & 0 deletions src/typo3/.devcontainer/docker/initializeTYPO3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ echo "BEGIN: initializeTYPO3.sh"
echo "initializeTYPO3: Checking if site already has been initialized"
if test ! -d .build/vendor; then
echo "initializeTYPO3: Initialize TYPO3"
composer require --dev "helhum/dotenv-connector": "*", "helhum/typo3-console": "*"
composer config allow-plugins.helhum/dotenv-connector true
composer config bin-dir .build/bin
composer config vendor-dir .build/vendor
composer config extra.typo3/cms.web-dir .build/public
composer config extra.helhum/dotenv-connector.env-file TYPO3.env
composer install
# Add .build/bin to PATH
[[ ":$PATH:" != *":${WORKSPACE_ROOT}/.build/bin:"* ]] && export PATH="${WORKSPACE_ROOT}/.build/bin:${PATH}"
Expand Down
2 changes: 1 addition & 1 deletion src/typo3/.devcontainer/postCreateCommandScript.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -eu
echo "BEGIN: postCreateCommandScript.sh"

# check if docker containers are already running only if docker cli is installed
if [[ `which docker` ]]; then
if [[ `which docker` -a ! $TYPO3_INSTALL_DB_DRIVER =~ pdo_sqlite ]]; then
echo "postCreateCommandScript: Checking if docker containers are already running"
if [ `docker compose ls -q --filter "name=^${COMPOSE_PROJECT_NAME}$" | wc -l` -eq 0 ]; then
compose_filename="${WORKSPACE_ROOT}/.devcontainer/docker/docker-compose.backend.yaml"
Expand Down
73 changes: 71 additions & 2 deletions src/typo3/NOTES.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,76 @@
# TYPO3 Notes
### Disclaimer

Development with TYPO3 is commonly done using [DDEV environment](https://docs.ddev.com/en/stable/users/quickstart/#typo3). Mainly designed for local use in Docker environment DDEV is being brought also to Codespaces and Kubenetes environments. Anyway DDEV is not outdated though Devcontainer technology seems to be more a standard technology the more tooling support is added.

# Additional information

Normally a TYPO3 setup consists of the following main parts

* PHP version as required by TYPO3 with the needed extensions enabled
* XDebug support enabled for development needs
* a webserver that
* is enabled to process the *.php files in the TYPO3 folders
* properly configured with secure filters and rewrite rules
* a database backed supported by TYPO3 version

This Devcontainer template is based upon the following ruleset:

* we make use of Docker-In-Docker (DIND) within the core devcontainer to provide the best "local-lookalike-feeling" for developers who could thereby launch any additional docker service they want
* the core devcontainer environment (based on Debian Trixie) contains the PHP environment needed for the designated TYPO3 version in addtion to the souce code checked out into the working directory
* a database backend is started as a separate docker service based on the selected `TYPO3_INSTALL_DB_DRIVER` in the file `.devcontainer/.env` (no backend if `sqlite` is configured)
* if a `composer.json` file is detected during initialization the PHP application will be automatically initialized

## Provided variances

Currently only variances of FrankenPHP webserver with the PHP versions from 8.2 to 8.5 are provided.
Currently only variances of FrankenPHP integrated webserver (Caddy) with the following PHP versions are provided:

* 8.2
* 8.3
* 8.4
* 8.5

FrankenPHP currently *only* runs in classic mode comparable to Apache/mod_php or PHP-FPM. Unfortunately worker mode is not supported by TYPO3 at this point of time.

![Architecture overview](doc/Devcontainer_FrankenPHP.drawio.png)

## Requirements

Some requirements regarding the composer configuration are automatically set during initialization before performing install. They MUST NOT be modified afterwards unless you don't want to make use of this devcontainer template anymore.

composer require --dev "helhum/dotenv-connector": "*", "helhum/typo3-console": "*"
composer config allow-plugins.helhum/dotenv-connector true
composer config bin-dir .build/bin
composer config vendor-dir .build/vendor
composer config extra.typo3/cms.web-dir .build/public
composer config extra.helhum/dotenv-connector.env-file TYPO3.env

# Useful hints

* Re-Initialize TYPO3 environment

If you need to get a clean TYPO3 environment based upon your configuration you may spawn a terminal window and execute

`${WORKSPACE_ROOT}/.devcontainer/docker/igniteEnvironment.sh`

* TYPO3 environment configuration

You may modify the file `${WORKSPACE_ROOT}/.devcontainer/.env` with caution if you want to adjust some core TYPO3 settings. After this file has been modified it is recommended to rebuild the whole devcontainer.

# Getting started with Devcontainer runtimes

## Github Codespaces

* Login to Github WebUI and select the desired branch
* select the dropdown field `<> Code` / Tab `Codespaces`
* in the rown `Codespaces` select the three dots</br>
(choosing `+` will launch the default configuration)
* select `+ New with options...`
* verify that the correct branch is selected
* choose the default devcontainer configuration
* verify the region
* choose a machine type (2 cores should be fine to start)
* select `Create codespace`</br>
Now a VS Code UI opens in the browser window.
* please be VERY patient now because all containers have to be build initially including the whole TYPO3 environment. You may follow the progress by pressing `Building codespace...` link in the bottom right corner:</br>
![Building codespace](doc/Github_VsCodeBuildingCodespace.png)</br>
If you later start the codespace again it will come up quickly.
10 changes: 5 additions & 5 deletions src/typo3/devcontainer-template.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"id": "typo3",
"version": "0.0.2",
"name": "Typo3 ",
"description": "TYPO3 development container template",
"version": "0.2.0",
"name": "Typo3",
"description": "A template to support remote development with TYPO3.",
"documentationURL": "https://github.com/thucke/devcontainer-templates/tree/main/src/typo3",
"licenseURL": "https://github.com/thucke/devcontainer-templates/blob/main/LICENSE",
"options": {
"phpVersion": {
"type": "string",
"description": "PHP version to use:",
"description": "Select the PHP version to use in the development container. You may choose PHP version from 8.2 to 8.5.",
"proposals": [
"8.2",
"8.3",
Expand All @@ -19,7 +19,7 @@
},
"webserver": {
"type": "string",
"description": "Which webserver do you prefer?",
"description": "Which webserver do you prefer? Currently only FrankenPHP is supported, but more options will be added in the future.",
"proposals": [
"frankenphp"
],
Expand Down
Loading