capistrano-froxlor 0.0.1 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e6603d672f2bc8b30ddca9f2b128f1c79aac625a
4
- data.tar.gz: 0e290f0b33fedeae91bd08e36104285c009e5bf3
3
+ metadata.gz: 98d79e9ff5b3ee9bf0567a506ae49f2e1c5b3273
4
+ data.tar.gz: b54e88440ef51b5322e7f828ab9ab5d75fb5c8fc
5
5
  SHA512:
6
- metadata.gz: 089d64238decc4588007608b2682c9ff8741c8d55c9205774f5689bb39f9a481346f81aa13ee9f1dc9142b50cf3d6ccb84048f896eb51024757ebc0e390a854a
7
- data.tar.gz: 1865d6f93a70dfd1af7b52889575a289928ac1f14ad7d4d0c4c7df0f2d128be5980e164808076f211dbca49b707c07a3337ed2197d6e83a111b447339759f9b6
6
+ metadata.gz: eea161a47cc9ef319614570e34d9c7565450372484b30ebe5b719a9672af02ec59d9a9f6be3a9e789e96684ac5612d6003427bd32e1399350327089aae6fe38c
7
+ data.tar.gz: 82af267615491e38c5d6dac1f90528a67182e0fff68fea0345154589a964c46f42e35918d3509ae843f46b5e5fa5c9662bf7bfeb779c3310e2daafdaafcf671c
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Pim Snel
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
data/README.md CHANGED
@@ -1,6 +1,44 @@
1
1
  # Capistrano::Froxlor
2
2
 
3
- TODO: Write a gem description
3
+ [![Gem Version](https://badge.fury.io/rb/capistrano-froxlor.svg)](http://badge.fury.io/rb/capistrano-froxlor)
4
+
5
+ Add Froxlor cli functions to capistrano. This gem does not deploy Froxlor itself.
6
+
7
+ # Requirements
8
+
9
+ capistrano 3.x
10
+
11
+ ## Cap configuration
12
+
13
+ ```ruby
14
+ set :frx_db_auth, 'froxlor:froxlor_db_password@localhost'
15
+
16
+ set :frx_customer, 'customer_user_name'
17
+ set :frx_domains, -> do
18
+ [
19
+ "subdomain2.parent_domain.com" => {
20
+ :customer => 'customer_user_name',
21
+ :domain_docroot => "/var/customers/webs/customer_user_name/mywebroot",
22
+ :openbasedir_path_home => true,
23
+ :sub_domain_parent => 'parent_domain.com'
24
+ },
25
+ 'subdomain2.parent_domain.com' => {
26
+ :customer => 'customer_user_name',
27
+ :domain_docroot => "/var/customers/webs/customer_user_name/mywebroot",
28
+ :openbasedir_path_home => true,
29
+ :sub_domain_parent => 'parent_domain.com'
30
+ }
31
+ ]
32
+ end
33
+ ```
34
+
35
+ ## Usage
36
+
37
+ ```bash
38
+ cap froxlor:admin:master_cronjob # run master cron job
39
+ cap froxlor:customer:create_db # create db for customer based on latest name
40
+ cap froxlor:customer:create_domains # create or recreate (sub)domains
41
+ ```
4
42
 
5
43
  ## Installation
6
44
 
@@ -18,9 +56,11 @@ Or install it yourself as:
18
56
 
19
57
  $ gem install capistrano-froxlor
20
58
 
21
- ## Usage
59
+ Add this line to your Capfile
22
60
 
23
- TODO: Write usage instructions here
61
+ ```ruby
62
+ require 'capistrano/froxlor'
63
+ ```
24
64
 
25
65
  ## Contributing
26
66
 
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Froxlor
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
@@ -35,14 +35,24 @@ namespace :froxlor do
35
35
  charset = "abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ#{'0123456789' * 5}".split(//)
36
36
  new_db_password = (0...10).map{ charset[rand(charset.size)] }.join
37
37
 
38
- customer_id = capture "mysql -p#{dbpass} -u#{dbuser} -h#{dbhost} #{dbname} --execute='select customerid from panel_customers where loginname =\"userdev\";' -B -N".strip
38
+ customer_id = capture "mysql -p#{dbpass} -u#{dbuser} -h#{dbhost} #{dbname} --execute='select customerid from panel_customers where loginname =\"#{customer}\";' -B -N".strip
39
39
 
40
40
  execute "echo \"" \
41
- "CREATE USER #{new_db_name}@localhost IDENTIFIED BY '#{new_db_password}';" \
42
- "CREATE DATABASE #{new_db_name};" \
43
- "GRANT ALL PRIVILEGES ON #{new_db_name}.* TO #{new_db_name};" \
44
- "INSERT INTO panel_databases (customerid, databasename, description, dbserver, apsdb) VALUES (#{customer_id}, '#{new_db_name}', '#{fetch(:application)}:#{fetch(:stage).to_s} (auto created by capfroxlor)', 0, 0);" \
45
- "\" | mysql -p#{dbpass} -u#{dbuser} -h#{dbhost} #{dbname}"
41
+ "CREATE USER #{new_db_name}@localhost IDENTIFIED BY '#{new_db_password}';\"" \
42
+ "| mysql -p#{dbpass} -u#{dbuser} -h#{dbhost} #{dbname}"
43
+
44
+ execute "echo \"" \
45
+ "CREATE DATABASE #{new_db_name};\"" \
46
+ "| mysql -p#{dbpass} -u#{dbuser} -h#{dbhost} #{dbname}"
47
+
48
+ execute "echo \"" \
49
+ "GRANT ALL PRIVILEGES ON #{new_db_name}.* TO #{new_db_name};\"" \
50
+ "| mysql -p#{dbpass} -u#{dbuser} -h#{dbhost} #{dbname}"
51
+
52
+ execute "echo \"" \
53
+ "INSERT INTO panel_databases (customerid, databasename, description, dbserver, apsdb)" \
54
+ "VALUES (#{customer_id}, '#{new_db_name}', '#{fetch(:application)}:#{fetch(:stage).to_s} (auto created by capfroxlor)', 0, 0);\"" \
55
+ "| mysql -p#{dbpass} -u#{dbuser} -h#{dbhost} #{dbname}"
46
56
 
47
57
  open("config/deploy/#{fetch(:stage).to_s}.rb", 'a') { |f|
48
58
  f.puts "### ----- ALERT"
@@ -59,7 +69,6 @@ namespace :froxlor do
59
69
  task :create_domains do
60
70
  on roles(:all) do
61
71
 
62
-
63
72
  run_master_job=false
64
73
 
65
74
  customer = fetch(:frx_customer)
@@ -69,7 +78,7 @@ namespace :froxlor do
69
78
  dbpass = dbcon[1].split('@')[0]
70
79
  dbhost = dbcon[1].split('@')[1]
71
80
 
72
- customer_id = capture "mysql -p#{dbpass} -u#{dbuser} -h#{dbhost} #{dbname} --execute='select customerid from panel_customers where loginname =\"userdev\";' -B -N".strip
81
+ customer_id = capture "mysql -p#{dbpass} -u#{dbuser} -h#{dbhost} #{dbname} --execute='select customerid from panel_customers where loginname =\"#{customer}\";' -B -N".strip
73
82
 
74
83
  fetch(:frx_domains).each do |dom|
75
84
  dom.each do | dname,dsettings|
@@ -100,7 +109,7 @@ namespace :froxlor do
100
109
  if new_dom_id.to_i > 0
101
110
  #update
102
111
  run_master_job = true
103
- sql = "UPDATE panel_domains SET domain=\"#{dname}\", customerid = #{customer_id.to_i}, documentroot=\"#{dsettings[:domain_docroot]}\" WHERE id = #{new_dom_id}"
112
+ sql = "UPDATE panel_domains SET domain=\"#{dname}\", customerid = #{customer_id.to_i}, documentroot=\"#{dsettings[:domain_docroot]}\", ipandport = #{fetch(:frx_ip_and_port)} WHERE id = #{new_dom_id}"
104
113
  else
105
114
  run_master_job = true
106
115
  sql = "INSERT INTO panel_domains ("\
@@ -109,7 +118,7 @@ namespace :froxlor do
109
118
  " wwwserveralias, parentdomainid, openbasedir, openbasedir_path, speciallogfile, specialsettings,"\
110
119
  " deactivated, bindserial, add_date, registration_date, phpsettingid, mod_fcgid_starter, mod_fcgid_maxrequests, ismainbutsubto) " \
111
120
  " VALUES " \
112
- "(\"#{dname}\", 0, #{customer_id.to_i}, NULL, \"#{dsettings[:domain_docroot]}\", 2, 0, 0,"\
121
+ "(\"#{dname}\", 0, #{customer_id.to_i}, NULL, \"#{dsettings[:domain_docroot]}\", #{fetch(:frx_ip_and_port)}, 0, 0,"\
113
122
  " 0, 0, 0, 1, \"\", 0, 0, \"\", \"\","\
114
123
  " 1, #{parent_dom_id}, 0, 1, 0, \"\","\
115
124
  " 0, \"2000010100\", 0, \"0000-00-00\", 1, -1, -1, 0);"
metadata CHANGED
@@ -1,41 +1,41 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-froxlor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pim Snel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-20 00:00:00.000000000 Z
11
+ date: 2014-12-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.7'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.7'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '10.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
41
  description: Add Froxlor cli functions to capistrano. This gem does not deploy Froxlor
@@ -46,8 +46,9 @@ executables: []
46
46
  extensions: []
47
47
  extra_rdoc_files: []
48
48
  files:
49
- - .gitignore
49
+ - ".gitignore"
50
50
  - Gemfile
51
+ - LICENSE
51
52
  - LICENSE.txt
52
53
  - README.md
53
54
  - Rakefile
@@ -65,17 +66,17 @@ require_paths:
65
66
  - lib
66
67
  required_ruby_version: !ruby/object:Gem::Requirement
67
68
  requirements:
68
- - - '>='
69
+ - - ">="
69
70
  - !ruby/object:Gem::Version
70
71
  version: '0'
71
72
  required_rubygems_version: !ruby/object:Gem::Requirement
72
73
  requirements:
73
- - - '>='
74
+ - - ">="
74
75
  - !ruby/object:Gem::Version
75
76
  version: '0'
76
77
  requirements: []
77
78
  rubyforge_project:
78
- rubygems_version: 2.4.2
79
+ rubygems_version: 2.4.3
79
80
  signing_key:
80
81
  specification_version: 4
81
82
  summary: Froxlor cli functionality for capistrano 3