Development environment for the Sulu content management platform built with Docker Compose.
Docker is a great tool for trying new technologies effortlessly. Unfortunately, there are still significant filesystem performance issues when using bind mounts on some systems.
If you are experiencing bad performance, we recommend to use dockerized services (MySQL, Elasticsearch) in combination with the Symfony Local Web Server. For example, the Sulu Demo repository includes such a setup.
- Sulu-Website:
PROJECT_DOMAIN:PORT_NGINX
(default:sulu.localhost:18080
) - Sulu-Admin:
PROJECT_DOMAIN:PORT_NGINX/admin
(default:sulu.localhost:18080/admin
) - MySQL:
PROJECT_DOMAIN:PORT_MYSQL
(default:sulu.localhost:13306
) - Elasticsearch:
PROJECT_DOMAIN:PORT_ELASTICSEARCH
(default:sulu.localhost:19200
)
git clone https://github.com/sulu/sulu-docker && cd sulu-docker
The .env
file contains several environment variables that are used to throughout the environment.
This allows to configure the project path, database settings, public ports of the services and the domain name.
To access your project via the configured domain, you need to add it to your /etc/hosts
file:
127.0.0.1 sulu.localhost (value of your PROJECT_DOMAIN)
docker-compose up
You can also startup the containers in the background by executing:
docker-compose start
# Start bash inside of the php container
docker-compose exec php bash
# Create a new sulu project with composer
composer create-project sulu/skeleton /var/www/html
# Set service urls to the `.env.local` file
echo "DATABASE_URL=mysql://$MYSQL_USER:$MYSQL_PASSWORD@mysql:3306/$MYSQL_DATABASE" >> .env.local
echo "ELASTICSEARCH_HOST=elasticsearch:9200" >> .env.local
# Initialize sulu project
bin/adminconsole sulu:build dev --destroy
After completing these steps the services are accessible via the URLs listed above.
When changing configuration inside of the docker
folder, the environment must be rebuilt and restarted:
docker-compose down
docker-compose build
docker-compose up