Vagrant and Ansible is used to setup the local development environment.
The installation of following software will be described under:
-
Install VirtualBox:
apt-get install -y virtualbox
Use the VirtualBox installer from http://virtualbox.org/ if the version in apt is older than 4.x (verify with
apt-cache show virtualbox | grep 'Version:'
). -
Install the Vagrant package for Ubuntu from the Vagrant download page.
The Vagrant version available in apt is (usually) outdated.
-
Install Ansible using pip:
pip install ansible
The Ansible version available in apt is (usually) outdated.
-
Install NFS package (required for folder sharing between host and guest):
apt-get install -y nfs-kernel-server
-
OPTIONAL: Install the vagrant plugin which upgrades the vb guest addons when necessary
vagrant plugin install vagrant-vbguest
-
Create the Vagrant dev VM:
vagrant up dev
This will download the base Vagrant box, configure a VM and provision it using Ansible. The provision step automatically installs erlang, elixir and the phoenix framework (plus all other needed packages). For more provisioning steps, please see
provisioning/
. -
Login to the Vagrant VM by running:
vagrant ssh dev
-
Start development:
mix phoenix.new hello_phoenix
cd hello_phoenix
mix phoenix.server
This will create and run the demo app.
The demo is running on http://localhost:4000
-
OPTIONAL: Add a database user
sudo -u postgres createuser -P -s -e phoenix_user
Edit the database part of
config/config.exs
to match the user and password you just created. You should now be able to follow the database part of the phoenix tutorial.
This part of manual will refer to the linux part when possible.
On osx it´s adviced to install homebrew. It will be used in the installation procedure.
-
Install homebrew Follow the instructions at Homebrew´s site. You will bea able to install various handy package with the
brew
command. -
Install VirtualBox:
Get the newest version from Virtualbox download page and install it.
-
Install the Vagrant package for Ubuntu from the Vagrant download page.
-
Install Ansible:
Homebrew is well maintained and the packages are rapidly updated to the latest version. Install ansible with:
brew install ansible
From this point on you can continue with the Ubuntu installation instructions, starting at step 5.