Skip to content

publysher/infra-example-nginx

Repository files navigation

infra-example-nginx

Companion repository for my blog post series Infra as a Repo.

In its current incarnation, this example provisions two servers: one salt master (salt) and one minion that will run Nginx (nginx01). These servers can be run locally on VirtualBox, or on Digital Ocean Droplets.

Requirements

If you want to deploy to Digital Ocean, you will need an account well.

Installing Salty-Vagrant

The latest official vagrant-salt-plugin release is somewhat outdated. To use this example, you will need to take the following steps:

  1. Check out salty-vagrant
  2. Apply Pull Request #98
  3. Install the plugin following the "Install from source" instructions.

Running local servers

Run vagrant up to create two virtualbox images. This will download a minimal Debian Wheezy 7.0 image from my dropbox account and spin up two images:

  • salt -- a VM containing nothing but a Salt master
  • nginx01 -- a VM containing a Salt minion, which installs an Nginx server

If you want easy access to these machines, add the following lines to your /etc/hosts file:

10.1.14.100	nginx01.intranet
10.1.14.50	salt.intranet

Create servers on Digital Ocean

Copy the Vagrant.local.example to ~/.vagrant.d/ and enter your Digital Ocean API key.

Run vagrant up --provider=digital_ocean to provision both servers at Digital Ocean. Run vagrant rebuild to recreate these server.

By default, the servers are the cheapest Droplets, hosted in NYC.