Skip to content

Commit 8715194

Browse files
committed
Merge branch 'release/2.0.0'
2 parents e9ace0a + 287ccbc commit 8715194

28 files changed

+302
-98
lines changed

Makefile

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
BACKUP_DIR = backup
2-
MYSQL_BACKUP_FILE = database.sql.bz2
3-
SOLR_BACKUP_FILE = solr.tar.bz2
4-
51
all: deploy
62

73
#############################
@@ -19,27 +15,23 @@ create-neos-project:
1915
#############################
2016

2117
mysql-backup:
22-
test -d "$(BACKUP_DIR)" && { docker-compose run --rm typo3 mysqldump --opt --all-databases | bzip2 > "$(BACKUP_DIR)/$(MYSQL_BACKUP_FILE)"; }
18+
docker-compose run --rm --no-deps main bash /docker/bin/backup.sh mysql
2319

2420
mysql-restore:
25-
test -s "$(BACKUP_DIR)/$(MYSQL_BACKUP_FILE)" && { bzcat "$(BACKUP_DIR)/$(MYSQL_BACKUP_FILE)" | docker-compose run --rm typo3 mysql; }
21+
docker-compose run --rm --no-deps main bash /docker/bin/restore.sh mysql
2622

2723
#############################
2824
# Solr
2925
#############################
3026

3127
solr-backup:
32-
test -d "$(BACKUP_DIR)"
3328
docker-compose stop solr
34-
rm -f "$(BACKUP_DIR)/$(SOLR_BACKUP_FILE)"
35-
docker-compose run --rm --no-deps typo3 tar jcf "/var/www/$(BACKUP_DIR)/$(SOLR_BACKUP_FILE)" /data/solr/
29+
docker-compose run --rm --no-deps main bash /docker/bin/backup.sh solr
3630
docker-compose start solr
3731

3832
solr-restore:
39-
test -s "$(BACKUP_DIR)/$(SOLR_BACKUP_FILE)"
4033
docker-compose stop solr
41-
docker-compose run --rm --no-deps typo3 'rm -rf /data/solr/* && mkdir -p /data/solr/'
42-
docker-compose run --rm --no-deps typo3 tar jxf "/var/www/$(BACKUP_DIR)/$(SOLR_BACKUP_FILE)" -C /
34+
docker-compose run --rm --no-deps main bash /docker/bin/restore.sh solr
4335
docker-compose start solr
4436

4537
#############################
@@ -55,9 +47,12 @@ deploy:
5547
clean:
5648
test -d htdocs/typo3temp && { rm -rf htdocs/typo3temp/*; }
5749

50+
bash:
51+
docker-compose run --rm main bash
52+
5853
#############################
5954
# TYPO3
6055
#############################
6156

6257
scheduler:
63-
docker-compose run --rm typo3 typo3/cli_dispatch.phpsh scheduler
58+
docker-compose run --rm main typo3/cli_dispatch.phpsh scheduler

README-NEOS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ most of the time there is no need to enter any Docker container.
2323

2424
You can run one-shot command inside the `TYPO3` service container:
2525

26-
$ docker-compose run --rm typo3 flow core:setfilepermissions
26+
$ docker-compose run --rm code flow core:setfilepermissions
2727

28-
$ docker-compose run --rm typo3 bash
28+
$ docker-compose run --rm code bash
2929

3030
Webserver is available at Port 8000

README-TYPO3.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ most of the time there is no need to enter any Docker container.
2323

2424
You can run one-shot command inside the `TYPO3` service container:
2525

26-
$ docker-compose run --rm typo3 typo3/cli_dispatch.phpsh scheduler
26+
$ docker-compose run --rm code typo3/cli_dispatch.phpsh scheduler
2727

28-
$ docker-compose run --rm typo3 bash
28+
$ docker-compose run --rm code bash
2929

3030
Webserver is available at Port 8000
3131

README.md

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ Supports:
1010
- MySQL, MariaDB or PerconaDB
1111
- Solr
1212
- Elasticsearch (disabled, without configuration)
13-
- Redis (disabeld)
14-
- Memcached (disabeld)
13+
- Redis (disabled)
14+
- Memcached (disabled)
1515
- maybe more later...
1616

1717
This Docker boilerplate based on the best practises and don't use too much magic.
@@ -34,6 +34,34 @@ Use can use my [Vagrant Development VM](https://github.com/mblaschke/vagrant-dev
3434
If you want to run a Docker VM make sure you're using VMware or Parallels Desktop because of
3535
the much faster virtualisation (networking, disk access, shared folders) compared to VirtualBox.
3636

37+
## Docker short introduction
38+
39+
Create and start containers (eg. first start):
40+
41+
$ docker-compose up -d
42+
43+
Stop containers
44+
45+
$ docker-compose stop
46+
47+
Start containers (only stopped containers)
48+
49+
$ docker-compose start
50+
51+
Build (but not create and start) containers
52+
53+
$ docker-compose build --no-cache
54+
55+
Delete container content
56+
57+
$ docker-compose rm --force
58+
59+
Recreate containers (if there is any issue or just to start from a clean build)
60+
61+
$ docker-compose stop
62+
$ docker-compose rm --force
63+
$ docker-compose build --no-cache
64+
$ docker-compose up -d
3765

3866
## Create new project
3967

@@ -51,6 +79,21 @@ For an existing project just put your files into htdocs/ folder or use git to cl
5179

5280
## Informations
5381

82+
### Docker layout
83+
84+
Container | Description
85+
------------------------- | -------------------------------
86+
main | Main container with PHP-FPM and tools (your entrypoint for bash, php and other stuff)
87+
storage | Storage container, eg. for Solr data
88+
nginx | Nginx webserver
89+
httpd (optional) | Apache HTTPD webserver
90+
mysql | MySQL database
91+
solr | Apache Solr server
92+
elasticsearch (optional) | Elasticsearch server
93+
memcached (optional) | Memcached server
94+
redis (optional) | Redis server
95+
96+
This directory will be mounted under /docker in main, nginx and httpd container.
5497

5598
### Makefile
5699

@@ -127,6 +170,8 @@ Environment | Description
127170
TYPO3_CONTEXT | Context for TYPO3, can be used for TypoScript conditions and AdditionalConfiguration
128171
FLOW_CONTEXT | Context for FLOW and NEOS
129172
<br> |
173+
MAIL_GATEWAY | Upstream server for sending mails (ssmtp)
174+
<br> |
130175
MYSQL_ROOT_PASSWORD | Password for MySQL user "root"
131176
MYSQL_USER | Initial created MySQL user
132177
MYSQL_PASSWORD | Password for initial MySQL user
@@ -164,6 +209,11 @@ to get both, the Docker configuration and the TYPO3 installation.
164209

165210
For better useability track a whole branch (eg. develop or master) as submodule and not just a single commit.
166211

212+
# Root privilege requirements for NFS
213+
214+
Under Linux and MacOS you will be asked for root rights (sudo).
215+
If you don't want to enter your password every time [take a look at the vagrant manual for NFS usage](https://docs.vagrantup.com/v2/synced-folders/nfs.html)
216+
167217
## Credits
168218

169219
This Docker layout is based on https://github.com/denderello/symfony-docker-example/

bin/.config.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ SCRIPT_DIR=$(dirname $($READLINK -f "$0"))
2424
ROOT_DIR=$($READLINK -f "$SCRIPT_DIR/../")
2525
TYPO3_DIR=$($READLINK -f "$ROOT_DIR/htdocs")
2626

27+
BACKUP_DIR=$($READLINK -f "$ROOT_DIR/backup")
28+
BACKUP_SOLR_FILE='solr.cores.tbz2'
29+
BACKUP_MYSQL_FILE='mysql.sql.bz2'
30+
2731
#######################################
2832
## Functions
2933
#######################################

bin/backup.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env bash
2+
3+
set -o pipefail # trace ERR through pipes
4+
set -o errtrace # trace ERR through 'time command' and other functions
5+
set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
6+
set -o errexit ## set -e : exit the script if any statement returns a non-true return value
7+
8+
source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/.config.sh"
9+
10+
if [ "$#" -ne 1 ]; then
11+
echo "No type defined"
12+
exit 1
13+
fi
14+
15+
mkdir -p -- "${BACKUP_DIR}"
16+
17+
case "$1" in
18+
###################################
19+
## MySQL
20+
###################################
21+
"mysql")
22+
rm -f -- "${BACKUP_DIR}/${BACKUP_MYSQL_FILE}"
23+
mysqldump --opt --all-databases | bzip2 > "${BACKUP_DIR}/${BACKUP_MYSQL_FILE}"
24+
;;
25+
26+
###################################
27+
## Solr
28+
###################################
29+
"solr")
30+
rm -f -- "${BACKUP_DIR}/${BACKUP_SOLR_FILE}"
31+
tar jcf "${BACKUP_DIR}/${BACKUP_SOLR_FILE}" /data/solr/
32+
;;
33+
esac

bin/create-project.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ set -o errexit ## set -e : exit the script if any statement returns a non-true
77

88
source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/.config.sh"
99

10-
1110
if [ "$#" -ne 1 ]; then
1211
echo "No project type defined (either cms or neos)"
1312
exit 1
1413
fi
1514

16-
rm -f "$TYPO3_DIR/.gitkeep"
15+
mkdir -p -- "$TYPO3_DIR/"
16+
17+
rm -f -- "$TYPO3_DIR/.gitkeep"
1718

1819
case "$1" in
1920
###################################
@@ -32,4 +33,4 @@ case "$1" in
3233
;;
3334
esac
3435

35-
touch "$TYPO3_DIR/.gitkeep"
36+
touch -- "$TYPO3_DIR/.gitkeep"

bin/restore.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env bash
2+
3+
set -o pipefail # trace ERR through pipes
4+
set -o errtrace # trace ERR through 'time command' and other functions
5+
set -o nounset ## set -u : exit the script if you try to use an uninitialised variable
6+
set -o errexit ## set -e : exit the script if any statement returns a non-true return value
7+
8+
source "$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/.config.sh"
9+
10+
if [ "$#" -ne 1 ]; then
11+
echo "No type defined"
12+
exit 1
13+
fi
14+
15+
mkdir -p -- "${BACKUP_DIR}"
16+
17+
case "$1" in
18+
###################################
19+
## MySQL
20+
###################################
21+
"mysql")
22+
bzcat "${BACKUP_DIR}/${BACKUP_MYSQL_FILE}" | mysql
23+
;;
24+
25+
###################################
26+
## Solr
27+
###################################
28+
"solr")
29+
rm -rf /data/solr/* && mkdir -p /data/solr/
30+
tar jxf "${BACKUP_DIR}/${BACKUP_SOLR_FILE}" -C /
31+
;;
32+
esac

docker-compose.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
typo3:
2-
build: docker/typo3/
1+
main:
2+
build: docker/main/
33
links:
44
- solr
55
- mysql
66
#- redis
77
#- memcached
88
volumes:
9-
- ./:/var/www/
9+
- ./:/docker/
10+
- /tmp/debug/:/tmp/debug/
1011
volumes_from:
1112
- storage
1213
env_file:
@@ -17,9 +18,9 @@ nginx:
1718
ports:
1819
- 8000:80
1920
links:
20-
- typo3
21+
- main
2122
volumes_from:
22-
- typo3
23+
- main
2324
env_file:
2425
- docker-env.yml
2526

@@ -28,9 +29,9 @@ nginx:
2829
# ports:
2930
# - 8000:80
3031
# links:
31-
# - fpm
32+
# - main
3233
# volumes_from:
33-
# - typo3
34+
# - main
3435
# env_file:
3536
# - docker-env.yml
3637

docker-env.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
1+
DOCUMENT_ROOT=htdocs/
2+
13
TYPO3_CONTEXT=Development/Docker
24
FLOW_CONTEXT=Development/Docker
35
FLOW_REWRITEURLS=1
46

7+
MAIL_GATEWAY=192.168.56.2
8+
59
MYSQL_ROOT_PASSWORD=dev
610
MYSQL_USER=dev
711
MYSQL_PASSWORD=dev

0 commit comments

Comments
 (0)