Skip to main content Skip to page footer

Technical Preview: running Flying Circus managed components locally in Vagrant

Erstellt von Christian Theune | | Blog

We have been looking for a way to allow developers to run the Flying Circus managed components in local installations, so they can develop while being offline or before starting to run the application in our commercial environment.

Vagrant is one of the tools we have been using ourselves to create various almost-like-the-Flying-Circus environments based on Ubuntu images, using Puppet or Shell scripts - but this been only a make-shift approach. Additionally we've been looking at NixOS for a while now and are preparing internally to move our platform away from Gentoo to NixOS. A switch like this is huge - but NixOS is a "DevOps-friendly" distribution and the community has a mind-set that is very much alike to the way we run the Flying Circus. After a while of experimentation we found that we were able to provide a nice reliable way for us (and you!) to create Vagrant setups that today feel "close enough" like the Flying Circus platform so that we can run developer instances of applications that we manage (and of our own tools!). Without further ado, here's how you can get started with this. Make sure you have Vagrant installed, after that, open your terminal and run:

$ mkdir fc-local-box
$ vagrant init flyingcircus/nixos-14.12-i686
$ wget shared00.fe.rzob.gocept.net/\~ctheune/vagrant-nixos-0.0.6.gem
$ vagrant plugin install ./vagrant-nixos-0.0.6.gem
$ cat > provision.nix
{ config, lib, pkgs, ... }: with config;
{
    flyingcircus.roles.haproxy.enable = true;
    flyingcircus.roles.nginx.enable = true;
    flyingcircus.roles.varnish.enable = true;
    flyingcircus.roles.mysql.enable = true;
}
$ vagrant up
$ vagrant ssh

Now you have a machine configured that has haproxy, nginx, varnish, and mysql that behaves almost like the installation upstream. Notable differences are that configuration is not applied running the usual "sudo" commands but by changing the configuration (where we have provided the "local" hooks) and then running "sudo nixos-rebuild switch" (inside) or running "vagrant provision" (outside). Also, you can experiment with custom NixOS configuration to install additional packages and configuration by adjusting the "provision.nix" file. The NixOS configuration that we have built and the base box is available on bitbucket. Note: the plugin download and installation is only needed once per host. Also, this isn't the currently released version of this plugin as it contains fixes from us that haven't been applied upstream, yet. And finally, remember: this is a technical preview so we won't guarantee this to be in a working condition, useful or won't eat your dog. Let me know what you think - contact me directly via email (ct@flyingcircus.io) or Twitter (@flyingcircusio). If you need help to get started - we're happy to show you how this works.

Zurück