-
Notifications
You must be signed in to change notification settings - Fork 2
Getting started
Note: this documentation always refers to docker and docker compose, never to sudo docker and sudo docker compose, for readability. Adapt the commands accordingly for your setup. We also use indifferently “host”, “host machine”, “laptop” or “workstation” to refer to the machine you’re using ce-dev on; and “guest”, “container” or “service” to refer to running containers. It will still work the same whether you actually use a laptop or not
Lets create a new Drupal 11 project. In a terminal cd to some convenient location, eg ~/Code or ~/Projects, and type:
ce-dev create
You’ll be prompted for a name for your project. We’ll use “hello” in this example. Keep it simple and short, and use only lowercase letters and numbers. This avoids issues when it’s later reused in various places (server name, database names, etc) that struggle with underscores or hyphens.
Pick “drupal11” as the project type.
This will generate a new “hello” directory, intialized as local git repo, with the following structure (you can ignore the .j2 files):
.
└── ce-dev
├── ansible
│ ├── deploy.yml
│ └── provision.yml
├── ce-dev.compose.prebuilt.yml
└── ce-dev.compose.yml
We can now initialize the project:
cd hello
ce-dev init
What this has done is:
- Generated the final docker-compose.yml file
- Updated/created the SSL CA on your host
Next step is to start our containers.
ce-dev start
What happened is:
- we called docker compose up
- ensured file permissions, ownership and uid/gid match between your user on the host and the ‘ce-dev’ user within the container
- started Unison file synchronisation. This action may take some minutes the first it is executed.
- updated the /etc/hosts file on your laptop You should now have two new running containers (check with docker ps), hello-db and hello-web. If you cat /etc/hosts you should also see matching entries for those.
We now need to configure the containers.
ce-dev provision
We have used Ansible to provision the running containers:
- installed php and nginx, generated a matching vhost
- created an SSL certificate for 'www.hello.local'
So, we have running containers, with the needed software installed and configured, but we still need one last step:
ce-dev deploy
We have used Ansible (again) to setup the application. In short, we’ve basically done:
- composer install
- generated a settings.php file
- drush install/path/to/vendor/bin
We’re now ready to go and start using our newly spinned up instance:
ce-dev browse
That should open https://www.hello.local/ in a new browser’s tab, with a fresh Drupal instance
You can grab a login link either accesing to the container or running drush directly
Acessing the shell with:
ce-dev shell
Will open a shell in the 'web' container. You can then cd ~/deploy/live.local and run a vendor/drush/drush/drush uli to grab a login link.
Using drush directly:
ce-dev drush uli
Will run drush uli inside the 'web' container and display the link
Once you finish your work, you can stop the container executing:
ce-dev stop
It will stop all the containers related to the project.
The commands:
- ce-dev initial
- ce-dev provision
- ce-dev deploy
These are only executed during the initial installation or when updating the project infrastructure (e.g., changing the PHP version). Once your project is set up, you only need to use:
- ce-dev start (to run your containers)
- ce-dev stop (to stop the containers)