Compare commits

..

2 Commits

Author SHA1 Message Date
Raphael Martin
d52b173da5 inital commit 2023-11-26 12:25:23 +01:00
Raphael Martin
e356ff6734 inital commit 2023-11-26 12:24:49 +01:00
7 changed files with 395 additions and 1 deletions

12
.env.sample Normal file
View File

@ -0,0 +1,12 @@
MYSQL_ROOT_PASSWORD=PASSWORD
MYSQL_DATABASE=typo3
MYSQL_USER=DATABASEUSER
MYSQL_PASSWORD=DATABASEPASSWORD
PROJECT_URL=typo3.localhost
PROJECT_NAME=sample
TRAEFIK_NETWORK=traefik_net
PROJECT_DATA=./data

3
.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
.env
data

70
Dockerfile Normal file
View File

@ -0,0 +1,70 @@
# Dockerfile
# Docker image for TYPO3 CMS
FROM php:8.2-apache
LABEL maintainer="Raphael Martin <raphy.martin@protonmail.ch>"
ENV APACHE_RUN_USER a2g-www
ENV TYPO3_VERSION 12.4.8
ENV TYPO3_SHA256CHECKSUM 8293b3441ec133fc8f9174fab5b88f450044ded0e188a0f12de37ad60a8bf8b3
# change apache user
RUN adduser --uid 1000 --gecos 'Apache User' --disabled-password $APACHE_RUN_USER \
&& chown -R "$APACHE_RUN_USER:$APACHE_RUN_USER" /var/lock/apache2 /var/run/apache2
# update system
RUN apt-get update -y && apt-get upgrade -y
# Install TYPO3
RUN apt-get install -y --no-install-recommends \
wget \
# Configure PHP
libxml2-dev libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng-dev \
libpq-dev \
libzip-dev \
zlib1g-dev \
sendmail \
graphicsmagick && \
docker-php-ext-configure gd --with-libdir=/usr/include/ --with-jpeg --with-freetype && \
docker-php-ext-install -j$(nproc) mysqli soap gd zip opcache intl pgsql pdo_pgsql
# Clean
RUN apt-get -y purge \
libxml2-dev libfreetype6-dev \
libjpeg62-turbo-dev \
libmcrypt-dev \
libpng-dev \
libzip-dev \
zlib1g-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /usr/src/*
RUN mkdir /usr/local/surf && \
curl -L https://github.com/TYPO3/Surf/releases/download/3.4.6/surf.phar -o /usr/local/surf/surf.phar && \
chmod +x /usr/local/surf/surf.phar && \
ln -s /usr/local/surf/surf.phar /usr/local/bin/surf
# Configure Apache as needed
RUN a2enmod rewrite
RUN cd /tmp && \
wget -O download.tar.gz https://get.typo3.org/${TYPO3_VERSION} && \
echo "${TYPO3_SHA256CHECKSUM} /tmp/download.tar.gz" > /tmp/download.tar.gz.sum
RUN sha256sum -c "/tmp/download.tar.gz.sum"
RUN tar -xzf /tmp/download.tar.gz -C /var/www/ && \
rm /tmp/download*
RUN cd /var/www/html && \
ln -s ../typo3_src-* typo3_src && \
ln -s typo3_src/index.php && \
ln -s typo3_src/typo3 && \
touch FIRST_INSTALL
RUN chown -R $APACHE_RUN_USER:$APACHE_RUN_USER /var/www/html && \
chown -R $APACHE_RUN_USER:$APACHE_RUN_USER /var/www/typo3_src-*

View File

@ -1,2 +1,42 @@
# traefik_typo3 # traefik typo3
## get started
you will need a .env file
sample .env:
# .env
MYSQL_ROOT_PASSWORD=PASSWORD
MYSQL_DATABASE=typo3
MYSQL_USER=DATABASEUSER
MYSQL_PASSWORD=DATABASEPASSWORD
PROJECT_URL=typo3.localhost
PROJECT_NAME=sample
TRAEFIK_NETWORK=traefik_net
PROJECT_DATA=./data
then execute init with
./init
now the typo3 first install should be accessable: https://${PROJECT_URL}
if you use the sample .env: https://typo3.localhost
use for the db connection "db"
after the install there is at the a error.
we have to set in the ${PROJECT_DATA}/typo3conf/settings/settings.php
['SYS']['features']['security.backend.enforceReferrer'] = true
because we are behind the reverse proxy.

58
docker-compose.yml Normal file
View File

@ -0,0 +1,58 @@
version: '1'
networks:
default:
name: "${PROJECT_NAME}_typo3_db_net"
external: false
traefik:
name: "${TRAEFIK_NETWORK}"
external: true
services:
typo3:
container_name: "${PROJECT_NAME}_typo3"
hostname: "${PROJECT_URL}"
build: .
networks:
- "traefik"
volumes:
- "${PROJECT_DATA}/${PROJECT_NAME}-typo3/fileadmin:/var/www/html/fileadmin"
- "${PROJECT_DATA}/${PROJECT_NAME}-typo3/typo3conf:/var/www/html/typo3conf"
- "${PROJECT_DATA}/${PROJECT_NAME}-typo3/uploads:/var/www/html/uploads"
- "${PROJECT_DATA}/${PROJECT_NAME}-typo3/protected:/var/www/protected"
- "./php-conf/php.ini:/usr/local/etc/php/php.ini:ro"
- "/etc/timezone:/etc/timezone:ro"
- "/etc/localtime:/etc/localtime:ro"
depends_on:
- "db"
labels:
# Watchtower add to auto update
- "com.centurylinklabs.watchtower.enable=true"
# traefik
- "traefik.enable=true"
- "traefik.docker.network=${TRAEFIK_NETWORK}"
- "traefik.http.routers.${PROJECT_NAME}_typo3.rule=Host(`${PROJECT_URL}`)"
- "traefik.http.routers.${PROJECT_NAME}_typo3.entrypoints=websecure"
- "traefik.http.routers.${PROJECT_NAME}_typo3.tls=true"
- "traefik.http.services.${PROJECT_NAME}_typo3.loadbalancer.server.port=80"
db:
image: "mariadb:latest"
container_name: "${PROJECT_NAME}_typo3_db"
restart: "unless-stopped"
command:
- "--character-set-server=utf8mb4"
- "--collation-server=utf8mb4_unicode_ci"
env_file: ".env"
volumes:
- "db:/var/lib/mysql"
# - "${PROJECT_DATA}/${PROJECT_NAME}-typo3/db:/var/lib/mysql"
labels:
# Watchtower add to auto update
- "com.centurylinklabs.watchtower.enable=true"
# traefik
- "traefik.enable=false"
volumes:
db:
name: "${PROJECT_NAME}_db"

14
init Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
source ./.env
mkdir -p ${PROJECT_DATA}/${PROJECT_NAME}-typo3/fileadmin
mkdir -p ${PROJECT_DATA}/${PROJECT_NAME}-typo3/typo3conf
mkdir -p ${PROJECT_DATA}/${PROJECT_NAME}-typo3/uploads
mkdir -p ${PROJECT_DATA}/${PROJECT_NAME}-typo3/protected
mkdir -p ${PROJECT_DATA}/${PROJECT_NAME}-typo3/db
docker network create $TRAEFIK_NETWORK
docker compose up -d

197
php-conf/php.ini Normal file
View File

@ -0,0 +1,197 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; php.ini reference: https://git.php.net/?p=php-src.git;a=blob_plain;f=php.ini-production;hb=refs/heads/PHP-7.0 ;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
[PHP]
engine = On
short_open_tag = Off
precision = 14
output_buffering = 4096
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func =
serialize_precision = 17
disable_functions =
disable_classes =
zend.enable_gc = On
expose_php = Off
; Resource Limits ;
max_execution_time = 240
request_terminate_timeout = 0
max_input_time = -1
;max_input_nesting_level = 64
max_input_vars = 1500
memory_limit = 1024M
; Error handling and logging ;
error_reporting = E_ALL
display_errors = On
display_startup_errors = On
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
;xmlrpc_errors = 0
;xmlrpc_error_number = 0
html_errors = On
; Data Handling ;
variables_order = "EGPCS"
request_order = "GP"
register_argc_argv = Off
auto_globals_jit = On
post_max_size = 32M
auto_prepend_file =
auto_append_file =
default_mimetype = "text/html"
default_charset = "UTF-8"
; Paths and Directories ;
doc_root =
user_dir =
enable_dl = Off
cgi.fix_pathinfo=0
; File Uploads ;
file_uploads = On
upload_max_filesize = 32M
max_file_uploads = 20
; Fopen wrappers ;
allow_url_fopen = On
allow_url_include = Off
default_socket_timeout = 60
;auto_detect_line_endings = Off
; Dynamic Extensions ;
[CLI Server]
cli_server.color = On
[Date]
date.timezone = UTC
[Pdo_mysql]
pdo_mysql.cache_size = 2000
pdo_mysql.default_socket=
[mail function]
SMTP = localhost
smtp_port = 25
mail.add_x_header = On
sendmail_path="/usr/local/bin/mailhog sendmail test@example.org --smtp-addr 127.0.0.1:1025"
[SQL]
sql.safe_mode = Off
[ODBC]
odbc.allow_persistent = On
odbc.check_persistent = On
odbc.max_persistent = -1
odbc.max_links = -1
odbc.defaultlrl = 4096
odbc.defaultbinmode = 1
[Interbase]
ibase.allow_persistent = 1
ibase.max_persistent = -1
ibase.max_links = -1
ibase.timestampformat = "%Y-%m-%d %H:%M:%S"
ibase.dateformat = "%Y-%m-%d"
ibase.timeformat = "%H:%M:%S"
[MySQLi]
mysqli.max_persistent = -1
mysqli.allow_persistent = On
mysqli.max_links = -1
mysqli.cache_size = 2000
mysqli.default_port = 3306
mysqli.default_socket =
mysqli.default_host =
mysqli.default_user =
mysqli.default_pw =
mysqli.reconnect = Off
[mysqlnd]
mysqlnd.collect_statistics = On
mysqlnd.collect_memory_statistics = Off
[PostgreSQL]
pgsql.allow_persistent = On
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = -1
pgsql.max_links = -1
pgsql.ignore_notice = 0
pgsql.log_notice = 0
[bcmath]
bcmath.scale = 0
[Session]
session.save_handler = files
session.use_strict_mode = 0
session.use_cookies = 1
session.use_only_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 0
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.referer_check =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 5
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"
[Assertion]
zend.assertions = -1
[Tidy]
tidy.clean_output = Off
[soap]
soap.wsdl_cache_enabled=1
soap.wsdl_cache_dir="/tmp"
soap.wsdl_cache_ttl=86400
soap.wsdl_cache_limit = 5
[ldap]
ldap.max_links = -1
[opcache]
opcache.enable=1
opcache.enable_cli=1
opcache.memory_consumption=500
opcache.interned_strings_buffer=16
opcache.max_accelerated_files=1000000
;opcache.max_wasted_percentage=5
;opcache.use_cwd=1
opcache.validate_timestamps=1
opcache.revalidate_freq=30
opcache.revalidate_path=0
;opcache.save_comments=1
opcache.fast_shutdown=1
;opcache.enable_file_override=0
;opcache.optimization_level=0xffffffff
;opcache.inherited_hack=1
;opcache.dups_fix=0
;opcache.blacklist_filename=
;opcache.max_file_size=0
;opcache.consistency_checks=0
;opcache.force_restart_timeout=180
;opcache.error_log=
;opcache.log_verbosity_level=1
;opcache.preferred_memory_model=
;opcache.protect_memory=0
;opcache.restrict_api=
;opcache.mmap_base=
;opcache.file_cache=
;opcache.file_cache_only=0
;opcache.file_cache_consistency_checks=1
;opcache.file_cache_fallback=1
;opcache.huge_code_pages=1
;opcache.validate_permission=0
;opcache.validate_root=0