LakeDropsDrupalDev - L3D¶
Provides fully configured Docker images for local Drupal development where your local host requires nothing else than Docker being installed but no PHP, Composer or any other tool on this planet. It simply works.
Prerequisites¶
Nothing else than docker being installed on your host. You don't need any other tool - none!
Please refer to the official Docker documentation to quickly find out how to install docker on your platform.
Depending on your system setup you may also want to add your own user to the group docker
afterwards.
If your IDE doesn't come with integrated Git support, you may also have to install tools like Git, Git Flow or Git LFS - but all that depends on your specific needs. Usually all you need can be found inside of the L3D containers and you don't have to install any other tool on your host at all.
Quick start Linux¶
You can install the tool with the following command:
1 |
|
This will install the script l3d
into the given directory /usr/local/bin
from where it is executable everywhere on your host (assuming this path being in your search path). If you want that script to be installed elsewhere then provide that alternative path in the install command above. Instead of latest
you can also start with any other specific version number of this tool. You can find all available version strings in the tag list of this project.
Quick start MacOS¶
Use the following command to install L3D (replace myname
with your correct username):
1 |
|
Then make sure that the directory /Users/myname/bin
is included in the PATH environment variable or create a symbolic link in /usr/local/bin
. If you work with a symbolic link, MacOS also requires coreutils which can be installed with brew install coreutils
or sudo port install coreutils
.
Verifying SSH¶
As you will require SSH functionality in most development environments, let's make sure that this really works. In order to find out if your host is properly configured to use (and forward) SSH authentication, you should call ssh-add -l
and see if it lists your public key(s). if it doesn't, just call ssh-add
to add you public keys to the ssh agent. If this doesn't persist after a reboot of you host on MacOS, then please follow these instructions.
To test SSH easily, you can do something like this:
1 2 3 4 5 |
|
The same test also works with other hosts where your public key is configured as your authentication method. Please note, you can repeat these SSH tests inside the L3D container later on as well and they should produce the very same results.
Usage¶
Go to the project root for which you want to use L3D and execute the installed script: simply type l3d
at the command prompt.
It will ask you for the PHP version (input 7.0
, 7.1
, 7.2
, 7.3
, 7.4
or 8.0
), the project name and template to be used. Then it will download the matching L3D image and start a container for you. Furthermore you can choose, if want to use composer 1 for some reason. To downgrade just set the value 1
. The default is the version 2.
Inside the container you'll find the directory /drupal
which contains everything from your project's root. You can work from there by using these available tools:
Tool | Command | Shortcut |
---|---|---|
Ahoy | ahoy |
a |
Composer | composer |
c |
Docker | docker |
|
Docker Composer | docker-compose |
d-c |
DorgFlow | dorgflow |
|
Drush | drush |
d |
LakeDrops Drupal 8 or Drupal 9 project template¶
If you have chosen the LakeDrops Drupal 8 or Drupal 9 project template, type 'a d4d up' at the command prompt within the container to start the remaining containers.
'drush status' will then show you the URL of your project.
Update the start script¶
Just call l3d selfupdate
and the start script will be updated from the original repository. This will also update all your existing L3D images and remove the outdated containers so that they will be recreated the next timne you're going to use them.
Resetting containers¶
Sometimes the mounted volumes into existing containers will change, e.g. after a reboot on a Mac, the directory where the SSH-Agent stores their information will have gotten a different name. In such situations, starting one of the existing containers will throw error messages to the console. To resolve this, all L3D-related existing containers need to be rebuilt.
You chould call l3d reset
which cleans up all the related containers and prepares the system such that next call to L3D will rebuild those required containers from scratch. Note that removing containers will not remove their volumes. This is a good thing, because it makes sure that all your data will remain intact and will be used by the newly created containers just as before.
Working with Git credentials¶
In order to commit and push with git you have to at least configure your email address and username for the git client. If you configure those globally on your host, each of the L3D containers will inherit those settings and there is nothing that needs to be done inside the container.
To configure those credentials, use these commands:
1 2 |
|
Configuring the shell¶
By default, L3D tries to use the same shell inside the containers that you also use on your host. If that's not possible, it falls back to FISH.
If you want to overwrite the shell deliberatly, then define an environment variable on your host, like e.g.
1 |
|
Note that only new containers will get affected by this setting.
Configure automatic cleanup¶
To manually cleanup L3D projects, you can always call l3d delete id1 id2 id3 ...
to remove all related containers of the given projects. Should you want to get such cleanup automatically, when a user leaves L3D, then you just have to set an environment variable L3D_ALWAYS_CLEANUP=1
on your host before you create the first project. This will ask you at the end of any L3D session, if you want to delete all related containers. Answer with YES
, if you want that to happen.
Traefik Network¶
If it is a brand new installation, you might add the network traefic-public
by command docker network create traefik-public
.
Getting help¶
Calling l3d help
displays information about L3D and provides a link to further details.
Examples¶
Start a new project¶
1 2 3 4 |
|
You will be presented with a list of options on how to get started and you can simply follow the instructions on screen.
Use with an existing project¶
1 2 3 |
|