deploify 0.2.6 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -40,7 +40,7 @@ Capistrano::Configuration.instance(:must_exist).load do
40
40
  # Service options
41
41
  CHOICES_WEBSERVER = [:nginx]
42
42
  CHOICES_APPSERVER = [:passenger, :thin] # :puma, :unicorn
43
- CHOICES_DATABASE = [:mysql] # :mongodb
43
+ CHOICES_DATABASE = [:mysql, :mongodb]
44
44
  #
45
45
  # Service defaults
46
46
  set :web_server_type, :nginx
@@ -0,0 +1,33 @@
1
+ # Copyright 2012 by Richard Riman. All rights reserved.
2
+
3
+ # TODO
4
+ #insted images folder I should use dragonfly config
5
+
6
+ Capistrano::Configuration.instance(:must_exist).load do
7
+
8
+ namespace :deploify do
9
+
10
+ namespace :dragonfly do
11
+
12
+ desc "synchronizes local files with server files"
13
+ task :upload do
14
+ target_folder = "#{deploy_to}/shared/public/images"
15
+ source_folder = "public/images"
16
+ run "mkdir -p #{target_folder}"
17
+ run "sudo chmod 777 -R #{target_folder}"
18
+ system "rsync -e ssh -av #{source_folder}/* #{user}@#{server_ip}:#{target_folder}"
19
+ end
20
+
21
+ desc "synchronizes server files with local files"
22
+ task :download do
23
+ source_folder = "#{deploy_to}/shared/public/images"
24
+ target_folder = "public/images"
25
+ system "mkdir -p public/system/dragonfly/development"
26
+ system "rsync -e ssh -av #{user}@#{server_ip}:#{source_folder}/* #{target_folder}"
27
+ end
28
+
29
+ end # namespace :dragonfly
30
+
31
+ end # namespace :deploify
32
+
33
+ end
@@ -6,7 +6,48 @@ Capistrano::Configuration.instance(:must_exist).load do
6
6
 
7
7
  namespace :mongodb do
8
8
 
9
-
9
+ desc "create a database"
10
+ task :create_database, :roles => :db do
11
+ # not need anything, DBs are created with the first use
12
+ end
13
+
14
+ desc "grant user access to database"
15
+ task :grant_user_access_to_database, :roles => :db do
16
+ # not need anything
17
+ end
18
+
19
+ desc "removes dump folders on server & local machine"
20
+ task :clean_dump_folders do
21
+ run "rm -rf #{deploy_to}/db/dump"
22
+ system "rm -rf db/dump"
23
+ end
24
+
25
+ desc "creates and gives rights to dump folders on server"
26
+ task :prepare_dump_folders do
27
+ run "sudo mkdir -p #{deploy_to}/db/dump"
28
+ run "sudo chmod 777 -R #{deploy_to}/db"
29
+ run "rm -rf #{deploy_to}/db/dump/#{application_base_name}_#{stage}"
30
+ end
31
+
32
+ desc "dumps local db and uploads & restores db on server"
33
+ task :upload do
34
+ prepare_dump_folders
35
+ system "mongodump -d #{application_base_name}_development -o db/dump"
36
+ system "scp -Cr db/dump/ #{user}@#{server_ip}:#{deploy_to}/db"
37
+ run "mv #{deploy_to}/db/dump/#{application_base_name}_development #{deploy_to}/db/dump/#{application_base_name}_#{stage}"
38
+ run "mongorestore --drop -d #{application_base_name}_#{stage} #{deploy_to}/db/dump/#{application_base_name}_#{stage}"
39
+ clean_dump_folders
40
+ end
41
+
42
+ desc "dumps server db and downloads & restores db on local machine"
43
+ task :download do
44
+ prepare_dump_folders
45
+ run "mongodump -d #{application_base_name}_#{stage} -o #{deploy_to}/db/dump"
46
+ system "scp -Cr #{user}@#{server_ip}:#{deploy_to}/db/dump db"
47
+ system "mv db/dump/#{application_base_name}_#{stage} db/dump/#{application_base_name}_development"
48
+ system "mongorestore --drop -d #{application_base_name}_development db/dump/#{application_base_name}_development"
49
+ clean_dump_folders
50
+ end
10
51
 
11
52
  end # namespace :mongodb
12
53
 
@@ -104,7 +104,11 @@ Capistrano::Configuration.instance(:must_exist).load do
104
104
 
105
105
  task :symlink_and_activate_passengerctl, :roles => :app do
106
106
  run "#{try_sudo} ln -sf #{deploy_to}/passenger/passengerctl /etc/init.d/passenger-#{application}"
107
- run "#{try_sudo} update-rc.d passenger-#{application} defaults"
107
+ if stage.eql?(:staging)
108
+ run "#{try_sudo} update-rc.d -f passenger-#{application} remove"
109
+ else
110
+ run "#{try_sudo} update-rc.d passenger-#{application} defaults"
111
+ end
108
112
  end
109
113
 
110
114
  task :symlink_logrotate_config, :roles => :app do
@@ -85,7 +85,11 @@ Capistrano::Configuration.instance(:must_exist).load do
85
85
 
86
86
  task :symlink_and_activate_thinctl, :roles => :app do
87
87
  run "#{try_sudo} ln -sf #{deploy_to}/thin/thinctl /etc/init.d/thin-#{application}"
88
- run "#{try_sudo} update-rc.d thin-#{application} defaults"
88
+ if stage.eql?(:staging)
89
+ run "#{try_sudo} update-rc.d -f thin-#{application} remove"
90
+ else
91
+ run "#{try_sudo} update-rc.d thin-#{application} defaults"
92
+ end
89
93
  end
90
94
 
91
95
  task :symlink_logrotate_config, :roles => :app do
@@ -3,7 +3,8 @@ unless Capistrano::Configuration.respond_to?(:instance)
3
3
  end
4
4
 
5
5
  require "#{File.dirname(__FILE__)}/recipes/deploify"
6
- # require "#{File.dirname(__FILE__)}/recipes/mongodb"
6
+ require "#{File.dirname(__FILE__)}/recipes/dragonfly"
7
+ require "#{File.dirname(__FILE__)}/recipes/mongodb"
7
8
  require "#{File.dirname(__FILE__)}/recipes/monit"
8
9
  require "#{File.dirname(__FILE__)}/recipes/mysql"
9
10
  require "#{File.dirname(__FILE__)}/recipes/nginx"
@@ -2,11 +2,11 @@ USER=app_${APPLICATION}
2
2
  APP_DIR=<%= thin_applications_dir %>/${APPLICATION}/current
3
3
 
4
4
  if [ "${APP_PORT}" = "" ]; then
5
- CMD_START="cd ${APP_DIR}; rvm use ${RVM_RUBY}; NOEXEC_DISABLE=1 thin start -s ${THIN_SERVERS} -S tmp/pids/thin.sock -e ${ENVIRONMENT} --stats /thin-status -d"
6
- CMD_RESTART="cd ${APP_DIR}; rvm use ${RVM_RUBY}; NOEXEC_DISABLE=1 thin restart -s ${THIN_SERVERS} -S tmp/pids/thin.sock -e ${ENVIRONMENT} --stats /thin-status -d"
5
+ CMD_START="cd ${APP_DIR}; rvm use ${RVM_RUBY}; NOEXEC_DISABLE=1 thin start -s ${THIN_SERVERS} -S tmp/pids/thin.sock -e ${ENVIRONMENT} --tag ${APPLICATION} --stats /thin-status -d"
6
+ CMD_RESTART="cd ${APP_DIR}; rvm use ${RVM_RUBY}; NOEXEC_DISABLE=1 thin restart -s ${THIN_SERVERS} -S tmp/pids/thin.sock -e ${ENVIRONMENT} --tag ${APPLICATION} --stats /thin-status -d"
7
7
  else
8
- CMD_START="cd ${APP_DIR}; rvm use ${RVM_RUBY}; NOEXEC_DISABLE=1 thin start -s ${THIN_SERVERS} -p ${APP_PORT} -e ${ENVIRONMENT} --stats /thin-status -d"
9
- CMD_RESTART="cd ${APP_DIR}; rvm use ${RVM_RUBY}; NOEXEC_DISABLE=1 thin restart -s ${THIN_SERVERS} -p ${APP_PORT} -e ${ENVIRONMENT} --stats /thin-status -d"
8
+ CMD_START="cd ${APP_DIR}; rvm use ${RVM_RUBY}; NOEXEC_DISABLE=1 thin start -s ${THIN_SERVERS} -p ${APP_PORT} -e ${ENVIRONMENT} --tag ${APPLICATION} --stats /thin-status -d"
9
+ CMD_RESTART="cd ${APP_DIR}; rvm use ${RVM_RUBY}; NOEXEC_DISABLE=1 thin restart -s ${THIN_SERVERS} -p ${APP_PORT} -e ${ENVIRONMENT} --tag ${APPLICATION} --stats /thin-status -d"
10
10
  fi
11
11
 
12
12
  function running_servers() {
@@ -1,7 +1,7 @@
1
1
  module Deploify
2
2
  MAJOR = 0
3
3
  MINOR = 2
4
- PATCH = 6
4
+ PATCH = 7
5
5
  BUILD = nil
6
6
 
7
7
  if BUILD.nil?
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deploify
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 6
10
- version: 0.2.6
9
+ - 7
10
+ version: 0.2.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Richard R\xCC\x8Ci\xCC\x81man"
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-12-06 00:00:00 Z
18
+ date: 2012-12-09 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: bundler
@@ -134,6 +134,7 @@ files:
134
134
  - lib/deploify/capistrano_extensions.rb
135
135
  - lib/deploify/recipes.rb
136
136
  - lib/deploify/recipes/deploify.rb
137
+ - lib/deploify/recipes/dragonfly.rb
137
138
  - lib/deploify/recipes/mongodb.rb
138
139
  - lib/deploify/recipes/monit.rb
139
140
  - lib/deploify/recipes/mysql.rb