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 a Vagrantfile with a custom box to the project. #479

Merged
merged 1 commit into from
Mar 13, 2017
Merged

Add a Vagrantfile with a custom box to the project. #479

merged 1 commit into from
Mar 13, 2017

Conversation

obestwalter
Copy link
Member

@obestwalter obestwalter commented Mar 12, 2017

fixes #455

First implementation uses a custom built Arch Linux box hosted on Atlas.

All relevant adjustments to the box creation are in scripts/bindlestiff.sh. Basically what is does is switch of the too small tmpfs, installs pyenv, compiles lots of Python versions and makes sure that the user can just type tox directly after logging in.

A first vagrant up arch looks for the box locally and downloads and imports it if necessary. This looks something like this:

16:54:19 oliver@ob1 [0] < ~/work/tox/tox >  2972 %
vagrant up arch

Bringing machine 'arch' up with 'virtualbox' provider...
==> arch: Box 'obestwalter/bindlestiff-arch-linux' could not be found. Attempting to find and install...
    arch: Box Provider: virtualbox
    arch: Box Version: >= 0
==> arch: Loading metadata for box 'obestwalter/bindlestiff-arch-linux'
    arch: URL: https://atlas.hashicorp.com/obestwalter/bindlestiff-arch-linux
==> arch: Adding box 'obestwalter/bindlestiff-arch-linux' (v0.0.1) for provider: virtualbox
    arch: Downloading: https://atlas.hashicorp.com/obestwalter/boxes/bindlestiff-arch-linux/versions/0.0.1/providers/virtualbox.box
==> arch: Successfully added box 'obestwalter/bindlestiff-arch-linux' (v0.0.1) for 'virtualbox'!
==> arch: Importing base box 'obestwalter/bindlestiff-arch-linux'...
==> arch: Matching MAC address for NAT networking...
==> arch: Checking if box 'obestwalter/bindlestiff-arch-linux' is up to date...
==> arch: Setting the name of the VM: tox_arch_1489334164336_90778
==> arch: Clearing any previously set network interfaces...
==> arch: Preparing network interfaces based on configuration...
    arch: Adapter 1: nat
==> arch: Forwarding ports...
    arch: 22 (guest) => 2222 (host) (adapter 1)
==> arch: Running 'pre-boot' VM customizations...
==> arch: Booting VM...
==> arch: Waiting for machine to boot. This may take a few minutes...
    arch: SSH address: 127.0.0.1:2222
    arch: SSH username: vagrant
    arch: SSH auth method: private key
    arch: 
    arch: Vagrant insecure key detected. Vagrant will automatically replace
    arch: this with a newly generated keypair for better security.
    arch: 
    arch: Inserting generated public key within guest...
    arch: Removing insecure key from the guest if it's present...
    arch: Key inserted! Disconnecting and reconnecting using new SSH key...
==> arch: Machine booted and ready!
==> arch: Checking for guest additions in VM...
==> arch: Mounting shared folders...
    arch: /vagrant => /home/oliver/Dropbox/projects/tox/tox
vagrant up arch  11.03s user 4.81s system 12% cpu 2:06.37 total

A vagrant ssh arch will propell the user into the machine and they can call tox right away:

16:56:31 oliver@ob1 [0] < ~/work/tox/tox >  2973 %
vagrant ssh arch

Removing all *.pyc files in mapped project ...
[vagrant@vagrant-arch vagrant]$ tox

GLOB sdist-make: /vagrant/setup.py
py27 inst-nodeps: /vagrant/.tox/dist/tox-2.6.1.dev1.zip
[...]

Note the "Removing all *.pyc files in mapped project ..." this is something I added to the boxes .bashrc and I am not 100% sure if this is the right way to go about it. This prevents pytest from borking due to mismatches in the pyc files. It would be nice if pytest would be able to deal that directly. If anyone has an idea to handle that better, please let me know.

  • Make sure to include one or more tests for your change;

I tested it manually from my Host (also Arch Linux). If macOS and Windows users have trouble, I will have to look into this, but from my experience, the whole vagrant workflow is pretty solid nowadays.

The best way to test this is to start using it.

  • if an enhancement PR please create docs and at best an example

Docs are in the Vagrantfile itself for now. If this turns out useful, I will provide "proper" docs as part of #475.

  • Add yourself to CONTRIBUTORS;

  • make a descriptive Pull Request text (it will be used for changelog)

Added this to the changelog myself.

@obestwalter obestwalter merged commit 5df724f into tox-dev:master Mar 13, 2017
@obestwalter obestwalter deleted the 455-add-vagrant branch July 16, 2017 10:38
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

Successfully merging this pull request may close these issues.

Make local testing easier with Vagrantfile
2 participants