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

Todo list updates in Readme #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tonistiigi
Copy link

No description provided.

@groundwater
Copy link
Owner

I think the primary goal is an automated vagrantification, so from a clean iso

  • setup zone using imgadm and vmadm (no support for more customization at first, only pre-made images)
  • add vagrant user to zone
  • apply ssh keys
  • setup passwordles sudo
  • add zone auto-start
  • add virtualbox guest tools
  • mount /vagrant folder
  • ensure global zone shuts down on vagrant halt
  • persist changes across updates

Any more?

@groundwater
Copy link
Owner

It looks like veewee might be a great environment under which to build this tool. @aszeszo you mentioned you wanted to migrate to veewee, have you made any progress there?

@tonistiigi
Copy link
Author

I guess Packer was made to be a better alternative to veewee. Anyway its ok for me.

I'll try to run the current prepare script on a blank box and see how far I get.

There's some other issues with the current box. When I add a private or public network(host only/bridged) to the @aszeszo box it doesn't finish the boot and I can't vagrant ssh into it any more. There are dladm errors visible in the terminal. On a raw box created from the ISO I can get the host-only to work.

There is a opt-tools-virtualbox-20130407 package at http://dlc-int.openindiana.org/aszeszo/vagrant/scripts/ . I guess this makes the shared folders magic happen. Not sure if this is something written by @aszeszo or ported from somewhere.

If you want to look around in the global zone then the root password is vagrant. You have to start the box manually because the ports are forwarded to the guest zone.

@tonistiigi
Copy link
Author

I tried this https://gist.github.com/tonistiigi/5907299 but with little luck. vagrant ssh does not work. Something weird going on there as the repackaged box seems to behave differently.

@groundwater
Copy link
Owner

I have been trying to manually prepare the image. I am stuck at the point of connecting vagrant ssh to the internal vm. Vagrant does not directly connect to the vm using it's dhcp-assigned IP address, it uses Virtualbox to forward a port on the mac to the image, for example mac:2222 -> vm:22. Then vagrant uses something like ssh -p 2222 localhost.

It looks like the original script is messing with the loopback IP here where they change it to 127.0.0.2.

I assume that the incoming SSH connection will be looking for 127.0.0.1 and perhaps be routed instead to the VM. This is the part I cannot figure out what's going on. Any ideas?

@groundwater
Copy link
Owner

I got ssh working into the non-global zone by using ipnat and creating a general redirect rule

https://gist.github.com/jacobgroundwater/5915312

It basically forwards all traffic destined for the GZ to the vagrant zone. It works, but most of these configurations are not persistent, and the zone doesn't auto-start.

@tonistiigi
Copy link
Author

Cool. Will check it out later. For autostart/persistence it just needs some SMF scripts?

@groundwater
Copy link
Owner

That's what the original script seems to do. The only persistent places on disk are in the zpool. A slightly trimmed list of our options is as follows:

# zfs list
zones                                             8.50G  88.5G   655K  /zones
zones/config                                      50.5K  88.5G  50.5K  legacy
zones/opt                                           31K  88.5G    31K  legacy
zones/usbkey                                       127K  88.5G   127K  legacy
zones/var                                         3.50M  88.5G  3.50M  legacy

# df
/zones             (zones             )
/var               (zones/var         )
/etc/zones         (zones/config      )
/opt               (zones/opt         )
/usbkey            (zones/usbkey      )
/etc/shadow        (/usbkey/shadow    )
/etc/ssh           (/usbkey/ssh       )

Thus we can only keep persistent data in /opt, /usbkey, /var or /etc/zones. Most of /etc is ephemeral.

@groundwater
Copy link
Owner

Okay, I got the /vagrant directory mounted using @aszeszo's opt-tools.

  1. unpack directory to /opt/tools-virtualbox and run /opt/tools-virtualbox/setup.sh
  2. share the folder under virtualbox; call it 'vagrant'
  3. copy to zone cp -r /opt/tools-virtualbox /zones/<zone-uuid>/root/opt
  4. from within zone:
    1. mkdir -p /vagrant
    2. call /opt/tools-virtualbox/etc/fs/vboxfs/mount -o uid=1000 vagrant /vagrant

I would like to script this part next. I am also curious where the original tools-virtualbox came from? Perhaps there is an updated version we can use.

I have an install script from the Virtualbox guest additions downloadable ISO

@tonistiigi
Copy link
Author

I'm still traveling and can't test on crappy hotel/airport wifi, but looking at your script, one thing I did wrong in my script is that I never copied tools-virtualbox to the guest zone, only started it on global zone.

Anyway seems you have made great progress. Any chance of getting the host-only IP assignment working? Or is it working already?

@tonistiigi
Copy link
Author

I got similar results as with my own scripts. I guess the thing I'm doing wrong has something to do with exporting the box file. When I set up the box everything seems to work fine, shared folders work and when I ssh to 2222 I get into the vagrant zone. But after I export it to ovf and try to make a reusable vagrant box out of it(https://gist.github.com/tonistiigi/5907299#file-make-vagrant-smartos-L52) vagrant ssh does not work this box.

One other thing I noticed is that currently the vagrant folder is mounted at boot but I guess this is something vagrant itself should do because there may be other folders defined in Vagrantfile. Or maybe there is a way to check what folders are shared and mount them all.

@groundwater
Copy link
Owner

I haven't had much bandwidth for this project recently.

I have to say, I think SmartOS is a bit broken by design, and this is yielding almost all of the problems we're encountering.

SmartOS is both a hypervisor and a user-land operating system. VMWare is a hypervisor, Xen is a hypervsisor, and neither of these are things I wish to run on top of Vagrant. Ubuntu is just an operating system; SmartOS is trying to be both. We are spending a lot of time working around the hypervisor/global-zone part of SmartOS, when we really don't care about it.

I think if this is going to go anywhere, we need to figure out how to build the user-land SmartOS image without touching zones.

I am happy to explain how all of my scripts work, and they do get the image pretty far along, but I think I am going to move on to other projects for now.

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.

2 participants