Easy install features - example use case 'Automated install on VM'

I created some issues in https://github.com/frappe/bench/issues:

https://github.com/frappe/bench/issues/394
https://github.com/frappe/bench/issues/395
https://github.com/frappe/bench/issues/396

I believe that these changes are generally useful and not just for my current particular use case.

I currently want to just vagrant up and have all set up as minimal as possible like I need it. May it be for developing features for bench, frappe, erpnext or a custom app.

For that purpose I have a single Vagrantfile:


Vagrant.configure("2") do |config|
  config.vm.box = "bento/ubuntu-16.04"
  #config.vm.box = "ubuntu/xenial64"
  
  config.vm.network "forwarded_port", guest: 8000, host: 80
  config.vm.network "private_network", ip: "192.168.33.10"
  # config.vm.network "public_network"
  
  config.vm.synced_folder "./apps", "/home/vagrant/frappe-bench/apps",
                          owner: "vagrant", group: "vagrant", create: true
  
  config.vm.provider "virtualbox" do |vb|
    vb.memory = 2048
    vb.cpus = 1
  end
  
  ##
  # provision
  ##
  
  install_sh = <<-SH
  #!/bin/bash
  
  wget -q https://raw.githubusercontent.com/frappe/bench/master/playbooks/install.py
  sudo python install.py --develop --user vagrant
  cd frappe-bench
  
  bench get-app https://github.com/frappe/erpnext.git
    
  # bench switch-to-master
  
  bench new-site erpnext.dev
  
  bench install-app erpnext
SH
  
  config.vm.provision :shell, privileged: false, inline: <<-SHELL
    # call install file manually so it's interactive
    cat > install <<-SH
    #{install_sh}
SH
    sudo chmod +x install
  SHELL
end

To be just able to vagrant up and have it set, I need the easy install script to be non interactive, so providing the passwords beforehand. Also the install fails because the frappe-bench folder already exists, so Iā€™d need to overwrite that.

1 Like

@codeag Nice, feel free to send in relevant pull-requests too!

@rmehta Maybe merge frappe/bench master into develop? The change that adds the passwords.txt file (and some other changes) is only present in the master branch.