Vagrantfile
Here is the manifest file using a simple inline shell provisioner:
# -*- 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:
cd c:\dev\cactusBoot the virtual machine with Vagrant:
vagrant upUse putty to SSH into the virtual machine at 127.0.0.1 port 2222 and create your first site:
cactus create /projects/mysite.com
cd /projects/mysite.comStart Cactus's built-in development server so you can test your site:
cactus serveVisit 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:
cd /projects/mysite.com
cactus buildDeploying 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:
aws configurePush your built files to your S3 bucket (without using Cactus's built-in deploy):
aws s3 sync /projects/mysite.com/.build s3://mysite.comAnd that's it, you now have a basic static site that's easy to test and deploy.
