Skip to content
This repository

Independent instances #38

Closed
wants to merge 10 commits into from

2 participants

Gerhard Lazu Adam Hamsik
Gerhard Lazu
Owner

Creates independent instances of your code across all $HOSTS.

Should include status (show all remote instances) & pruning (keep only n instances).

Adam Hamsik

I like this one do you plan to merge it in ?

Gerhard Lazu
Owner
gerhard commented

Yes, I was meant to get it finished months ago! I went through most of my backlog now, shouldn't be much longer.

Gerhard Lazu
Owner

Docker was made for this very feature, it's outside the scope of deliver.

Gerhard Lazu gerhard deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
4 libexec/defaults
@@ -16,8 +16,8 @@ SSH_TIMEOUT=3
16 16
17 17 AUTHORIZED_REMOTE_HOSTS=()
18 18
19   -REQUIRED_CONFIGS=("ORIGIN_DIR" "STRATEGY")
20   -OPTIONAL_CONFIGS=("APP" "APP_USER" "DELIVER_TO" "REFSPEC" "GIT_PUSH" "REVISION" "FOREMAN_EXTRAS" "PORT" "AUTHORIZED_REMOTE_HOSTS")
  19 +REQUIRED_CONFIGS=(ORIGIN_DIR STRATEGY)
  20 +OPTIONAL_CONFIGS=(APP APP_USER DELIVER_TO REFSPEC GIT_PUSH REVISION FOREMAN_EXTRAS PORT AUTHORIZED_REMOTE_HOSTS)
21 21
22 22 MODE="compact"
23 23
107 libexec/init
@@ -7,41 +7,52 @@ __version() {
7 7 __help() {
8 8 __version
9 9
10   - echo -e "${txtbld}Usage:${txtrst}
11   - deliver [MODE] [COMMAND]
12   - deliver [OPTIONS]
13   -
14   -${txtbld}Commands:${txtrst}
15   - deliver strategies Lists all available strategies
16   - deliver check Checks if everything is setup correctly, displays the entire configuration
17   - deliver [MODE] Takes your code into production
18   -
19   -${txtbld}Modes:${txtrst}
20   - -C, --compact Displays every task as it's run, silences all output. (default mode)
21   - -V, --verbose Same as above, does not silence output.
22   - -P, --plain Displays every task as it's run, silences all output. No colouring. (CI)
23   - -D, --debug Runs in shell debug mode, displays everything.
24   -
25   -${txtbld}Options:${txtrst}
26   - -s, --strategy Enforces a particular strategy.
27   - -h, --help Displays this help. (works with no other options)
28   - -v, --version Displays the running version (works with no other options)
29   -
30   -${txtbld}Miscellaneous:${txtrst}
31   - You can overwrite any config at runtime (deliver check):
32   -
33   - HOSTS=ruby-1-local PORT=6000 deliver -V
  10 + echo -e "${txtbld}USAGE${txtrst}
  11 + deliver [${txtcyn}CO${txtgrn}MMA${txtred}ND${txtrst}] [${txtylw}MODE${txtrst}]
  12 +
  13 +${txtbld}COMMANDS${txtrst}
  14 + ${txtbld}deliver${txtrst} Delivers your code to all \$HOSTS
  15 + deliver ${txtgrn}clone${txtrst}* Creates independent instances of your code across \$HOSTS
  16 + deliver ${txtred}prune${txtrst}* Keeps \$KEEP most recent code instances across \$HOSTS
  17 + deliver ${txtred}clear${txtrst}* Clears all traces of your code from \$HOSTS
  18 + deliver ${txtcyn}check${txtrst} Displays the local deliver configuration (highlights errors)
  19 + deliver ${txtcyn}status${txtrst}* Displays all code instances across \$HOSTS
  20 + deliver ${txtcyn}strategies${txtrst} Lists all available strategies
  21 + deliver ${txtcyn}help${txtrst} This help message
  22 + deliver ${txtcyn}version${txtrst} Current deliver version
  23 +
  24 +${txtbld}MODES${txtrst}
  25 + Each of the above commands supports the following runtime modes:
  26 +
  27 + ${txtylw}-C${txtrst}, ${txtylw}--compact${txtrst} Displays progress, silences output. (default mode)
  28 + ${txtylw}-P${txtrst}, ${txtylw}--plain${txtrst} Same as compact, but uses no colours (CI friendly)
  29 + ${txtylw}-V${txtrst}, ${txtylw}--verbose${txtrst} Same as compact, does not silence output
  30 + ${txtylw}-D${txtrst}, ${txtylw}--debug${txtrst} Shell debug mode
  31 +
  32 +${txtbld}CLONING*${txtrst}
  33 + This command allows you to run 2 (or more) instances of your code side-by-side.
  34 +
  35 +${txtbld}PRUNING*${txtrst}
  36 +
  37 +${txtbld}CLEARING*${txtrst}
  38 +
  39 +${txtbld}STATUS*${txtrst}
  40 +
  41 +${txtbld}MISCELLANEOUS${txtrst}
  42 + You can overwrite any config at runtime. Run ${txtcyn}deliver check${txtrst} to confirm this:
  43 +
  44 + HOSTS=ruby-1-local PORT=6000 ${txtcyn}deliver check${txtrst}
34 45 "
35 46 }
36 47
37 48 __available_strategies() {
38 49 __version
39 50
40   - echo -e "${txtbld}Available strategies:${txtrst}"
  51 + echo -e "${txtbld}STRATEGIES${txtrst}"
41 52
42 53 for strategy in $STRATEGIES_NAME
43 54 do
44   - echo " * $strategy"
  55 + echo " ${txtmgt}$strategy${txtrst}"
45 56 done
46 57
47 58 echo ""
@@ -51,6 +62,32 @@ while (( $# ))
51 62 do
52 63 arg="$1" && shift
53 64 case "${arg}" in
  65 +# This is inspired by Netflix's approach to HA and some recent blog posts:
  66 +# 1. http://blog.phusion.nl/2012/07/26/roadmap-preview-2-live-irb-console-deployment-error-resistance-new-website/
  67 +# 2. http://blog.appfog.com/how-to-update-your-appfog-app-with-zero-downtime/
  68 +# 3. http://blog.argteam.com/coding/hardening-node-js-for-production-part-3-zero-downtime-deployments-with-nginx/
  69 + (clone)
  70 + CLONE=true
  71 + ;;
  72 + (-h|--help|help)
  73 + __help
  74 + exit 0
  75 + ;;
  76 + (-v|--version|version)
  77 + __version
  78 + exit 0
  79 + ;;
  80 + (-s|--strategies|strategies)
  81 + __available_strategies
  82 + exit 0
  83 + ;;
  84 + (-c|--check|check)
  85 + CHECK=true
  86 + ;;
  87 + (status|prune|clear)
  88 + echo "${arg} has not been implemented yet"
  89 + exit 1
  90 + ;;
54 91 (-C|--compact)
55 92 MODE="compact"
56 93 ;;
@@ -64,24 +101,6 @@ do
64 101 # this was already captured in libexec/output
65 102 # noop
66 103 ;;
67   - (-h|--help)
68   - __help
69   - exit 0
70   - ;;
71   - (-s|--strategy)
72   - STRATEGY="$1" && shift
73   - ;;
74   - (-v|--version)
75   - __version
76   - exit 0
77   - ;;
78   - (strategies)
79   - __available_strategies
80   - exit 0
81   - ;;
82   - (check)
83   - CHECK=true
84   - ;;
85 104 (*)
86 105 hint_message "Unknown argument ${arg} ignored"
87 106 ;;
2  strategies/generated
@@ -9,7 +9,7 @@
9 9 # Every deliver is a commit on the generated branch. This then gets pushed out
10 10 # to all remote hosts (or just to github:pages).
11 11
12   -OPTIONAL_CONFIGS+=("GENERATED_DIR" "GENERATED_BRANCH" "GENERATE_CMD" "HOSTS")
  12 +OPTIONAL_CONFIGS+=(GENERATED_DIR GENERATED_BRANCH GENERATE_CMD HOSTS)
13 13
14 14 REFSPEC="$GENERATED_BRANCH"
15 15
4 strategies/gh-pages
@@ -9,8 +9,8 @@
9 9 # Every deploy is a commit on the generated branch. This then gets pushed out
10 10 # to github:pages.
11 11
12   -REQUIRED_CONFIGS+=("GENERATED_DIR" "GENERATED_BRANCH")
13   -OPTIONAL_CONFIGS=("GENERATE_CMD" "ROCCO_FILES")
  12 +REQUIRED_CONFIGS+=(GENERATED_DIR GENERATED_BRANCH)
  13 +OPTIONAL_CONFIGS=(GENERATE_CMD ROCCO_FILES)
14 14
15 15 GENERATED_DIR="gh-pages"
16 16 GENERATED_BRANCH="gh-pages"
4 strategies/nodejs
... ... @@ -1,7 +1,7 @@
1 1 #!/usr/bin/env bash
2 2
3   -REQUIRED_CONFIGS+=("HOSTS")
4   -OPTIONAL_CONFIGS+=("SUPERVISOR")
  3 +REQUIRED_CONFIGS+=(HOSTS)
  4 +OPTIONAL_CONFIGS+=(SUPERVISOR)
5 5
6 6 # Sincer deliver leverages foreman,
7 7 # it supports all the supervisors that foreman does
4 strategies/ruby
@@ -3,8 +3,8 @@
3 3 # This is the default deliver strategy.
4 4 # It uses git push, rvm & foreman to generate upstart jobs
5 5
6   -REQUIRED_CONFIGS+=("HOSTS")
7   -OPTIONAL_CONFIGS+=("SUPERVISOR")
  6 +REQUIRED_CONFIGS+=(HOSTS)
  7 +OPTIONAL_CONFIGS+=(SUPERVISOR)
8 8
9 9 # Sincer deliver leverages foreman,
10 10 # it supports all the supervisors that foreman does
4 strategies/shared
... ... @@ -1,7 +1,7 @@
1 1 #!/usr/bin/env bash
2 2
3   -REQUIRED_CONFIGS+=("HOSTS")
4   -OPTIONAL_CONFIGS+=("OWNER" "GROUP" "PERMISSIONS")
  3 +REQUIRED_CONFIGS+=(HOSTS)
  4 +OPTIONAL_CONFIGS+=(OWNER GROUP PERMISSIONS)
5 5
6 6 run() {
7 7 authorize_hosts

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.