[BETA] Docker Compose

WARNING! This is a new feature, currently in BETA. Only these containers are available: MySQL, PostgreSQL, MongoDB, Cassandra, Elasticsearch

Description

When generating your application, if you choose MySQL, PostgreSQL, MongoDB or Cassandra, a docker-compose.yml or docker-compose-prod.yml file is generated in your folder project.

If you choose Elasticsearch as search engine, the configuration will be included in docker-compose-prod.yml.

So you can use docker-compose to start your database in development or production profile.

All these images come from the official Docker Hub:

Prerequisites

You have to install Docker and Docker Compose:

Starting MySQL, PostgreSQL or MongoDB

In development profile:

docker-compose up -d

In production profile (it will start Elasticsearch too if you selected it as search engine):

docker-compose -f docker-compose-prod.yml up -d

Starting Cassandra the first time

In development profile:

  • Build the image, which will contain the CQL scripts generated by your project for initializing the database: docker-compose build
  • Start the container (it will show the container id): docker-compose up -d
  • Initialize the database by creating the Keyspace and the Tables: docker exec -it "container id" init

In production profile:

  • Build the image: docker-compose -f docker-compose-prod.yml build
  • Start the container (it will show the container id): docker-compose -f docker-compose-prod.yml up -d
  • Initialize the database by creating the Keyspace and the Tables: docker exec -it "container id" init

Starting Cassandra the next times

In development profile:

docker-compose up -d

In production profile: docker-compose -f docker-compose-prod.yml up -d