Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for running virtualbox/vagrant inside of lope #28

Open
3 of 9 tasks
Crazybus opened this issue Jun 17, 2018 · 0 comments
Open
3 of 9 tasks

Add support for running virtualbox/vagrant inside of lope #28

Crazybus opened this issue Jun 17, 2018 · 0 comments

Comments

@Crazybus
Copy link
Owner

Crazybus commented Jun 17, 2018

A really common dependency for development and testing environments is vagrant and virtualbox. While vagrant supports using docker as the provisioner it will never give you something "virtual machine" like. Allowing vagrant to talk to virtualbox from inside a docker image brings a lot of challenge. Mostly of these challenges come from the fact that vagrant directly calls the VBoxManage command to interact with virtualbox.

Design (with working POC)

When lope is run with the -vbox flag the following happens:

  • Lope starts a http endpoint which allows running commands and will return the output
  • A binary called VBoxManage is added into the docker container which proxies all commands to the lope http endpoint and prints the result
  • localhost is set to the IP address of the host machine running docker (host.docker.internal) --add-host=localhost:192.168.65.2
  • Lope runs as the current user and that user has an actual account in the docker image (requirement of vagrant)
  • The working directory is set to the host working directory so that mounting directories into virtualbox works as expected

With all of these things setup lope is able to start a container and run vagrant up && vagrant ssh successfully!

Todo

  • Move current server POC code directly into lope
  • Move current client POC code and build and release it as a separate binary. This client works for VBoxManage but has been written in a way to be a generic host command proxy
  • Find a nice way to get the value of host.docker.internal so that the localhost of the container can be set to it.
  • Don't run as root when the -vbox flag is added
  • When running a container as the current user actually add the users account into the image. This will also fix some weirdness with git and running as different users.
  • Set working directory to match the host working directory. (Should this be the lope default?)
  • Automatically set the $HOME directory (normally blacklisted)
  • Mount ~/.vagrant.d/boxes/ into the container
  • Add option in vagrant to use "localhost" instead of "127.0.0.1". This used to be the default but was changed because OSX doesn't have localhost by default (or didn't a few years ago). vagrant source. For testing purposes this can be monkey patched with RUN sed -i 's/127.0.0.1/localhost/g' /opt/vagrant/embedded/gems/2.1.1/gems/vagrant-2.1.1/plugins/providers/virtualbox/provider.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant