breeze 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. data/.gitignore +6 -0
  2. data/Gemfile +4 -0
  3. data/LICENSE +22 -0
  4. data/README.md +4 -0
  5. data/Rakefile +2 -0
  6. data/bin/breeze +17 -0
  7. data/breeze.gemspec +28 -0
  8. data/lib/breeze.rb +6 -0
  9. data/lib/breeze/fog_extensions.rb +2 -0
  10. data/lib/breeze/fog_extensions/aws.rb +65 -0
  11. data/lib/breeze/initializer.rb +40 -0
  12. data/lib/breeze/tasks.rb +10 -0
  13. data/lib/breeze/tasks/app.rb +145 -0
  14. data/lib/breeze/tasks/configuration.rb +63 -0
  15. data/lib/breeze/tasks/db.rb +31 -0
  16. data/lib/breeze/tasks/dns.rb +67 -0
  17. data/lib/breeze/tasks/list.rb +74 -0
  18. data/lib/breeze/tasks/server.rb +72 -0
  19. data/lib/breeze/tasks/server/address.rb +27 -0
  20. data/lib/breeze/tasks/server/image.rb +27 -0
  21. data/lib/breeze/tasks/server/tag.rb +16 -0
  22. data/lib/breeze/veur.rb +86 -0
  23. data/lib/templates/Thorfile +122 -0
  24. data/lib/templates/maintenance.html +23 -0
  25. data/lib/templates/profiles/minimal/scripts/install_conf.sh +4 -0
  26. data/lib/templates/profiles/minimal/scripts/install_cust.sh +7 -0
  27. data/lib/templates/profiles/rails_and_image_magick/configs/database.yml +18 -0
  28. data/lib/templates/profiles/rails_and_image_magick/configs/memcached.conf +51 -0
  29. data/lib/templates/profiles/rails_and_image_magick/configs/nginx/logrotate +26 -0
  30. data/lib/templates/profiles/rails_and_image_magick/configs/nginx/monit +9 -0
  31. data/lib/templates/profiles/rails_and_image_magick/configs/nginx/nginx.conf +99 -0
  32. data/lib/templates/profiles/rails_and_image_magick/scripts/install_conf.sh +33 -0
  33. data/lib/templates/profiles/rails_and_image_magick/scripts/install_cust.sh +24 -0
  34. data/lib/templates/shared/configs/crontab +10 -0
  35. data/lib/templates/shared/configs/monitrc +248 -0
  36. data/lib/templates/shared/scripts/credentials.sh +5 -0
  37. data/lib/templates/shared/scripts/deploy.sh +43 -0
  38. data/lib/templates/shared/scripts/install.sh +38 -0
  39. data/lib/templates/user_data.sh +4 -0
  40. metadata +133 -0
@@ -0,0 +1,5 @@
1
+ # This file is sourced by deploy.sh. You may want to put your github access token here
2
+ # or whatever credentials are required in order to deploy your application automatically
3
+ # on boot. This file is by default saved with the mode 0600. It may be a good idea to
4
+ # leave it out of your revision control system.
5
+ GITHUB_TOKEN=your-github-access-token
@@ -0,0 +1,43 @@
1
+ #!/bin/bash
2
+ # This example script downloads a tarball from github and deploys it to /srv.
3
+ # You can pass in user_data to invoke this script with different command line
4
+ # arguments when new server instances are launched.
5
+ set -e -x
6
+ shopt -s expand_aliases
7
+
8
+ HOME=/home/ubuntu
9
+ # exec 1>$HOME/deploy.log 2>&1
10
+ exec > >(tee $HOME/deploy.log) 2>&1
11
+
12
+ source $HOME/credentials.sh
13
+
14
+ # command line arguments with default values
15
+ PUBLIC_SERVER_NAME=$1
16
+ DB_SERVER=$2
17
+ BRANCH=${3:-master} # can also be the name of a tag
18
+ APP_NAME=${4:-YOUR-APP}
19
+ BASE_URL=${5:-"https://github.com/YOUR-LOGIN/YOUR-APP/tarball/$BRANCH"}
20
+ # NOTICE: user_data is readable by anyone who can log in but
21
+ # credentials.sh is readable only by user ubuntu (and sudoers)
22
+ QUERY_STRING=${6:-"?login=YOUR-GITHUB-LOGIN&token=$GITHUB_TOKEN"}
23
+
24
+ DOWNLOAD_URL="$BASE_URL$QUERY_STRING"
25
+ DEPLOY_PATH=/srv/$APP_NAME
26
+
27
+ # don't do anything if the app has already been deployed
28
+ if [ -d $DEPLOY_PATH ]; then exit; fi
29
+
30
+ # add a user (rails) to run your application
31
+ sudo adduser --system --group rails
32
+ # add user ubuntu to the rails group so that ubuntu can read database.yml
33
+ sudo usermod --groups rails ubuntu
34
+
35
+ wget -q --no-check-certificate --directory-prefix=$HOME --output-document=tarball.tar.gz $DOWNLOAD_URL
36
+ tar --directory $HOME -xzf tarball.tar.gz
37
+
38
+ sudo mv $HOME/*$APP_NAME* $DEPLOY_PATH
39
+ sudo chown -R rails $DEPLOY_PATH
40
+ cd $DEPLOY_PATH
41
+ sudo bundle install --without=test development
42
+ sudo PUBLIC_SERVER_NAME=$PUBLIC_SERVER_NAME DB_SERVER=$DB_SERVER thor configuration:deploy_to_localhost
43
+ sudo /etc/init.d/monit start
@@ -0,0 +1,38 @@
1
+ #!/bin/bash
2
+ # Modify install_conf.sh and install_cust.sh first.
3
+ set -e -x
4
+ shopt -s expand_aliases
5
+
6
+ # set up $HOME and output redirection
7
+ HOME=/home/ubuntu
8
+ exec > >(tee $HOME/install.log) 2>&1
9
+
10
+ # use all available disk space
11
+ sudo resize2fs /dev/sda1
12
+
13
+ SCRIPT_DIR=`dirname $0`
14
+ source $SCRIPT_DIR/install_conf.sh
15
+
16
+ alias package_manager='sudo DEBIAN_FRONTEND=noninteractive apt-get -q'
17
+
18
+ # upgrade and install system packages
19
+ package_manager update
20
+ package_manager -y upgrade
21
+ package_manager -y install $PACKAGES
22
+
23
+ # define an alias and a function to install source packages
24
+ alias download='wget -q --directory-prefix=$HOME'
25
+ function extract_and_install {
26
+ local package=$1
27
+ local options=$2
28
+ cd $HOME
29
+ tar -xzf $package.tar.gz
30
+ cd $package
31
+ ./configure --prefix=/usr $options && make && sudo make install
32
+ cd ..
33
+ rm -rf $package*
34
+ }
35
+
36
+ source $SCRIPT_DIR/install_cust.sh
37
+
38
+ : "=========== SUCCESSFULLY REACHED THE END OF install.sh ==========="
@@ -0,0 +1,4 @@
1
+ #!/bin/bash
2
+ # You can create servers with --user_data_file=path/to/here.
3
+ # su ubuntu -c "/home/ubuntu/deploy.sh my-branch-or-tag my-other-app https://github.com/..."
4
+ su ubuntu -c "/home/ubuntu/deploy.sh"
metadata ADDED
@@ -0,0 +1,133 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: breeze
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 1
9
+ version: 0.0.1
10
+ platform: ruby
11
+ authors:
12
+ - Markus Bengts
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2011-03-20 00:00:00 +01:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: thor
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ version: "0"
31
+ type: :runtime
32
+ version_requirements: *id001
33
+ - !ruby/object:Gem::Dependency
34
+ name: fog
35
+ prerelease: false
36
+ requirement: &id002 !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 0
43
+ - 7
44
+ version: "0.7"
45
+ type: :runtime
46
+ version_requirements: *id002
47
+ description: |
48
+ Breeze makes it easy to automate server installation and configuration. It provides
49
+ example scripts and configuration files that you can modify and keep in your revision
50
+ control system. Thor tasks are provided to create server images, launch server instances etc.
51
+
52
+ email:
53
+ - markus.bengts@gmail.com
54
+ executables:
55
+ - breeze
56
+ extensions: []
57
+
58
+ extra_rdoc_files: []
59
+
60
+ files:
61
+ - .gitignore
62
+ - Gemfile
63
+ - LICENSE
64
+ - README.md
65
+ - Rakefile
66
+ - bin/breeze
67
+ - breeze.gemspec
68
+ - lib/breeze.rb
69
+ - lib/breeze/fog_extensions.rb
70
+ - lib/breeze/fog_extensions/aws.rb
71
+ - lib/breeze/initializer.rb
72
+ - lib/breeze/tasks.rb
73
+ - lib/breeze/tasks/app.rb
74
+ - lib/breeze/tasks/configuration.rb
75
+ - lib/breeze/tasks/db.rb
76
+ - lib/breeze/tasks/dns.rb
77
+ - lib/breeze/tasks/list.rb
78
+ - lib/breeze/tasks/server.rb
79
+ - lib/breeze/tasks/server/address.rb
80
+ - lib/breeze/tasks/server/image.rb
81
+ - lib/breeze/tasks/server/tag.rb
82
+ - lib/breeze/veur.rb
83
+ - lib/templates/Thorfile
84
+ - lib/templates/maintenance.html
85
+ - lib/templates/profiles/minimal/scripts/install_conf.sh
86
+ - lib/templates/profiles/minimal/scripts/install_cust.sh
87
+ - lib/templates/profiles/rails_and_image_magick/configs/database.yml
88
+ - lib/templates/profiles/rails_and_image_magick/configs/memcached.conf
89
+ - lib/templates/profiles/rails_and_image_magick/configs/nginx/logrotate
90
+ - lib/templates/profiles/rails_and_image_magick/configs/nginx/monit
91
+ - lib/templates/profiles/rails_and_image_magick/configs/nginx/nginx.conf
92
+ - lib/templates/profiles/rails_and_image_magick/scripts/install_conf.sh
93
+ - lib/templates/profiles/rails_and_image_magick/scripts/install_cust.sh
94
+ - lib/templates/shared/configs/crontab
95
+ - lib/templates/shared/configs/monitrc
96
+ - lib/templates/shared/scripts/credentials.sh
97
+ - lib/templates/shared/scripts/deploy.sh
98
+ - lib/templates/shared/scripts/install.sh
99
+ - lib/templates/user_data.sh
100
+ has_rdoc: true
101
+ homepage: https://github.com/markus/breeze
102
+ licenses: []
103
+
104
+ post_install_message:
105
+ rdoc_options: []
106
+
107
+ require_paths:
108
+ - lib
109
+ required_ruby_version: !ruby/object:Gem::Requirement
110
+ none: false
111
+ requirements:
112
+ - - ">="
113
+ - !ruby/object:Gem::Version
114
+ segments:
115
+ - 0
116
+ version: "0"
117
+ required_rubygems_version: !ruby/object:Gem::Requirement
118
+ none: false
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ segments:
123
+ - 0
124
+ version: "0"
125
+ requirements: []
126
+
127
+ rubyforge_project: breeze
128
+ rubygems_version: 1.3.7
129
+ signing_key:
130
+ specification_version: 3
131
+ summary: Thor tasks to manage AWS cloud computing resorces and deployments
132
+ test_files: []
133
+