PHPackages                             t3easy/typo3-bootcamp - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [DevOps &amp; Deployment](/categories/devops)
4. /
5. t3easy/typo3-bootcamp

ActiveProject[DevOps &amp; Deployment](/categories/devops)

t3easy/typo3-bootcamp
=====================

Environment to develop and run TYPO3 in Docker containers

v10.4.0(5y ago)172896[10 issues](https://github.com/t3easy/docker-typo3/issues)[2 PRs](https://github.com/t3easy/docker-typo3/pulls)GPL-2.0-or-laterPHP

Since Jan 24Pushed 2y ago3 watchersCompare

[ Source](https://github.com/t3easy/docker-typo3)[ Packagist](https://packagist.org/packages/t3easy/typo3-bootcamp)[ Fund](https://paypal.me/t3easy/beer)[ GitHub Sponsors](https://github.com/t3easy)[ RSS](/packages/t3easy-typo3-bootcamp/feed)WikiDiscussions main Synced 2d ago

READMEChangelogDependencies (30)Versions (21)Used By (0)

TYPO3 Bootcamp - an Environment to develop and run TYPO3 in Docker containers
=============================================================================

[](#typo3-bootcamp---an-environment-to-develop-and-run-typo3-in-docker-containers)

### Requirements:

[](#requirements)

1. Docker(4Mac) 17.09 or greater for build
2. [Docker Compose](https://docs.docker.com/compose/install/) (included in Docker4Mac)
3. composer
4. A Traefik reverse proxy, e.g. [docker-frontend](https://github.com/t3easy/docker-frontend)or include `.docker/env.direct.yml` and set `WEB_PORT`.

### Start a new project

[](#start-a-new-project)

1. `composer create-project t3easy/typo3-bootcamp awesome-project.tld`
    (Or clone the project with git and checkout the desired branch)
2. Change to awesome-project.tld / open it in you favorite IDE
3. Rename `.env.dev` to `.env` and adjust it to your needs, see below and comments in the file for more information E.g. `VHOST=typo3.localhost`
    If you use a `.localhost` vhost, you can access it with Chrome w/o a host entry.
    See:
4. Add your vhost as a hosts entry for 127.0.0.1 / the box you're running docker on
5. Start the environment with `docker-compose up -d`
6. Setup TYPO3
    1. With TYPO3 Console ```
        docker-compose exec -u www-data typo3 vendor/bin/typo3cms install:setup
        ```
    2. Or with the browser ```
        docker-compose exec -u www-data typo3 touch /app/private/FIRST_INSTALL
        ```

        Open  and configure TYPO3
7. Go to
    -  for TYPO3 frontend
    -  for TYPO3 backend
    -  for Adminer
    -  for Mailhog

.env
----

[](#env)

In this file you define the environment you'd like to setup. There are two examples, `.env.dev` to start an development environment and `.env.prod` as a template to build and deploy your project.

To check the result, run `docker-compose config`.
To deploy to a swarm write the result to a file `docker-compose config > stack.yml` and use it `docker stack deploy --compose-file stack.yml myproject`

### COMPOSE\_PROJECT\_NAME

[](#compose_project_name)

A unique project name. It must not contain dots. E.g. project-typo3version like company-typo3v11 See [https://docs.docker.com/compose/reference/envvars/#compose\_project\_name](https://docs.docker.com/compose/reference/envvars/#compose_project_name) for more details

### COMPOSE\_FILE

[](#compose_file)

Add all necessary compose files separated with `:`, always start with the root `docker-compose.yml` to have a proper project name and relative paths. The settings of the last config wins. More at [https://docs.docker.com/compose/reference/envvars/#compose\_file](https://docs.docker.com/compose/reference/envvars/#compose_file)

### VHOST

[](#vhost)

The FQDN of the TYPO3 project. It gets prefixed for other services, e.g. if you set VHOST to `typo3.localhost`, you can reach Adminer at `adminer-typo3.localhost` and Mailhog at `mailhog-typo3.localhost`.

### ADDITIONAL\_VHOSTS

[](#additional_vhosts)

Adds additional names to the TYPO3 web service. The value must start with a comma (`,`). Example `,2nd.domain.tld,3rd.domain.tld`

### FRONTEND\_NETWORK

[](#frontend_network)

The name of the docker network that Traefik can use to connect to the web service.

### RESTART

[](#restart)

Define the restart policy for all services. Should be `always` for production and `no` for development.

### DB\_IMAGE

[](#db_image)

The image of the db service, see

- [https://hub.docker.com/\_/mariadb/](https://hub.docker.com/_/mariadb/)
- [https://hub.docker.com/\_/mysql/](https://hub.docker.com/_/mysql/)
-

Example `mariadb:10.2`

### MYSQL\_ROOT\_PASSWORD

[](#mysql_root_password)

Set the password of the root db user. You should not set the password in the `.env` file for production setup. Set it on CLI

```
MYSQL_ROOT_PASSWORD=MyV3rySecretP4sswd docker-compose up -d
```

or set it in CI variables.

### DB\_BIND\_TO

[](#db_bind_to)

Bind the db service to a specified ip and port. Format `IP:Port`Use `127.0.0.1:` to publish a dynamic port to localhost only. Use `127.0.0.1:13306` to publish the port `13306`. Use `13306` to publish `13306` to all available IP. ATTENTION! That allows access from anywhere! The port is mapped to 3306, the MySQL/MariaDB port, inside the container. See [Access the database during development via tcp](#access-the-database-during-development-via-tcp)

### REDIS and LDAP

[](#redis-and-ldap)

Build the TYPO3 image with that PHP extensions.

### WEB\_PORT

[](#web_port)

The port the web container expose. Only if you use `.docker/env.direct.yml`.

### TRAEFIK\_ENTRYPOINT\_HTTP and TRAEFIK\_ENTRYPOINT\_HTTPS

[](#traefik_entrypoint_http-and-traefik_entrypoint_https)

Names of the Traefik entrypoints

Build
-----

[](#build)

To build a productive environment use `docker-compose -f .docker/build.yml` from the root with an prepared `.env`or by setting REDIS and LDAP in the environment of the builder. If you build on GitLab CI, you can use `.docker/env.gitlab.yml` to tag your images. See `.gitlab-ci.example.yml`.

Deploy
------

[](#deploy)

See `.gitlab-ci.example.yml` for an example how to deploy to docker hosts with GitLab CI. Consider to set `COMPOSE_PROJECT_NAME` at the deploy job, to be able to deploy the project multiple times to the same docker-host, e.g. testing, staging and live. [https://docs.docker.com/compose/reference/envvars/#compose\_project\_name](https://docs.docker.com/compose/reference/envvars/#compose_project_name)

Access the database during development via tcp
----------------------------------------------

[](#access-the-database-during-development-via-tcp)

A dynamic port is mapped to the database service port 3306. To get this port run:

```
docker-compose ps db
```

You'll get something like:

```
      Name                    Command               State             Ports
-------------------------------------------------------------------------------------
project_db_1       docker-entrypoint.sh --cha ...   Up      127.0.0.1:32770->3306/tcp

```

where `32770` is the port on the local docker host to connect to.

Run TYPO3 Console commands
--------------------------

[](#run-typo3-console-commands)

To run a command inside the TYPO3 PHP Container use `docker-compose`: E.g. flush the cache

```
docker-compose exec -u www-data typo3 typo3cms cache:flush

```

Import/export the database
--------------------------

[](#importexport-the-database)

### Export database

[](#export-database)

```
docker-compose exec -T db sh -c 'exec mysqldump --opt --single-transaction -u"$MYSQL_USER" -p"$MYSQL_PASSWORD" "$MYSQL_DATABASE"' > dump.sql
```

### Import a sql dump

[](#import-a-sql-dump)

```
docker-compose exec -T db sh -c 'exec mysql -u"$MYSQL_USER" -p"$MYSQL_PASSWORD" "$MYSQL_DATABASE"'
