This guide is for setting up a frappe/erpnext vagrant box from scratch plus a few extra productivity goodies. Right now this guide is MACOS ONLY but most steps should work fairly similarly on Windows and much more so on Linux.
Make sure you have vagrant installed and virtual box:
info about vagrant and virtualbox:
https://www.vagrantup.com/docs/virtualbox/
-
Clone this repo somewhere in your host machine, open a terminal and cd into the directory.
-
Kick off vagrant box setup:
vagrant up
- Go make some coffee this will take a while to create a test frappe site.
bench new-site frappe
bench start
You can use vagrant's file system sync feature to edit your apps in your host and making these changes immediately available to the frappe guest vm.
After you have built and initialized your vagrant box:
- Start up your vagrant box and ssh into it
vagrant up
vagrant ssh
- Move the apps directory in ~/frappe-bench/apps to your vagrant shared directory /vagrant/ and create mount point
mv ~/frappe-bench/apps /vagrant/
mkdir ~/frappe-bench/apps
- Edit ~/.profile add the following lines at the end of the file
sudo mount --bind /vagrant/apps /home/vagrant/frappe-bench/apps
- Execute changes to .profil
source ~/.profile
Your vagrant/apps folder now can be used on your host as well as guest without having to manualy syncronize any data. NOTE: There is a current issue with vagrant shared folders where inotify events will not trigger when files are updated from the host. This means that while working and saving files from the host, frappe will not detect file changes thus will not reload them. To get around this you must install vagrant-fsnotify and vagrant-triggers plugins. Their configuration variables are already available on the Vagrantfile. To install run the following in your vagrant vm folder:
vagrant plugin install vagrant-fsnotify vagrant-triggers
To get your ssh key into your vagrant box add the following in the VagrantFile:
Vagrant::Config.run do |config|
config.ssh.forward_agent = true
end
You must also enable your host's ssh agent. On linux and mac the following should work:
/usr/bin/ssh-add -K ~/.ssh/id_rsa
On macs you will have to add this to ~/.ssh/bash_profile due to keys being 'forgotten' on restarts
You can proxy your development frappe instance through your local nginx server to ease development through a custom local hostname or even make your local development instance available to the internet.
Make sure your instance is accessive first through:
- Copy mac-nginx/conf.d/frappe-v8.conf to your local nginx config file
cp ./mac-nginx/conf.d/frappe-v8.conf /usr/local/etc/nginx/conf.d/
- Edit your newly copied nginx config file and change the domain name to anything you like.
server_name frappev8.dev;
to
server_name myfrappe.dev;
- Edit your /etc/hosts file to point to your local nginx instance
127.0.0.1 frappev8.dev
or if you changed your domain
127.0.0.1 myfrappe.dev
- Start nginx
sudo nginx
or reload it if already running
sudo nginx -s reload
- Now you can access your dev frappe instace on your browser at:
http://frappev8.dev
or if you changed your domain
http://myfrappe.dev