Skip to content

Instantly share code, notes, and snippets.

@jacobat
Created January 13, 2014 14:19
Show Gist options
  • Save jacobat/8401005 to your computer and use it in GitHub Desktop.
Save jacobat/8401005 to your computer and use it in GitHub Desktop.
Routing with etcd
-----------------
A site has the following structure:
/name
/current_revision => [revision]
/nodes
/[revision]
/[nodename] => [url]
For instance the sales site could have the following values:
/sales_site/current_revision => abcd
/sales_site/nodes/abcd/192.168.0.10 => 192.168.0.10:49013
/sales_site/nodes/abcd/192.168.0.11 => 192.168.0.11:49014
When deploying a new revision defg we would first add the new nodes:
/sales_site/nodes/defg/192.168.0.10 => 192.168.0.10:49021
/sales_site/nodes/defg/192.168.0.11 => 192.168.0.11:49022
And the switch the current_revision:
/sales_site/current_revision => defg
Leaving the tree as:
/sales_site/current_revision => defg
/sales_site/nodes/abcd/192.168.0.10 => 192.168.0.10:49013
/sales_site/nodes/abcd/192.168.0.11 => 192.168.0.11:49014
/sales_site/nodes/defg/192.168.0.10 => 192.168.0.10:49021
/sales_site/nodes/defg/192.168.0.11 => 192.168.0.11:49022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment