Ya' row ze: Lets go!

You are here

yaroozeadmin's blog

using a git repo to keep multiple locations in sync

Here's a fun script I created to demonstrate how to use a git repo to keep multiple target servers in sync:


# create a master repo that external users can push/pull from
git init --bare masterrepo.git

#create a file that will list known remote locations
touch masterrepo.git/hooks/remotelist.txt

What you should know before hosting on Pantheon

Choosing and moving to a hosting platform should be easy, but, if your goal is to re-home your platform/application, there are a ton of minute details that stack up to be a real thorn in your side. The goal of this post isn't to trash Pantheon (I'm actually relatively happy with them despite this list), but to account for things that a) I really think a professional hosting company should realistically be doing, and b) point out the details that we sort of assumed wouldn't be a problem that ultimately became sticking points.

updating all Git branches on a fork or other remote

If you have multiple remotes and want to keep them all up to date with a single master remote, you can do this in two commands:


git remote update
git push [TARGETREMOTE] refs/remotes/[SOURCEREMOTENAME]/*:refs/heads/*
git push [TARGETREMOTE] --tags

This is helpful if you have a fork of one repo and don't want to checkout/pull/merge all the origin branches, and then push them to the target.

bulk pushing branches to multiple remotes

We use git as a deployment tool as well as a repo. This is all thanks to GIT's new "receive.denyCurrentBranch updateInstead" option which we set at the destination webserver. With that set, we can push directly to that clone instance, and git will just update the working copy with any new commits pushed.

The two main challenges here are: 1) how do you push all branches? 2) how do you push to all remotes except origin?

Pushing all branches.

How to reverse something installed

A lesson I'm finally starting to learn is to avoid using sudo to do things as much as possible.

The other day I wound up screwing up and trying to force install a python package like so:

git clone [ansible.github.path]
...
make install
[failure]
sudo make install

this wound up installing ansible (in this case) with root permissions and caused all kinds of problems for continued use when attempting to use it w/o sudo - specifically when trying to get my vagrant provisioning script to run.

Auto rebase of branches matching a pattern

In some cases auto rebasing of branches is really helpful. for example: If a team is running a build server such as Jenkins, and they want to have a standard environmental deployment system configuration for each application - but allow for each app to have the settings tweaked, this might be very helpful. In this scenario, we can follow git-flow very easily and in addition to creating feature branches, we also create "environment" branches. These "env/" branches are long lived branches that contain the latest and greatest configuration properties of the application/environment.

Flushing Memcache in Acquia's Cloud Hooks

Using memcache with Drupal has some interesting problems.
1) If you do continuous rebuilds, you'll notice that memcache doesn't purge it's cache during site install - causing the old configuration to kick in with new code.
2) Certain drush commands can wind up using the cache instead of the updated code values.

Programmer challenge

I came across this code today in a drupal module. There is a very subtle bug in it. Can you spot it?


" class="dexp-bxslider">
<?php for($i = 0; $i < count($rows); $i+=$sliderows):?>

<?php for($j=$i; $j<$i+$sliderows; $j++):?>
<?php if(isset($rows[$j])) print $rows[$j];?>
<?php endfor;?>

<?php endfor;?>

Hint: what happens if count($rows) = 1 and $sliderows = 3? How would you rewrite this to not have the bug?

Configure varnish to cache httpauth protected files

Some environments need to be behind some form of authentication to keep prying eyes out, but, they might still want to take advantage of varnish's caching ability. The specific way I'm attempting to protect the environment is to use basic-auth from apache. The main issue though is that Varnish by default (and within nearly every VCL example I've found) specifically bypasses the cache when the Authorization header is in place. How then can both be achieved?

Adding MD5 support to Varnish using the DIGEST library

I have a need to hash a few header values together in varnish to verify a security key before either presenting from cache, or passing the request through to origin. The downside is, varnish doesn't support md5 (or any crypto functions for that matter) out of the box. There appears to be a mod library for varnish that seems to be reasonably supported by the organization, so doing some research I found this library - https://github.com/varnish/libvmod-digest .

Pages

Subscribe to RSS - yaroozeadmin's blog

Back to top