Skip to content

Instantly share code, notes, and snippets.

View rstarmer's full-sized avatar

Robert Starmer rstarmer

View GitHub Profile
@rstarmer
rstarmer / config.ru
Created December 31, 2015 10:19
Ruby rack configuration, describing how to run a Sinatra ruby application 'hw.rb'
require './hw'
run Sinatra::Application
@rstarmer
rstarmer / travis.yml
Created December 31, 2015 10:12
.travis.yml file to drive both test and deployment (on success) of a simple web app
sudo: false
language: ruby
rvm:
- 2.2.1
before_install:
- openssl aes-256-cbc -K $encrypted_a1a5bb03449b_key -iv $encrypted_a1a5bb03449b_iv -in travis.pem.enc -out travis.pem -d
- chmod 600 ./travis.pem
after_success:
- ssh web@ruby-hw.opsits.com -i ./travis.pem -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no /var/www/ruby_hw/update.sh
@rstarmer
rstarmer / play-update.yml
Created December 31, 2015 09:46
Ansible playbook to update a deployed docker image
---
- hosts: all
sudo: no
tasks:
- name: application container
docker:
name: ruby-hw
image: rstarmer/ruby-hw
state: reloaded
@rstarmer
rstarmer / playbook.yml
Created December 31, 2015 09:44
A playbook to deploy a docker environment on an Ubuntu 14.04 based VM
---
- hosts: all
sudo: no
####
tasks:
- name: Install dependencies
apt:
name={{ item }}
update_cache=yes
@rstarmer
rstarmer / Dockerfile
Created December 31, 2015 09:41
A dockerfile to create a passenger ruby application environment and install our application from github
# See https://github.com/phusion/passenger-docker/blob/master/Changelog.md for
# a list of version numbers.
FROM phusion/passenger-ruby22:0.9.18
# Set correct environment variables.
ENV HOME /root
# Use baseimage-docker's init process.
CMD ["/sbin/my_init"]
@rstarmer
rstarmer / playbook.yml
Created December 29, 2015 10:16
Main playbook for simple ruby application deployment. Requires 'passenger' role as well.
---
- hosts: all
sudo: yes
roles:
- passenger
handlers:
- name: reload apache
service: name=httpd state=reloaded
@rstarmer
rstarmer / ruby_hw.tf
Created December 29, 2015 10:08
Terraform .tf file to create a single VM in OpenStack
# Create a Virtual Machine
# For OpenStack, as with Digital Ocean, access credentials are needed
# They can be provided in a fashion similar to DO, passed as variables
# or via the terraform CLI as parameters, but they also can be passed
# as environment variables. The standard "openrc.sh" file includes
# all the prerequisite parameters including OS_AUTH_URL, OS_PASSWORD
# OS_USERNAME, OS_TENANT_NAME, and OS_REGION_NAME. The simplest is
# often to source the openrc file to set these variables, or set them
# in the provdier as follows:
@rstarmer
rstarmer / setup.sh
Last active December 21, 2015 10:53
Cloud Applications simple application setup.sh script for CentOS Linux
#!/bin/bash
#Install prerequisites
sudo yum install -y git httpd ruby-devel rubygems rubygem-bundler epel-release pygpgme curl
# Add the phusionsoft passenger RPM repository so that we can install the
# Apache passenger module
sudo curl --fail -sSLo /etc/yum.repos.d/passenger.repo \
https://oss-binaries.phusionpassenger.com/yum/definitions/el-passenger.repo
#!/bin/bash
echo hello world
@rstarmer
rstarmer / local.conf
Last active August 29, 2015 14:06
local.conf
[[local|localrc]]
# Uncomment the next line after you've run devstack once if you don't want to try to download everything again.
#OFFLINE=true
#VIRT_DRIVER=docker
# Set default passwords, further accelerate deployment, maybe make this less generic if you're in an environment where someone may 'play' with your system
ADMIN_PASSWORD=ubuntu
DATABASE_PASSWORD=ubuntu
RABBIT_PASSWORD=ubuntu
SERVICE_PASSWORD=ubuntu