-
-
Notifications
You must be signed in to change notification settings - Fork 645
Add instructions for running Drupal VM inside Docker #1206
Comments
Scenario 1: Just building a local Docker container to replicate what our tests do:
|
@geerlingguy have found this incredibly very useful for CI - https://hub.docker.com/r/beet/box/ Can run |
Also converted tests to run with docker & robo -- https://github.com/beetboxvm/beetbox/blob/master/RoboFile.php loving robo :) & composer scripts -- https://github.com/beetboxvm/beetbox/blob/master/composer.json#L29
|
I would love it if I could run the tests locally with just a simple |
@oxyc all my projects now have a Makes it easy to remember how to run tests, like composer polymorphism. |
++ to all the above; right now I manually run a few docker commands when I want to run tests on a given role/project. I'd be happy to wrap things a little better to get the tests runnable with one command. |
Two thoughts:
|
@oxyc could having a This means we can assume the config location -- https://github.com/beetboxvm/beetbox/blob/master/Dockerfile |
Yes that would work but would remove the convenience of being able to point pre/post provision scripts straight into to the examples directory (or another composer dependency). Edit: Not sure if we should prioritize Vagrant and just live with the annoyance, or make docker more of a first class citizen. |
This was one of the primary reasons behind moving to composer only support, we can now also assume that the project directory is at Therefore, the config can be pulled directly from either location. |
(And to reply to the question earlier, yes, I think it would be easiest to do what you want to do via a Will either of you be present at DrupalCon Baltimore this week? Would be awesome to meet up! |
Sadly no, unfortunately it's a bit out of my budget range. |
@geerlingguy unfortunately not this time, hoping to make it to Vienna this year. |
Picking this up this morning. |
I'm adding some tests to Drupal VM's composer.json, and it is surprisingly quite simple. For now, they're inline in composer.json, and I might stick with that for the time being... at some point, it would be nice to find a clean way to make comprehensive tests runnable between Travis and Also, because the volume is slow on Mac, I'm getting this error:
So I'll set |
And thinking further, maybe it would be good to abstract the tests all into a script/scripts that are accessed through Composer, then we can switch .travis.yml over to running |
Recommend robo for docker based stuff -- http://robo.li/tasks/Docker/ |
Now I'm hitting: geerlingguy/ansible-role-mysql#57
|
Yep, .mysql not running during build |
Requirements for docker on 14.04 |
@geerlingguy sorry was on the train... let me know if you need any help. This is essentially building DVM on 14.04 -- https://hub.docker.com/r/beet/box/~/dockerfile/ |
@thom8 - Oops, I meant to try Ubuntu 16.04 (for a POC) instead of 14.04, because yeah, 14.04 is kinda annoying :P |
So looking forward to dropping all the |
So, so far the quick and dirty way is to do the following: Build a Docker container using the configuration in your Drupal VM instance:TODO (this will go into a Commit the built container as a new image and save that image:
(After this, you can safely remove the built image with Load the saved image:
(On the same computer or on another.) Run a new container using the loaded image:
Win!Visit http://localhost:8888/ |
Working on the composer script now. |
Checking now to see if I can wrap all the docker testing stuff inside Also, it's more easy/doable to use something like Robo this way (but I'm fine with Bash, at least for now... if it works, it works.) |
So, that's nice. I'm going to merge that work, then second half of this issue will be making sure you can use Drupal VM to build yourself a nice Docker image (it seems with Ubuntu 16.04 the image ends up being around 1.2 GB with the defaults; I've yet to test Debian 8). |
With the changes above, you can now run the exact same tests that are run on Travis CI using the same command: See new section in README: https://github.com/geerlingguy/drupal-vm#tests We'll see how far I can get in the airport tomorrow :) Also, note that some of this work may affect our approach to how we want Drupal VM to be a Composer plugin over in #1256 |
Nice, I guess robo makes it more platform agnostic but it's probably becoming less of an issue with WSL. |
A few outstanding issues:
|
Apparently the container has some semblence of persistence (between stop/start) already, so I can |
Also note that this experimental branch is likely far from what we'll eventually get to in the 'primarily Vagrant but possibly Docker' stage of Drupal VM's existence... right now the instructions involve committing the database inside the container (makes for a larger image, and can cause annoying extra work in rebuilding/syncing/etc.). But as with all things Docker there are some tradeoffs here and there (e.g. use a separate volume for MySQL dir... mount a volume... etc.). Right now I'm trying to see what would be the simplest way to implement networking so you could use the same IP as There will most definitely be a few manual steps involved in the generation and use of Docker images:
|
PROGRESS! Special thanks to moby/moby#22753 (comment) — I was going insane trying to figure out why I couldn't get bridged networking working. Every. Single. Guide. And. Docs. Page assumes you are running on Linux or Windows—there's a small caveat buried in the Docker for Mac pages where it talks about Between this and the lack of write caching in the filesystem layer (though read caching is here, and helps Drupal tremendously), it's still highly annoying to do 'native' Docker development on a Mac. For now, Docker support in Drupal VM will be experimental. But at least I have a path forward, woot! |
Left a follow-up comment here: moby/moby#22753 (comment) |
Using the IP trickery in the initial But there's a good chance I'm going to switch many if not most of my personal projects to using Docker, just because it's so darn fast (well, with anything that doesn't require writing a lot of code). And technically I can tweak Drupal VM settings and reprovision if I need to. |
Fixes #1206: Add instructions for running Drupal VM inside Docker.
Merged what I had worked on so far. It works well enough; definitely room for improvement. |
Issue Type
Your OS
Summary
While doing some debugging for a 4.2.2 release (see #1200), I was just thinking to myself... we already have test rigs set up for Travis CI that builds and runs Drupal VM inside Docker.
And someday there may be an official set of Docker Images for Drupal VM (though maintaining a similar architecture to the current incarnation of Drupal VM)... but in the interim, we could at least provide some instructions for how you could run Drupal VM on top of Docker, bypassing Vagrant entirely.
This would be fully experimental for now, and there are a bunch of conveniences Vagrant adds that Docker can't at this point (at least not without an insane amount of extra spaghetti work), but it's doable, and in some cases it's faster than Vagrant-based builds.
The text was updated successfully, but these errors were encountered: