Skip to content

Instantly share code, notes, and snippets.

View cyberswat's full-sized avatar

Kevin Bridges cyberswat

View GitHub Profile
execute "drush-site-install" do
drupal_user = data_bag_item('users', 'drupal')[node.chef_environment]
install = site[:install]
if site[:database].nil?
cmd = "drush -y site-install #{site[:profile]}"
install.each do |flag, value|
cmd << " #{flag}=#{value}"
end
cmd << " --db-url=mysql://#{drupal_user['dbuser']}:#{drupal_user['dbpass']}@localhost/#{site_name}" if install['db-url'].nil?
cmd << " --account-name=#{drupal_user['admin_user']}" if install['account-name'].nil?
{
"mysql": {
"tunable": {
"innodb_log_file_size": "8M",
"key_buffer_size": "128M"
}
},
"drupal": {
"sites": {
"drupal": {
require 'fileutils'
require 'tempfile'
action :ensure do
t_file = Tempfile.new('/root/.profile_temp')
::File.open(new_resource.profile, 'r') do |f|
f.each_line do |line|
if line.match(/PATH=/)
if ::File.readlines(new_resource.profile).grep(/:#{new_resource.path.gsub('/','\/')}/).length > 0
t_file.puts line
use_inline_resources if defined?(use_inline_resources)
def whyrun_supported?
true
end
action :create do
template new_resource.name do
group new_resource.group
mode new_resource.mode
use_inline_resources if defined?(use_inline_resources)
def whyrun_supported?
true
end
action :create do
template new_resource.name do
group new_resource.group
mode new_resource.mode

I'm gradually getting serious about switching to Docker to deploy lemp webapps. I've chased the topic of best practices around the web for a while and landed on information like http://phusion.github.io/baseimage-docker/ docker/compose#928 and https://groups.google.com/forum/#!topic/docker-user/gk-oSwgxyo4

I basically maintain "two" roughly mirrored environments: one webdevs are working against in vagrant and one in the cloud (qa, staging, prod). The webdev's typically work on 2-5 sites at a time depending on the SLA and new client volume. I began using fig and am about to migrate to docker-compose. If I store everything in a client specific fig file, it tends to rapidly consume the memory of the vm. This makes it complicated for the webdev to switch between client webapps. I've seen this more readily when dealing with the database containers.

In my mind, the answer to the memory problem is to have one db container that can run databases for multiple clients. Are there other

@cyberswat
cyberswat / gist:0d346f6290bb46f3d39a
Created June 30, 2015 15:08
ansible dynamic hostname from ec2 tag

In my dynamic ec2 inventory I have data similar to:

{
  "_meta": {
    "hostvars": {
      "10.0.33.123": {
        "ec2_tag_Name": "MyFirstHost",
      }
      "10.0.33.124": {

"ec2_tag_Name": "MySecondHost",

#!/bin/bash -ex
function package {
dir=${PWD##*/}
for filename in "`pwd`/*"
do
echo $filename
if [ "$dir" == "windows" ]
then
zip ddev_"$dir".zip `basename $filename`
shasum -a 256 ddev_"$dir".zip > ddev_"$dir".sha256
@cyberswat
cyberswat / CLA Test
Last active July 21, 2017 19:22
Testing Github's CLA integration.
###SAP Individual Contributor License Agreement - VERSION 2
Thank you for your interest in contributing to open source software projects (“Projects”) made available by SAP SE or its affiliates (“SAP”). This Individual Contributor License Agreement (“Agreement”) sets out the terms governing any source code, object code, bug fixes, configuration changes, tools, specifications, documentation, data, materials, feedback, information or other works of authorship that you submit or have submitted, in any form and in any manner, to SAP in respect of any of the Projects (collectively “Contributions”). If you have any questions respecting this Agreement, please contact [email protected].
You agree that the following terms apply to all of your past, present and future Contributions. Except for the licenses granted in this Agreement, you retain all of your right, title and interest in and to your Contributions.
**Copyright License.** You hereby grant, and agree to grant, to SAP a non-exclusive, perpetual, irrevocab
@cyberswat
cyberswat / metadata
Last active July 21, 2017 19:52
CLA Test 2
This is my first agreement. This now different.