Newer
Older
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.
Nothing else than docker being installed on your host. You don't need any other tool - none!
Please refer to the [official Docker documentation](https://docs.docker.com/get-docker/) 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](https://git-scm.com/downloads), [Git Flow](https://github.com/nvie/gitflow/wiki/Installation) or [Git LFS](https://git-lfs.github.com) - 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.

jurgenhaas
committed
## Quick start Linux
You can install the tool with the following command:
docker run -v /usr/local/bin:/setup --rm registry.lakedrops.com/docker/l3d/setup:latest

jurgenhaas
committed
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](https://gitlab.lakedrops.com/docker/l3d/tags) of this project.

jurgenhaas
committed
## Quick start MacOS
Here we have to circumwent some limitations that come with Docker for Mac:
1. Docker for Mac is not able to mount certain directories and one of those is anything underneath `/usr`. Therefore you have to use a different directory where the L3D script and some additional files get stored.
2. Docker for Mac does not properly mount sockets such that SSH agent can not be used inside of Docker containers the same way this is being done on Linux platforms. There are many workarounds available and we have integrated the approach from [mariusgrigaitis](https://github.com/mariusgrigaitis/docker-mac-ssh-auth-sock) into this project.
This requires [socat](https://linux.die.net/man/1/socat). You can install that with `brew install socat` or `sudo port install socat` or any other method that is applicable to you specific Mac. After installation make sure that `socat` can be found in your search path. If it got installed in a directory that isn't in the path, you can create a symbolic link to it into `/usr/local/bin`.

jurgenhaas
committed
Then use the following command to install L3D (replace `myname` with your correct username:
```bash
docker run -v /Users/myname/bin:/setup --rm registry.lakedrops.com/docker/l3d/setup:latest

jurgenhaas
committed
```
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](https://de.wikipedia.org/wiki/GNU_Core_Utilities) 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](https://apple.stackexchange.com/questions/253779/macos-10-12-sierra-will-not-forget-my-ssh-keyfile-passphrase/254619#254619).
To test SSH easily, you can do something like this:
```shell script
$> ssh -T git@github.com
# Hi yourusername! You've successfully authenticated, but GitHub does not provide shell access.
$> ssh -T git@gitlab.com
# Welcome to GitLab, @yourusername!
```
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.
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` |
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.
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:
```bash
git config --global user.email "you@example.com"
git config --global user.name "Your Name"
```

jurgenhaas
committed
## 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](https://fishshell.com).
If you want to overwrite the shell deliberatly, then define an environment variable on your host, like e.g.
```shell script
export L3DSHELL=/bin/bash
```
Note that only new containers will get affected by this setting.
## Getting help
Calling `l3d help` displays information about **L3D** and provides a link to further details.
## Examples
### Start a new project
```bash
cd /var/www
mkdir testproject1
cd testproject1
l3d
```
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
```bash
cd /path/to/your/project
l3d
composer update
```