Make your colleagues, friends, and family happy. Tell them how great they are. This is a web application built with a Packer config file.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
css
js
resources
README.md
directories.sh
favicon.ico
happy-image-dcs.json
happy-image.json
index.html

README.md

happy-randomizer

Make your colleagues, friends, and family happy. Tell them how great they are. This is a web application built with a Packer config file for Triton.

Check out a live demo.

What's included

This application is a website which randomizes inspirational quotes and GIFs at the click of a button. Included:

  • index.html file
  • JSON file grouping quotes and GIFs
  • CSS stylesheet
  • jQuery for swapping the quotes and GIFs
  • Packer file to build an image on a single Triton data center
  • Packer file to build an image on multiple Triton data centers

Create a Packer image with Triton

Read my post for Joyent on creating custom infrastructure images. The configuration file has already been created, so you can skip ahead to build the image.

Creating image version 1.1.0

There is an alternative JSON file, thumbsup.json, which uses only thumbs up GIFs. To create another version of a Packer image which uses that JSON file:

  1. Edit main.js so that the url is equal to "./resources/thumbsup.json".
  2. Edit the single data center Packer configuration file to change the image_version to 1.1.0.
  3. Repeat the instructions for building an image

Deploying to multiple data centers

It is possible to deploy your image to multiple data centers at the same time. This requires naming your builder with "name" and updating the "triton_url".

In the below example, I'm using a variable for the us-east-1 and us-east-2 data centers, both as the name of the builder and as a part of the Triton URL.

"variables": {
    "triton_dc_east1": "us-east-1",
    "triton_dc_east2": "us-east-2",
    "triton_account": "{{env `SDC_ACCOUNT`}}",
    "triton_key_id": "{{env `SDC_KEY_ID`}}"
},
"builders": [
    {
      "name": "{{user `triton_dc_east1`}}",
      "type": "triton",
      "triton_url": "https://{{user `triton_dc_east1`}}.api.joyent.com",
      "triton_account": "{{user `triton_account`}}",
      "triton_key_id": "{{user `triton_key_id`}}",
      
      [...]
    },
    {
      "name": "{{user `triton_dc_east2`}}",
      "type": "triton",
      "triton_url": "https://{{user `triton_dc_east2`}}.api.joyent.com",
      "triton_account": "{{user `triton_account`}}",
      "triton_key_id": "{{user `triton_key_id`}}",
      
      "ssh_username": "root",
      
      [...]
    }
],

Check out the Packer file for multiple DCs, which includes all of our available data centers.