This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module PgSequence | |
module PostgreSQLAdapter | |
def create_sequence(name) | |
execute "CREATE SEQUENCE #{name}" | |
end | |
def drop_sequence(name) | |
execute "DROP SEQUENCE #{name}" | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# This provides `create_enum` and `drop_enum` methods for migrations, which creates | |
# a Postgres ENUM type with the provided values. | |
# | |
# It'll also dump these into the schema.rb to be loaded into another DB (e.g. rake db:test:load) | |
# | |
# In order to reference the new enums as actual types, ActiveRecord needs to know about them, so | |
# make sure they are all represented in the `types` array below | |
# | |
# Then you can reference them in your migrations, e.g. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
knife ssh 'name:*' 'uptime' -G user@gateway.example.com -a private_ipaddress -x user | |
# to run chef-client on all servers: | |
knife ssh 'name:*' 'sudo chef-client' -G user@gateway.example.com -a private_ipaddress -x user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package 'postgresql-server-dev-9.2' | |
package 'postgresql-contrib-9.2' | |
# without hstore this won't build without fiddling, so it's easiest just to install hstore too | |
bash 'build_json_enhancements' do | |
code <<-CODE | |
cd /var/cache/chef | |
wget https://bitbucket.org/qooleot/json_enhancements/get/master.tar.gz | |
tar -xvzf master.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# This will force ActiveRecord to create proper `interval` column types in PostgreSQL | |
# | |
# def change | |
# add_column :leases, :period, :interval | |
# end | |
# | |
# This applies to a generated `schema.rb` file too. | |
# | |
# No special OID type is applied to an `interval` type. Rails will treat it as a string, although |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grunt.registerTask('cloudfront:invalidate', 'invalidate lib on cloudfront', function() { | |
var finished = this.async(), | |
aws = require('aws-sdk'), | |
path = '/libs/ll.sdk-' + sdk_version + '.js' | |
; | |
// set aws keys & region from config | |
aws.config.update({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# changing the postgresql data directory is an annoyingly non-trivial and fragile operation | |
# this should mostly do it but there are lots of things that can go wrong and if/when they do | |
# you will have lots of fun trying to eradicate broken postgres installs between chef runs | |
# | |
config_dir = "etc/postgresql/#{node[:postgresql][:version]}/main" | |
bash 'change_data_directory' do | |
code <<-CODE | |
mkdir /tmp/pg_conf_backup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- when you have a record which looks like this | |
-- | |
-- id: 5, | |
-- properties: { | |
-- ages: [20, 30] | |
-- } | |
-- | |
-- it is a bit of a pain if you need to query based on the contents of the "ages" array inside the JSON object "properties" | |
-- because PG currently lacks easy to use operators to work with JSON arrays |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this will provision a Ubuntu box with a basic lamp stack including a db/user for Prestashop | |
# it downloads Prestashop 1.5 into /tmp but doesn't install it, although you could quite easily | |
# extend this playbook to do that as you can run the prestashop installer via the shell | |
--- | |
- hosts: all | |
sudo: True | |
tasks: | |
- name: apt-get update | |
command: apt-get update |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input { | |
redis { | |
'data_type' => "list" | |
'host' => "127.0.0.1" | |
'key' => "logstash" | |
'type' => "redis-input" | |
} | |
} | |
filter { |