Skip to content
Snippets Groups Projects
Vagrantfile 2.59 KiB
Newer Older
  • Learn to ignore specific revisions
  • # -*- mode: ruby -*-
    # vi: set ft=ruby :
    
    # This Vagrantfile worked for Florian Sesser using Vagrant 2.2.16dev and
    # the VirtualBox Hypervisor. Earlier Vagrant and LibVirt did not work.
    
    Vagrant.configure("2") do |config|
      # For a complete reference, please see the online documentation at
      # https://docs.vagrantup.com.
    
    
      config.vm.define "payments.localdev" do |config|
    
        config.vm.hostname = "payments"
    
        config.vm.box = "esselius/nixos"
        config.vm.box_version = "20.09"
        config.vm.box_check_update = false
    
    
        # To use the self-updating deployment system you need more memory.  Giving
        # all of the VMs enough memory for this is rather taxing, though, and the
        # self-updating deployment system is not particularly useful for local
        # dev.  But should you want to:
        #
        # config.vm.provider "virtualbox" do |v|
        #   v.memory = 4096
        # end
    
    
        config.vm.network "private_network", ip: "192.168.67.21"
    
        # Add self signed SSL key for zkap-issuer:
    
        config.vm.provision "file", source: "private-keys/payments-localdev-ssl", destination: "/tmp/payments-localdev-ssl"
    
        config.vm.provision "shell", inline: "sudo mkdir -p /var/lib/letsencrypt/live/payments.localdev/"
        config.vm.provision "shell", inline: "sudo mv /tmp/payments-localdev-ssl/* /var/lib/letsencrypt/live/payments.localdev/"
    
      config.vm.define "storage1.localdev" do |config|
    
        config.vm.hostname = "storage1"
        config.vm.box = "esselius/nixos"
        config.vm.box_version = "20.09"
        config.vm.box_check_update = false
        config.vm.network "private_network", ip: "192.168.67.22"
      end
    
    
      config.vm.define "storage2.localdev" do |config|
    
        config.vm.hostname = "storage2"
        config.vm.box = "esselius/nixos"
        config.vm.box_version = "20.09"
        config.vm.box_check_update = false
        config.vm.network "private_network", ip: "192.168.67.23"
      end
    
    
      config.vm.define "monitoring.localdev" do |config|
    
        config.vm.hostname = "monitoring"
    
    Florian Sesser's avatar
    Florian Sesser committed
        config.vm.box = "esselius/nixos"
        config.vm.box_version = "20.09"
        config.vm.box_check_update = false
        config.vm.network "private_network", ip: "192.168.67.24"
      end
    
    
      # To make the VMs assign the static IPs to the network interfaces we need a rebuild:
    
      config.vm.provision "shell", inline: "echo '{nix.trustedUsers = [ \"@wheel\" \"root\" \"vagrant\" ];}' > /etc/nixos/custom-configuration.nix"
    
      config.vm.provision "shell", inline: "nixos-rebuild switch"
    
      config.trigger.after :up do |trigger|
        trigger.info = "Hostname and IP address this host actually uses:"
        trigger.run_remote = {inline: "echo `hostname` `ifconfig | egrep -o '192.168.67.[0-9]* '`"}
      end
    
    end