Use vagrant to set up a virtual box development virtual machine (VM) with:
A tested version of the VM is available on atlas.hashicorp.com, you can see the release notes at https://atlas.hashicorp.com/karenc/boxes/cnx-dev-vm.
To download the cnx development VM from atlas.hashicorp.com:
Download vagrant from https://www.vagrantup.com/downloads.html
vagrant init karenc/cnx-dev-vm
vagrant up
Edit your
/etc/hosts
file to include this line:10.11.12.13 cnx-dev-vm.org
Go to http://cnx-dev-vm.org:8000/ for the cnx site.
To take a snapshot of the VM, for example before an upgrade, you can install
vagrant-vbox-snapshot
:
vagrant plugin install vagrant-vbox-snapshot
To take a snapshot:
vagrant snapshot take "before-upgrade"
Once you have the VM running, you might need to update the code once in a while. You can run the following to update the code and restart all the services in the VM:
vagrant ssh # TODO sudo /etc/init.d/cnx-dev-vm restart
You can use vagrant status
to check the status of the VM. You'll see
something similar to this:
Current machine states: default running (virtualbox) The VM is running. To stop this VM, you can run `vagrant halt` to shut it down forcefully, or you can run `vagrant suspend` to simply suspend the virtual machine. In either case, to restart it again, simply run `vagrant up`.
If you don't want the VM anymore, you can do vagrant destroy
in the
directory with the Vagrantfile and it should remove the VM.
Either you can use the development VM directly or you might just use some of the services. For example, if you are a frontend developer, you may have webview installed locally and use archive, authoring, publishing and accounts from the VM so you don't have to set them up.
Webview is running at http://cnx-dev-vm.org:8000/
Archive is running at http://cnx-dev-vm.org:6543/
Authoring is running at http://cnx-dev-vm.org:8080/
Publishing is running at http://cnx-dev-vm.org:6544/
Accounts is running at https://cnx-dev-vm.org:3000/. There is already an admin
user added with username admin
and password password
.
If you don't want to use the version on atlas.hashicorp.com, you can create the VM yourself:
Download vagrant from https://www.vagrantup.com/downloads.html
Clone this repository:
git clone https://github.com/karenc/cnx-vagrant.git
cd cnx-vagrant
Create the vm:
vagrant up
(takes quite a long time)Edit your
/etc/hosts
file to include this line:10.11.12.13 cnx-dev-vm.org
Go to http://cnx-dev-vm.org:8000/ for the cnx site.
Once you have created the VM, look for the VirtualBox machine name. (On my
machine, it's in ~/VirtualBox VMs
)
- Shutdown the vm:
vagrant halt
vagrant package --base <virtual-box-vm-name> --vagrantfile cnx-dev-vm-Vagrantfile
vagrant box add karenc/cnx-dev-vm package.box
vagrant box list
should showkarenc/cnx-dev-vm
- In another directory, try downloading the VM:
vagrant init karenc/cnx-dev-vm
vagrant up
- Go to http://cnx-dev-vm.org:8000/ for the cnx site.
- Follow this guide to upload the box to atlas.hashicorp.com:
https://vagrantcloud.com/docs/providers (look for
UPLOAD A .BOX FOR PROVIDER
) - Delete the local box:
vagrant box remove karenc/cnx-dev-vm