Skip to content

Instantly share code, notes, and snippets.

@meatherly
meatherly / Vagrantfile.rb
Created July 28, 2015 14:59
Vagrant Phoenix set up
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
# https://docs.vagrantup.com.
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
@meatherly
meatherly / gist:81041518da4fc0ef9a83
Created April 2, 2015 22:42
Add cascading foreign keys to app
class TableUpdater
attr_accessor :tables, :migration_statements
def initialize
@tables = ActiveRecord::Base.connection.tables.reject{|t| t == "schema_migrations"}
@migration_statements = []
end
def make_migration_file
@tables.each do |table|
@meatherly
meatherly / gist:4404ab91cdc0374022c8
Created May 20, 2014 02:19
Puppet and bitbucket

The problem We have multiple client NDAs. The client usually gives us access to their AWS account and let's us create web servers to host their apps. We use Capistrano to deploy the web app to their machine. The deploy user on the server needs access to our bitbucket account for that client's repo. I don't want create a key on bitbucket account and put the private key on the client's server because they would have access to all of our client's repos on bitbucket. So I'm trying to figure out a way to create the deploy user's public key on the server and then copy it over to the repo's deploy key list using bitbuckets api.

I wish there was a way I could execute code out side of the manifest to create a key pair and then copy the private key to the deploy user and copy the public key over to bitbucket.

Any good suggestions for this?

class profile::web {
#vars
$app_name = hiera('webserver::app_name', undef)
$sanitized_app_name = regsubst($app_name, ' ', '-', 'G')
$sites_available_conf = "${nginx::config::nx_conf_dir}/sites-available/${sanitized_app_name}.conf"
$sites_enabled_conf = "${nginx::config::nx_conf_dir}/sites-enabled/${sanitized_app_name}.conf"
class { 'nginx':
conf_template => "profile/web/nginx.conf.erb",
}