Skip to content

Commit 96e2903

Browse files
committed
Refactor ddev for test instances.
1 parent 90f80f6 commit 96e2903

14 files changed

+118
-113
lines changed

.ddev/apache/00-vhost-macro.conf

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99

1010
RewriteEngine On
1111
RewriteCond %{HTTP:X-Forwarded-Proto} =https
12-
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -d
13-
RewriteRule ^(.+[^/])$ https://%{HTTP_HOST}$1/ [redirect,last]
12+
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -d
13+
RewriteRule ^(.+[^/])$ https://%{HTTP_HOST}$1/ [redirect,last]
1414
SetEnvIf X-Forwarded-Proto "https" HTTPS=on
1515
ErrorLog /dev/stdout
1616
CustomLog ${APACHE_LOG_DIR}/access.log combined
@@ -27,8 +27,8 @@
2727

2828
RewriteEngine On
2929
RewriteCond %{HTTP:X-Forwarded-Proto} =https
30-
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -d
31-
RewriteRule ^(.+[^/])$ https://%{HTTP_HOST}$1/ [redirect,last]
30+
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} -d
31+
RewriteRule ^(.+[^/])$ https://%{HTTP_HOST}$1/ [redirect,last]
3232
SetEnvIf X-Forwarded-Proto "https" HTTPS=on
3333
ErrorLog /dev/stdout
3434
CustomLog ${APACHE_LOG_DIR}/access.log combined

.ddev/apache/10-index.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Use vhost-macro t3api.ddev.site /var/www/html/
1+
Use vhost-macro t3api.ddev.site /var/www/html/.test

.ddev/apache/30-v10.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Use vhost-macro v10.t3api.ddev.site /var/www/html/v10/public
1+
Use vhost-macro v10.t3api.ddev.site /var/www/html/.test/v10/public

.ddev/apache/31-v10-api.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Use vhost-macro v10-api.t3api.ddev.site /var/www/html/v10/public
1+
Use vhost-macro v10-api.t3api.ddev.site /var/www/html/.test/v10/public

.ddev/apache/40-v11.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Use vhost-macro v11.t3api.ddev.site /var/www/html/v11/public
1+
Use vhost-macro v11.t3api.ddev.site /var/www/html/.test/v11/public

.ddev/apache/41-v11-api.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Use vhost-macro v11-api.t3api.ddev.site /var/www/html/v11/public
1+
Use vhost-macro v11-api.t3api.ddev.site /var/www/html/.test/v11/public

.ddev/commands/web/cache-flush-all

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
3+
## Description: Flush cache for t3api test instances
4+
## Usage: cache-flush-all
5+
## Example: "ddev cache-flush-all"
6+
7+
/usr/bin/php /var/www/html/.test/v10/vendor/bin/typo3cms cache:flush
8+
/usr/bin/php /var/www/html/.test/v11/vendor/bin/typo3cms cache:flush

.ddev/commands/web/install-all

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
#!/bin/bash
22

3+
## Description: Install TYPO3 10 and TYPO3 11 with t3api linked to it.
4+
## Usage: install-all
5+
## Example: "ddev install-all"
6+
37
ABSOLUTE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/$(basename "${BASH_SOURCE[0]}/.")"
48

59
$ABSOLUTE_PATH/install-v10

.ddev/commands/web/install-v10

+40-32
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,46 @@
11
#!/bin/bash
22

3+
## Description: Install TYPO3 10 with t3api linked to it.
4+
## Usage: install-v10
5+
## Example: "ddev install-v10"
6+
37
VERSION=v10
4-
DATABASE=database_${VERSION}
8+
DATABASE=database_$VERSION
9+
BASE_PATH=/var/www/html/.test/$VERSION
10+
11+
[ -L /var/www/html/.test/t3api ] || ln -sr /var/www/html/ /var/www/html/.test/t3api
12+
rm -rf $BASE_PATH
13+
mkdir -p $BASE_PATH
514

6-
rm -rf /var/www/html/$VERSION/*
715
mysql -uroot -proot -e "DROP DATABASE IF EXISTS $DATABASE"
816

9-
cd /var/www/html/$VERSION
10-
11-
composer init --name=sourcebroker/typo3$VERSION --description=TYPO3$VERSION -n -d /var/www/html/$VERSION
12-
composer config extra.typo3/cms.web-dir public -d /var/www/html/$VERSION
13-
composer config repositories.$EXTENSION_KEY path ../$EXTENSION_KEY -d /var/www/html/$VERSION
14-
composer req typo3/minimal:'^10.4' typo3/cms-extensionmanager:'^10.4' helhum/typo3-console:'^6.3' jigal/t3adminer:'^9.4' georgringer/news:'^8.0' sourcebroker/t3api:'@dev' sourcebroker/t3apinews:'@dev' --no-progress -n -d /var/www/html/$VERSION
15-
16-
vendor/bin/typo3cms install:setup -n --database-name $DATABASE
17-
vendor/bin/typo3cms configuration:set 'BE/debug' 1
18-
vendor/bin/typo3cms configuration:set 'BE/lockSSL' true
19-
vendor/bin/typo3cms configuration:set 'FE/debug' 1
20-
vendor/bin/typo3cms configuration:set 'SYS/devIPmask' '*'
21-
vendor/bin/typo3cms configuration:set 'SYS/displayErrors' 1
22-
vendor/bin/typo3cms configuration:set 'SYS/trustedHostsPattern' '.*.*'
23-
vendor/bin/typo3cms configuration:set 'MAIL/transport' 'smtp'
24-
vendor/bin/typo3cms configuration:set 'MAIL/transport_smtp_server' 'localhost:1025'
25-
vendor/bin/typo3cms configuration:set 'GFX/processor' 'ImageMagick'
26-
vendor/bin/typo3cms configuration:set 'GFX/processor_path' '/usr/bin/'
27-
vendor/bin/typo3cms configuration:set 'GFX/processor_path_lzw' '/usr/bin/'
28-
vendor/bin/typo3cms install:generatepackagestates
29-
30-
sed -i -e "s/base: ht\//base: \//g" /var/www/html/$VERSION/config/sites/main/config.yaml
31-
sed -i -e 's/base: \/en\//base: \//g' /var/www/html/$VERSION/config/sites/main/config.yaml
32-
printf "imports:\n -\n resource: 'EXT:$EXTENSION_KEY/Configuration/Routing/config.yaml'" >> /var/www/html/$VERSION/config/sites/main/config.yaml
33-
34-
cp -r "/var/www/html/$EXTENSION_KEY/.ddev/data-init/fileadmin/" "/var/www/html/$VERSION/public/"
35-
mysql -uroot -proot $DATABASE < "/var/www/html/$EXTENSION_KEY/.ddev/data-init/$DATABASE.sql"
36-
37-
vendor/bin/typo3cms database:updateschema
38-
vendor/bin/typo3cms cache:flush
17+
composer init --name=sourcebroker/typo3$VERSION --description=TYPO3$VERSION --no-interaction --working-dir $BASE_PATH
18+
composer config extra.typo3/cms.web-dir public --working-dir $BASE_PATH
19+
composer config repositories.$EXTENSION_KEY path ../$EXTENSION_KEY --working-dir $BASE_PATH
20+
composer req typo3/minimal:'^10.4' helhum/typo3-console:'^6.3' jigal/t3adminer:'^9.4' georgringer/news:'^8.0' \
21+
sourcebroker/t3api:'@dev' sourcebroker/t3apinews:'@dev' \
22+
--no-progress --no-interaction --working-dir $BASE_PATH
23+
24+
$BASE_PATH/vendor/bin/typo3cms install:setup -n --database-name $DATABASE
25+
$BASE_PATH/vendor/bin/typo3cms configuration:set 'BE/debug' 1
26+
$BASE_PATH/vendor/bin/typo3cms configuration:set 'BE/lockSSL' true
27+
$BASE_PATH/vendor/bin/typo3cms configuration:set 'FE/debug' 1
28+
$BASE_PATH/vendor/bin/typo3cms configuration:set 'SYS/devIPmask' '*'
29+
$BASE_PATH/vendor/bin/typo3cms configuration:set 'SYS/displayErrors' 1
30+
$BASE_PATH/vendor/bin/typo3cms configuration:set 'SYS/trustedHostsPattern' '.*.*'
31+
$BASE_PATH/vendor/bin/typo3cms configuration:set 'MAIL/transport' 'smtp'
32+
$BASE_PATH/vendor/bin/typo3cms configuration:set 'MAIL/transport_smtp_server' 'localhost:1025'
33+
$BASE_PATH/vendor/bin/typo3cms configuration:set 'GFX/processor' 'ImageMagick'
34+
$BASE_PATH/vendor/bin/typo3cms configuration:set 'GFX/processor_path' '/usr/bin/'
35+
$BASE_PATH/vendor/bin/typo3cms configuration:set 'GFX/processor_path_lzw' '/usr/bin/'
36+
$BASE_PATH/vendor/bin/typo3cms install:generatepackagestates
37+
38+
sed -i -e "s/base: ht\//base: \//g" $BASE_PATH/config/sites/main/config.yaml
39+
sed -i -e 's/base: \/en\//base: \//g' $BASE_PATH/config/sites/main/config.yaml
40+
printf "imports:\n -\n resource: 'EXT:$EXTENSION_KEY/Configuration/Routing/config.yaml'" >> $BASE_PATH/config/sites/main/config.yaml
41+
42+
cp -r "$BASE_PATH/../$EXTENSION_KEY/.ddev/data-init/fileadmin/" "$BASE_PATH/public/"
43+
mysql -uroot -proot $DATABASE < "$BASE_PATH/../$EXTENSION_KEY/.ddev/data-init/$DATABASE.sql"
44+
45+
$BASE_PATH/vendor/bin/typo3cms database:updateschema
46+
$BASE_PATH/vendor/bin/typo3cms cache:flush

.ddev/commands/web/install-v11

+39-31
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,45 @@
11
#!/bin/bash
22

3+
## Description: Install TYPO3 11 with t3api linked to it.
4+
## Usage: install-v11
5+
## Example: "ddev install-v11"
6+
37
VERSION=v11
4-
DATABASE=database_${VERSION}
8+
DATABASE=database_$VERSION
9+
BASE_PATH=/var/www/html/.test/$VERSION
10+
11+
[ -L /var/www/html/.test/t3api ] || ln -sr /var/www/html/ /var/www/html/.test/t3api
12+
rm -rf $BASE_PATH
13+
mkdir -p $BASE_PATH
514

6-
rm -rf /var/www/html/$VERSION/*
715
mysql -uroot -proot -e "DROP DATABASE IF EXISTS $DATABASE"
816

9-
cd /var/www/html/$VERSION
10-
11-
composer init --name=sourcebroker/typo3$VERSION --description=TYPO3$VERSION -n -d /var/www/html/$VERSION
12-
composer config extra.typo3/cms.web-dir public -d /var/www/html/$VERSION
13-
composer config repositories.$EXTENSION_KEY path ../$EXTENSION_KEY -d /var/www/html/$VERSION
14-
composer req typo3/minimal:'^11.5' typo3/cms-extensionmanager:'^11.5' helhum/typo3-console:'^7.0' georgringer/news:'^9.2.0' sourcebroker/t3api:'@dev' sourcebroker/t3apinews:'@dev' --no-progress -n -d /var/www/html/$VERSION
15-
16-
vendor/bin/typo3cms install:setup -n --database-name $DATABASE
17-
vendor/bin/typo3cms configuration:set 'BE/debug' 1
18-
vendor/bin/typo3cms configuration:set 'BE/lockSSL' true
19-
vendor/bin/typo3cms configuration:set 'FE/debug' 1
20-
vendor/bin/typo3cms configuration:set 'SYS/devIPmask' '*'
21-
vendor/bin/typo3cms configuration:set 'SYS/displayErrors' 1
22-
vendor/bin/typo3cms configuration:set 'SYS/trustedHostsPattern' '.*.*'
23-
vendor/bin/typo3cms configuration:set 'MAIL/transport' 'smtp'
24-
vendor/bin/typo3cms configuration:set 'MAIL/transport_smtp_server' 'localhost:1025'
25-
vendor/bin/typo3cms configuration:set 'GFX/processor' 'ImageMagick'
26-
vendor/bin/typo3cms configuration:set 'GFX/processor_path' '/usr/bin/'
27-
vendor/bin/typo3cms configuration:set 'GFX/processor_path_lzw' '/usr/bin/'
28-
29-
sed -i -e "s/base: ht\//base: \//g" /var/www/html/$VERSION/config/sites/main/config.yaml
30-
sed -i -e 's/base: \/en\//base: \//g' /var/www/html/$VERSION/config/sites/main/config.yaml
31-
printf "imports:\n -\n resource: 'EXT:$EXTENSION_KEY/Configuration/Routing/config.yaml'" >> /var/www/html/$VERSION/config/sites/main/config.yaml
32-
33-
cp -r "/var/www/html/$EXTENSION_KEY/.ddev/data-init/fileadmin/" "/var/www/html/$VERSION/public/"
34-
mysql -uroot -proot $DATABASE < "/var/www/html/$EXTENSION_KEY/.ddev/data-init/$DATABASE.sql"
35-
36-
vendor/bin/typo3cms database:updateschema
37-
vendor/bin/typo3cms cache:flush
17+
composer init --name=sourcebroker/typo3$VERSION --description=TYPO3$VERSION --no-interaction --working-dir $BASE_PATH
18+
composer config extra.typo3/cms.web-dir public --working-dir $BASE_PATH
19+
composer config repositories.$EXTENSION_KEY path ../$EXTENSION_KEY --working-dir $BASE_PATH
20+
composer req typo3/minimal:'^11.5' helhum/typo3-console:'^7.0' georgringer/news:'^9.2.0' \
21+
sourcebroker/t3api:'@dev' sourcebroker/t3apinews:'@dev' \
22+
--no-progress --no-interaction --working-dir $BASE_PATH
23+
24+
$BASE_PATH/vendor/bin/typo3cms install:setup -n --database-name $DATABASE
25+
$BASE_PATH/vendor/bin/typo3cms configuration:set 'BE/debug' 1
26+
$BASE_PATH/vendor/bin/typo3cms configuration:set 'BE/lockSSL' true
27+
$BASE_PATH/vendor/bin/typo3cms configuration:set 'FE/debug' 1
28+
$BASE_PATH/vendor/bin/typo3cms configuration:set 'SYS/devIPmask' '*'
29+
$BASE_PATH/vendor/bin/typo3cms configuration:set 'SYS/displayErrors' 1
30+
$BASE_PATH/vendor/bin/typo3cms configuration:set 'SYS/trustedHostsPattern' '.*.*'
31+
$BASE_PATH/vendor/bin/typo3cms configuration:set 'MAIL/transport' 'smtp'
32+
$BASE_PATH/vendor/bin/typo3cms configuration:set 'MAIL/transport_smtp_server' 'localhost:1025'
33+
$BASE_PATH/vendor/bin/typo3cms configuration:set 'GFX/processor' 'ImageMagick'
34+
$BASE_PATH/vendor/bin/typo3cms configuration:set 'GFX/processor_path' '/usr/bin/'
35+
$BASE_PATH/vendor/bin/typo3cms configuration:set 'GFX/processor_path_lzw' '/usr/bin/'
36+
37+
sed -i -e "s/base: ht\//base: \//g" $BASE_PATH/config/sites/main/config.yaml
38+
sed -i -e 's/base: \/en\//base: \//g' $BASE_PATH/config/sites/main/config.yaml
39+
printf "imports:\n -\n resource: 'EXT:$EXTENSION_KEY/Configuration/Routing/config.yaml'" >> $BASE_PATH/config/sites/main/config.yaml
40+
41+
cp -r "$BASE_PATH/../$EXTENSION_KEY/.ddev/data-init/fileadmin/" "$BASE_PATH/public/"
42+
mysql -uroot -proot $DATABASE < "$BASE_PATH/../$EXTENSION_KEY/.ddev/data-init/$DATABASE.sql"
43+
44+
$BASE_PATH/vendor/bin/typo3cms database:updateschema
45+
$BASE_PATH/vendor/bin/typo3cms cache:flush

.ddev/config.yaml

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
name: t3api
22
type: php
3-
docroot: ~
4-
no_project_mount: true
3+
docroot: .test
54
php_version: "7.4"
65
composer_version: 2
76
webserver_type: apache-fpm
@@ -16,13 +15,8 @@ additional_hostnames:
1615
additional_fqdns: []
1716
provider: default
1817
use_dns_when_possible: true
19-
extra_services:
20-
- v10-data
21-
- v11-data
2218
hooks:
23-
pre-start:
24-
- exec-host: "mkdir -p .test/v10 .test/v11"
25-
- exec-host: "[ -L .test/t3api ] || ln -snvf ../. .test/t3api"
2619
post-start:
2720
- exec: sudo sed -i '1s/^/TERM=xterm-256color\n/' ~/.bashrc
21+
- exec: mkdir -p .test && cp /var/www/html/.ddev/data-init/index.html /var/www/html/.test/
2822

.ddev/data-init/index.html

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>t3api</title>
6+
</head>
7+
<body>
8+
<p>Run <b>'ddev install-all'</b> to install TYPO3 10 and TYPO3 11 with t3api linked to this source.</p>
9+
<ul>
10+
<li><a target="_blank" href="https://v11.t3api.ddev.site/typo3/">https://v11.t3api.ddev.site/typo3</a> user: <b>admin</b>, pass: <b>password</b></li>
11+
<li><a target="_blank" href="https://v10.t3api.ddev.site/typo3/">https://v10.t3api.ddev.site/typo3</a> user: <b>admin</b>, pass: <b>password</b></li>
12+
</ul>
13+
</body>
14+
</html>

.ddev/docker-compose.web.yaml

+1-7
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,4 @@ services:
1717
- TYPO3_INSTALL_SITE_NAME=EXT:t3api Dev Environment
1818
- TYPO3_INSTALL_SITE_SETUP_TYPE=site
1919
- TYPO3_INSTALL_WEB_SERVER_CONFIG=apache
20-
volumes:
21-
- type: bind
22-
source: ../
23-
target: /var/www/html/t3api
24-
consistency: cached
25-
- ../.test/v10:/var/www/html/v10
26-
- ../.test/v11:/var/www/html/v11
20+

.ddev/web-build/Dockerfile

+1-26
Original file line numberDiff line numberDiff line change
@@ -3,30 +3,5 @@ FROM $BASE_IMAGE
33

44
RUN wget https://packages.sury.org/php/apt.gpg -O /etc/apt/trusted.gpg.d/php-sury.gpg
55
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install \
6-
-y -o Dpkg::Options::="--force-confold" --no-install-recommends --no-install-suggests mc imagemagick
7-
6+
-y -o Dpkg::Options::="--force-confold" --no-install-recommends --no-install-suggests mc graphicsmagick
87
RUN a2enmod macro
9-
10-
ENV EXTENSION_KEY "t3api"
11-
ENV DDEV_SITENAME "t3api"
12-
13-
RUN echo "<html><head><style>h2 {display:inline-block;margin-right:0.5em;vertical-align:middle;}</style></head>" > /var/www/html/index.html
14-
RUN echo "<body><h1>EXT:${EXTENSION_KEY} Dev Environments</h1><ul>" >> /var/www/html/index.html
15-
RUN echo "<li><h2>TYPO3 10.4 LTS</h2><a href="https://v10.${DDEV_SITENAME}.ddev.site/">Frontend</a> | <a href="https://v10.${DDEV_SITENAME}.ddev.site/typo3/">Backend</a></li>" >> /var/www/html/index.html
16-
RUN echo "<li><h2>TYPO3 11.5 LTS</h2><a href="https://v11.${DDEV_SITENAME}.ddev.site/">Frontend</a> | <a href="https://v11.${DDEV_SITENAME}.ddev.site/typo3/">Backend</a></li>" >> /var/www/html/index.html
17-
RUN echo "</ul>" >> /var/www/html/index.html
18-
RUN echo "<hr>" >> /var/www/html/index.html
19-
RUN echo "<h3>TYPO3 Backend</h3><ul><li><b>User:</b> <code>admin</code></li><li><b>Password:</b> <code>password</code> (also Install Tool)</li></ul>" >> /var/www/html/index.html
20-
RUN echo "</body></html>" >> /var/www/html/index.html
21-
22-
23-
RUN mkdir -p /var/www/html/v10/public/typo3
24-
RUN echo "<h1>Perform this first</h1> <code>ddev install-v10</code>" > /var/www/html/v10/public/index.html
25-
RUN echo "<h1>Perform this first</h1> <code>ddev install-v10</code>" > /var/www/html/v10/public/typo3/index.html
26-
RUN mkdir -p /var/www/html/v11/public/typo3
27-
RUN echo "<h1>Perform this first</h1> <code>ddev install-v11</code>" > /var/www/html/v11/public/index.html
28-
RUN echo "<h1>Perform this first</h1> <code>ddev install-v11</code>" > /var/www/html/v11/public/typo3/index.html
29-
30-
ARG uid
31-
ARG gid
32-
RUN chown -R $uid:$gid /var/www/html

0 commit comments

Comments
 (0)