Vagrantfile

Here is the manifest file using a simple inline shell provisioner:

Plain text
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
  config.vm.box = "debian/jessie64"
  config.vm.network "forwarded_port", guest: 8000, host: 8000
  config.vm.synced_folder ".", "/vagrant", type: "virtualbox"
  config.vm.synced_folder "./projects", "/projects", type: "virtualbox"
  config.vm.provider "virtualbox" do |vb|
    # Display the VirtualBox GUI when booting the machine
    vb.gui = false
    vb.memory = "1024"
  end
  config.vm.provision "shell", inline: <<-shell sudo apt-get update install python-pip -y pip cactus yui-compressor ln -s usr bin yuicompressor closure-compiler awscli cat <<eob>

Installation

First, make sure you have both VirtualBox and Vagrant installed.
In a folder of your choice, say c:\dev\cactus, clone this Git repository: https://github.com/fredbourni/vagrant-cactus.git.
If you don't have a Git client installed, you can just grab the zip archive from GitHub: https://github.com/fredbourni/vagrant-cactus/archive/master.zip

Change into the directory where you cloned the repo:

Plain text
cd c:\dev\cactus

Boot the virtual machine with Vagrant:

Plain text
vagrant up

Use putty to SSH into the virtual machine at 127.0.0.1 port 2222 and create your first site:

Plain text
cactus create /projects/mysite.com
cd /projects/mysite.com

Start Cactus's built-in development server so you can test your site:

Plain text
cactus serve

Visit your Cactus site by pointing your browser to http://127.0.0.1:8000/

Generating the static site

Still over SSH in your Bash shell, build your site to generate the HTML, CSS, JS, and other static files:

Plain text
cd /projects/mysite.com
cactus build

Deploying to an S3 bucket with awscli

Still in the shell, configure awscli with an AWS user that has API access to your target S3 bucket:

Plain text
aws configure

Push your built files to your S3 bucket (without using Cactus's built-in deploy):

Plain text
aws s3 sync /projects/mysite.com/.build s3://mysite.com

And that's it, you now have a basic static site that's easy to test and deploy.