bonethug 0.0.79 → 0.0.80

Sign up to get free protection for your applications and to get access to all the features.
data/TODO.txt CHANGED
@@ -3,4 +3,7 @@
3
3
  - thug auth {staging|production} - this would inject your ssh pub key into the authorized_keys file
4
4
  - need to allow support for other environment types
5
5
  - have some sort of composer.json merge
6
- - thug update needs stil needs to be run twice because the current version gets loaded into memory - need to run some sort of two phase update
6
+ - thug update needs stil needs to be run twice because the current version gets loaded into memory - need to run some sort of two phase update
7
+ - some things need to run prior to there being a deploy copy - eg. init-db
8
+ - conf should return nil if it can't find a node
9
+ - rbenv library support - rbenv gays out with 2.x needs readline headers manually specified
data/config/deploy.rb CHANGED
@@ -220,7 +220,7 @@ task :sync_backup_from => :environment do
220
220
  queue! %[#{ssh_pass} ssh #{rsync.get('user')}@#{rsync.get('host')} mkdir -p #{path}]
221
221
  (resources + log_dirs).each do |item|
222
222
 
223
- queue! %[cd #{deploy_to}/current && rsync -r -a -v -e "#{ssh_pass} ssh -l #{rsync.get('user')}" --delete --copy-dirlinks ./#{item} #{rsync.get('host')}:#{path}/]
223
+ queue! %[cd #{deploy_to}/current && rsync -avz -e "#{ssh_pass} ssh -l #{rsync.get('user')}" --delete --progress ./#{item} #{rsync.get('host')}:#{path}/]
224
224
 
225
225
  end
226
226
  else
@@ -236,7 +236,7 @@ task :sync_backup_to => :environment do
236
236
  queue! %[#{ssh_pass} ssh #{rsync.get('user')}@#{rsync.get('host')} mkdir -p #{path}]
237
237
  (resources + log_dirs).each do |item|
238
238
 
239
- queue! %[cd #{deploy_to}/current && rsync -r -a -v -e "#{ssh_pass} ssh -l #{rsync.get('user')}" --delete --copy-dirlinks #{rsync.get('host')}:#{path}/#{item} ./]
239
+ queue! %[cd #{deploy_to}/current && rsync -avz -e "#{ssh_pass} ssh -l #{rsync.get('user')}" --delete --progress #{rsync.get('host')}:#{path}/#{item} ./]
240
240
 
241
241
  end
242
242
  else
@@ -436,8 +436,9 @@ task :deploy => :environment do
436
436
  invoke :'deploy:cleanup'
437
437
 
438
438
  # run post deploy commands
439
- cmds = conf.get('post_cmds.'+env)
439
+ cmds = conf.get 'post_cmds'
440
440
  if cmds
441
+ cmds = cmds.get env
441
442
  cmds.each do |index, cmd|
442
443
  queue cmd
443
444
  end
@@ -94,9 +94,9 @@ module Bonethug
94
94
  (resources + log_dirs).each do |item|
95
95
 
96
96
  if push == 'local' and pull == 'remote'
97
- cmd = "rsync -zrav -e \"ssh -p #{remote_deploy.get('port')} -l #{remote_deploy.get('user')}\" --delete --copy-dirlinks #{remote_deploy.get('domain')}:#{remote_path}/current/#{item}/ #{exec_path}/#{item}/"
97
+ cmd = "rsync -avz -e \"ssh -p #{remote_deploy.get('port')} -l #{remote_deploy.get('user')}\" --delete --progress #{remote_deploy.get('domain')}:#{remote_path}/current/#{item}/ #{exec_path}/#{item}/"
98
98
  elsif pull == 'local' and push == 'remote'
99
- cmd = "rsync -zrav -e \"ssh -p #{remote_deploy.get('port')} -l #{remote_deploy.get('user')}\" --delete --copy-dirlinks #{exec_path}/#{item}/ #{remote_deploy.get('domain')}:#{remote_path}/current/#{item}/"
99
+ cmd = "rsync -avz -e \"ssh -p #{remote_deploy.get('port')} -l #{remote_deploy.get('user')}\" --delete --progress #{exec_path}/#{item}/ #{remote_deploy.get('domain')}:#{remote_path}/current/#{item}/"
100
100
  end
101
101
 
102
102
  puts cmd
@@ -1,6 +1,6 @@
1
1
 
2
2
  module Bonethug
3
- VERSION = "0.0.79"
4
- BUILD_DATE = "2014-04-15 10:52:28 +1200"
3
+ VERSION = "0.0.80"
4
+ BUILD_DATE = "2014-05-06 10:37:06 +1200"
5
5
  end
6
6
 
@@ -1,105 +1,103 @@
1
- # /bin/bash
2
-
3
- # -----------------------------------------------------
4
- # install native stuff
5
- # -----------------------------------------------------
6
-
7
- # install the repo adding scripts
8
- sudo apt-get install software-properties-common python-software-properties
9
-
10
- # add repos
11
- sudo add-apt-repository ppa:richarvey/nodejs
12
- sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main universe restricted multiverse"
13
- sudo add-apt-repository "deb-src http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main universe restricted multiverse"
14
-
15
- # update
16
- sudo apt-get update && sudo apt-get upgrade
17
-
18
- # install
19
-
20
- # dev headers
21
- sudo apt-get install libcurl4-openssl-dev libssl-dev apache2-threaded-dev libapr1-dev libaprutil1-dev libapr1-dev libaprutil1-dev
22
- sudo apt-get install libmysqlclient-dev libmagickwand-dev libsqlite3-dev libxml2-dev libxslt1-dev
23
-
24
- # regular packages
25
- sudo apt-get install apache2-mpm-worker
26
- sudo apt-get install curl libapache2-mod-fastcgi php5-fpm php5 php5-cli php5-curl php5-gd php5-imagick php-apc php5-mysql
27
- sudo apt-get install mysql-server mysql-client sqlite3
28
- sudo apt-get install imagemagick
29
- sudo apt-get install phpmyadmin
30
- sudo apt-get install sshpass
31
- sudo apt-get install libxml2 g++
32
- sudo apt-get install git ruby1.9.3 wkhtmltopdf nodejs npm
33
-
34
-
35
- # -----------------------------------------------------
36
- # Configure stuff
37
- # -----------------------------------------------------
38
-
39
- # unix socket
40
- # echo "
41
- # <IfModule mod_fastcgi.c>
42
- # AddHandler php5-fcgi .php
43
- # Action php5-fcgi /php5-fcgi
44
- # Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
45
- # FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /var/run/php5-fpm.sock -pass-header Authorization
46
- # </IfModule>
47
- # " > /etc/apache2/conf.d/php-fpm.conf
48
- # sed -i -e "s/listen = 127.0.0.1:9000/listen = \/var\/run\/php5-fpm.sock/g" /etc/php5/fpm/pool.d/www.conf
49
-
50
- ## TCP
51
- # echo "
52
- # <IfModule mod_fastcgi.c>
53
- # AddHandler php5-fcgi .php
54
- # Action php5-fcgi /php5-fcgi
55
- # Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
56
- # FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -idle-timeout 250 -pass-header Authorization
57
- # </IfModule>
58
- # " > /etc/apache2/conf.d/php-fpm.conf
59
- # sed -i -e "s/listen = \/var\/run\/php5-fpm.sock/listen = 127.0.0.1:9000/g" /etc/php5/fpm/pool.d/www.conf
60
-
61
- sed -i -e "s/listen = \/var\/run\/php5-fpm.sock/listen = 127.0.0.1:9000/g" /etc/php5/fpm/pool.d/www.conf
62
- sudo echo -e "<IfModule mod_fastcgi.c>\n AddHandler php5-fcgi .php\n Action php5-fcgi /php5-fcgi\n Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi\n FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -idle-timeout 250 -pass-header Authorization\n </IfModule>" > /etc/apache2/conf.d/php-fpm.conf
63
-
64
- #apache2.4
65
- sudo echo -e "<IfModule mod_fastcgi.c>\n AddHandler php5-fcgi .php\n Action php5-fcgi /php5-fcgi\n Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi\n FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -idle-timeout 250 -pass-header Authorization\n <Directory />\nRequire all granted\n </Directory>\n </IfModule>" > /etc/apache2/conf-available/php-fpm.conf
66
- a2enconf php-fpm.conf
67
-
68
- # Apache
69
- # ------
70
-
71
- # modules
72
- sudo a2enmod actions fastcgi alias rewrite headers
73
-
74
- # phpmyadmin
75
- sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf.d/phpmyadmin.conf
76
-
77
- # phpmyadmin apache 2.4
78
- cp /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
79
- a2enconf phpmyadmin.conf
80
-
81
- # -----------------------------------------------------
82
- # Install Gems
83
- # -----------------------------------------------------
84
-
85
- # install some gems - yes gem1.9.3 - wtf
86
- sudo gem1.9.3 install mina bundler whenever astrails-safe
87
-
88
- # install passenger
89
- sudo gem1.9.3 install passenger
90
- sudo passenger-install-apache2-module
91
- sudo touch /etc/apache2/mods-available/passenger.load
92
- sudo touch /etc/apache2/mods-available/passenger.conf
93
-
94
- # -----------------------------------------------------
95
- # Node.js related
96
- # -----------------------------------------------------
97
-
98
- npm install bower -g
99
-
100
- # -----------------------------------------------------
101
- # Restart stuff
102
- # -----------------------------------------------------
103
-
104
- sudo service apache2 restart
1
+ # /bin/bash
2
+
3
+ # -----------------------------------------------------
4
+ # install native stuff
5
+ # -----------------------------------------------------
6
+
7
+ # install the repo adding scripts
8
+ sudo apt-get install software-properties-common python-software-properties
9
+
10
+ # add repos
11
+ sudo add-apt-repository ppa:richarvey/nodejs
12
+ sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main universe restricted multiverse"
13
+ sudo add-apt-repository "deb-src http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main universe restricted multiverse"
14
+ sudo add-apt-repository ppa:ondrej/apache2
15
+ sudo add-apt-repository ppa:ondrej/php5
16
+
17
+ # update
18
+ sudo apt-get update && sudo apt-get upgrade
19
+
20
+ # install
21
+
22
+ # dev headers
23
+ sudo apt-get install libcurl4-openssl-dev libssl-dev apache2-threaded-dev libapr1-dev libaprutil1-dev libapr1-dev libaprutil1-dev
24
+ sudo apt-get install libmysqlclient-dev libmagickwand-dev libsqlite3-dev libxml2-dev libxslt1-dev
25
+
26
+ # regular packages
27
+ sudo apt-get install apache2-mpm-worker
28
+ sudo apt-get install curl libapache2-mod-fastcgi php5-fpm php5 php5-cli php5-curl php5-gd php5-imagick php-apc php5-mysql
29
+ sudo apt-get install mysql-server mysql-client sqlite3
30
+ sudo apt-get install imagemagick
31
+ sudo apt-get install phpmyadmin
32
+ sudo apt-get install sshpass
33
+ sudo apt-get install libxml2 g++
34
+ sudo apt-get install git ruby1.9.3 nodejs npm
35
+
36
+
37
+ # -----------------------------------------------------
38
+ # Configure stuff
39
+ # -----------------------------------------------------
40
+
41
+ # unix socket
42
+ # echo "
43
+ # <IfModule mod_fastcgi.c>
44
+ # AddHandler php5-fcgi .php
45
+ # Action php5-fcgi /php5-fcgi
46
+ # Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
47
+ # FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /var/run/php5-fpm.sock -pass-header Authorization
48
+ # </IfModule>
49
+ # " > /etc/apache2/conf.d/php-fpm.conf
50
+ # sed -i -e "s/listen = 127.0.0.1:9000/listen = \/var\/run\/php5-fpm.sock/g" /etc/php5/fpm/pool.d/www.conf
51
+
52
+ ## TCP
53
+ # echo "
54
+ # <IfModule mod_fastcgi.c>
55
+ # AddHandler php5-fcgi .php
56
+ # Action php5-fcgi /php5-fcgi
57
+ # Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
58
+ # FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -idle-timeout 250 -pass-header Authorization
59
+ # </IfModule>
60
+ # " > /etc/apache2/conf.d/php-fpm.conf
61
+ # sed -i -e "s/listen = \/var\/run\/php5-fpm.sock/listen = 127.0.0.1:9000/g" /etc/php5/fpm/pool.d/www.conf
62
+
63
+ sed -i -e "s/listen = \/var\/run\/php5-fpm.sock/listen = 127.0.0.1:9000/g" /etc/php5/fpm/pool.d/www.conf
64
+ sudo echo -e "<IfModule mod_fastcgi.c>\n AddHandler php5-fcgi .php\n Action php5-fcgi /php5-fcgi\n Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi\n FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -appConnTimeout 900 -idle-timeout 900 -pass-header Authorization\n </IfModule>" > /etc/apache2/conf.d/php-fpm.conf
65
+
66
+ #apache2.4
67
+ sudo echo -e "<IfModule mod_fastcgi.c>\n AddHandler php5-fcgi .php\n Action php5-fcgi /php5-fcgi\n Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi\n FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -host 127.0.0.1:9000 -appConnTimeout 900 -idle-timeout 900 -pass-header Authorization\n <Directory />\nRequire all granted\n </Directory>\n </IfModule>" > /etc/apache2/conf-available/php-fpm.conf
68
+ a2enconf php-fpm.conf
69
+
70
+ # Apache
71
+ # ------
72
+
73
+ # modules
74
+ sudo a2enmod actions fastcgi alias rewrite headers
75
+
76
+ # phpmyadmin
77
+ sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf.d/phpmyadmin.conf
78
+
79
+ # -----------------------------------------------------
80
+ # Install Gems
81
+ # -----------------------------------------------------
82
+
83
+ # install some gems - yes gem1.9.3 - wtf
84
+ sudo gem1.9.3 install mina bundler whenever astrails-safe
85
+
86
+ # install passenger
87
+ sudo gem1.9.3 install passenger
88
+ sudo passenger-install-apache2-module
89
+ sudo touch /etc/apache2/mods-available/passenger.load
90
+ sudo touch /etc/apache2/mods-available/passenger.conf
91
+
92
+ # -----------------------------------------------------
93
+ # Node.js related
94
+ # -----------------------------------------------------
95
+
96
+ npm install bower -g
97
+
98
+ # -----------------------------------------------------
99
+ # Restart stuff
100
+ # -----------------------------------------------------
101
+
102
+ sudo service apache2 restart
105
103
  sudo service php5-fpm restart
@@ -11,6 +11,8 @@ sudo apt-get install software-properties-common python-software-properties
11
11
  # sudo add-apt-repository ppa:richarvey/nodejs
12
12
  sudo add-apt-repository "deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main universe restricted multiverse"
13
13
  sudo add-apt-repository "deb-src http://archive.ubuntu.com/ubuntu $(lsb_release -sc) main universe restricted multiverse"
14
+ sudo add-apt-repository ppa:ondrej/apache2
15
+ sudo add-apt-repository ppa:ondrej/php5
14
16
 
15
17
  # update
16
18
  sudo apt-get update && sudo apt-get upgrade
@@ -71,9 +73,6 @@ a2enconf php-fpm.conf
71
73
  # modules
72
74
  sudo a2enmod actions fastcgi alias rewrite headers
73
75
 
74
- # phpmyadmin
75
- sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf.d/phpmyadmin.conf
76
-
77
76
  # phpmyadmin apache 2.4
78
77
  cp /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
79
78
  a2enconf phpmyadmin.conf
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "bonethug/php",
3
+ "version": "0.0.1",
4
+ "authors": [
5
+ "azt3k <breaks.nz@gmail.com>"
6
+ ],
7
+ "license": "MIT",
8
+ "private": true,
9
+ "dependencies": {
10
+ "jquery" : "~1.11.0",
11
+ "modernizr" : "git://github.com/Modernizr/Modernizr.git",
12
+ "respond" : "git://github.com/scottjehl/Respond.git",
13
+ "picturefill" : "git://github.com/scottjehl/picturefill.git",
14
+ "selectivizr" : "https://raw.githubusercontent.com/keithclark/selectivizr/master/selectivizr.js",
15
+ "html5-boilerplate" : "~4.3.0",
16
+ "yepnope" : "git://github.com/SlexAxton/yepnope.js.git"
17
+ }
18
+ }
@@ -1,5 +1,16 @@
1
1
  {
2
- "require": {
3
- "symfony/yaml" : "2.5.*@dev"
2
+ "name" : "bonethug/php",
3
+ "repositories": [
4
+ ],
5
+ "require": {
6
+ "symfony/yaml" : "2.5.*@dev"
7
+ },
8
+ "extra": {
9
+ "installer-paths": {
10
+ "public/vendor/{$name}": [
11
+ ],
12
+ "public/{$name}": [
13
+ ]
4
14
  }
15
+ }
5
16
  }
@@ -0,0 +1,91 @@
1
+ <?php
2
+
3
+ namespace Thug\Conf;
4
+
5
+ use Symfony\Component\Yaml\Yaml;
6
+
7
+ require realpath(__DIR__ . '/../../../vendor/autoload.php');
8
+
9
+ class Load {
10
+
11
+ protected static $constants_set = false;
12
+ protected static $application_env = null;
13
+ protected static $ss_environment_type = null;
14
+
15
+ public static function get_application_env() {
16
+ self::set_constants();
17
+ return self::$application_env;
18
+ }
19
+
20
+ public static function env() {
21
+ return self::get_application_env();
22
+ }
23
+
24
+ public static function get_ss_environment_type() {
25
+ // ensure constants are set;
26
+ self::set_constants();
27
+ return self::$ss_environment_type;
28
+ }
29
+
30
+ public static function translate_env($env) {
31
+ if (!empty(self::$ss_env[$env])) {
32
+ return self::$ss_env[$env];
33
+ } else {
34
+ return $env;
35
+ }
36
+ }
37
+
38
+ public static function set_constants() {
39
+
40
+ if (!self::$constants_set) {
41
+
42
+ // Transfer environmental vars to constants
43
+ $env = getenv('APPLICATION_ENV');
44
+ if (!$env) $env = 'production';
45
+
46
+ if (!defined('APPLICATION_ENV')) define('APPLICATION_ENV', $env);
47
+ if (!defined('PATH')) define('PATH', getenv('PATH'));
48
+
49
+ self::$constants_set = true;
50
+ self::$application_env = APPLICATION_ENV;
51
+
52
+ }
53
+
54
+ }
55
+
56
+ public static function cnf() {
57
+
58
+ // ensure constants are set;
59
+ self::set_constants();
60
+
61
+ // paths
62
+ $base_dir = realpath(__DIR__ . '/..');
63
+ $public_dir = realpath($base_dir . '/public');
64
+
65
+ // load conf
66
+ $cnf = Yaml::parse($base_dir . '/config/cnf.yml');
67
+
68
+ // expected urls
69
+ $url = 'http://' . $cnf['apache'][APPLICATION_ENV]['server_name'];
70
+
71
+ // load db settings
72
+ $db = (object) $cnf['dbs']['default'][APPLICATION_ENV];
73
+
74
+ // load mail settings
75
+ $mail = (object) $cnf['mail']['smtp'][APPLICATION_ENV];
76
+
77
+ return (object) array(
78
+ 'cnf' => $cnf,
79
+ 'db' => $db,
80
+ 'mail' => $mail,
81
+ 'base_path' => $base_dir,
82
+ 'public_path' => $public_dir,
83
+ 'url' => $url
84
+ );
85
+
86
+ }
87
+
88
+ public static function conf() { return self::cnf(); }
89
+ public static function config() { return self::cnf(); }
90
+
91
+ }
data/skel/skel.yml CHANGED
@@ -25,8 +25,12 @@ project_types:
25
25
  - lib/boris.php
26
26
  - drupal-console
27
27
  php:
28
+ bonethug_files:
29
+ - lib/Thug/Conf/Load.php
28
30
  rails3:
31
+ bonethug_files:
29
32
  rails4:
33
+ bonethug_files:
30
34
  silverstripe3:
31
35
  bonethug_files:
32
36
  - lib/ss_loadconf.php
@@ -35,6 +39,8 @@ project_types:
35
39
  - ss-console
36
40
  - public/_ss_environment.php
37
41
  sinatra:
42
+ bonethug_files:
38
43
  exlcuded_paths:
39
44
  - Gemfile
45
+ - bower.json
40
46
  - composer.json
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bonethug
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.79
4
+ version: 0.0.80
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-04-14 00:00:00.000000000 Z
12
+ date: 2014-05-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -452,7 +452,9 @@ files:
452
452
  - skel/project_types/drupal8/public/sites/default/settings.php
453
453
  - skel/project_types/drupal8/public/sites/default/staging.settings.php
454
454
  - skel/project_types/php/.gitignore
455
+ - skel/project_types/php/bower.json
455
456
  - skel/project_types/php/composer.json
457
+ - skel/project_types/php/lib/Thug/Conf/Load.php
456
458
  - skel/project_types/rails3/Gemfile
457
459
  - skel/project_types/rails3/README.md
458
460
  - skel/project_types/rails4/Gemfile
@@ -557,7 +559,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
557
559
  version: '0'
558
560
  segments:
559
561
  - 0
560
- hash: -257142101790703829
562
+ hash: -1758899776465409101
561
563
  required_rubygems_version: !ruby/object:Gem::Requirement
562
564
  none: false
563
565
  requirements:
@@ -566,7 +568,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
566
568
  version: '0'
567
569
  segments:
568
570
  - 0
569
- hash: -257142101790703829
571
+ hash: -1758899776465409101
570
572
  requirements: []
571
573
  rubyforge_project:
572
574
  rubygems_version: 1.8.23