wslave 0.2.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/base/Rakefile +5 -0
- data/base/config/deploy-tools/nginx.vhost.erb +13 -5
- data/base/config/deploy.rb +1 -1
- data/base/config/deploy/.production.rb.swp +0 -0
- data/base/config/deploy/.staging.rb.swp +0 -0
- data/base/docker-compose.yml +2 -2
- data/base/docker/apache/Dockerfile +1 -1
- data/base/docker/nginx/Dockerfile +11 -5
- data/base/docker/nginx/nginx.vhost +43 -35
- data/base/docker/nginx/php.ini +1946 -0
- data/base/docker/nginx/supervisord.conf +1 -1
- data/base/public/.htaccess +15 -11
- data/bin/wslave +64 -71
- data/lib/wslave_docker.rb +27 -7
- data/lib/wslave_new.rb +22 -6
- data/wslave.gemspec +5 -5
- metadata +18 -15
data/base/public/.htaccess
CHANGED
@@ -1,18 +1,17 @@
|
|
1
1
|
<IfModule mod_rewrite.c>
|
2
|
-
|
3
|
-
|
2
|
+
RewriteEngine On
|
3
|
+
RewriteBase /
|
4
4
|
|
5
|
-
|
5
|
+
RewriteRule ^$ wordpress/index.php [L]
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
# Skip real files and directories
|
8
|
+
RewriteCond %{REQUEST_FILENAME} !-f
|
9
|
+
RewriteCond %{REQUEST_FILENAME} !-d
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
# END WordPress
|
11
|
+
# Otherwise send it to WordPress
|
12
|
+
RewriteRule .* wordpress/index.php [L]
|
13
|
+
# BEGIN WordPress
|
14
|
+
# END WordPress
|
16
15
|
</IfModule>
|
17
16
|
<FilesMatch ".+\.(blade\.php)$">
|
18
17
|
<IfModule mod_authz_core.c>
|
@@ -25,3 +24,8 @@
|
|
25
24
|
Deny from all
|
26
25
|
</IfModule>
|
27
26
|
</FilesMatch>
|
27
|
+
php_value upload_max_filesize 4096M
|
28
|
+
php_value post_max_size 4096M
|
29
|
+
php_value memory_limit 512M
|
30
|
+
php_value max_execution_time 1200
|
31
|
+
php_value max_input_time 2400
|
data/bin/wslave
CHANGED
@@ -8,6 +8,13 @@ class WSlaveCLI < Thor
|
|
8
8
|
true
|
9
9
|
end
|
10
10
|
|
11
|
+
desc 'version', "Prints the version of the installed WSlave"
|
12
|
+
def version()
|
13
|
+
require 'rubygems'
|
14
|
+
spec = Gem::Specification::load("#{__dir__}/../wslave.gemspec")
|
15
|
+
puts spec.version
|
16
|
+
end
|
17
|
+
|
11
18
|
desc 'new [APP_PATH]', "Generate a new app at APP_PATH"
|
12
19
|
long_desc "Creates a new application in the current directory or in the specificed path."
|
13
20
|
option :version, default: '',
|
@@ -27,57 +34,6 @@ class WSlaveCLI < Thor
|
|
27
34
|
WSlaveUpdate.new()
|
28
35
|
end
|
29
36
|
|
30
|
-
desc 'server COMMAND [options]', "Control the development server container. " \
|
31
|
-
"Commands include: start stop log console"
|
32
|
-
long_desc <<-LONGDESC
|
33
|
-
Start, stop, view logs for, or connect to a console in a development server container.
|
34
|
-
\x5
|
35
|
-
\x5 COMMANDs:
|
36
|
-
\x5 start Starts a development server container. *Will restart the container if already running.
|
37
|
-
\x5 stop Stops a running development container.
|
38
|
-
\x5 log Connects to the container logs and follows them.
|
39
|
-
\x5 console Gives a terminal connection to a bash console on the web container.
|
40
|
-
\x5\x5
|
41
|
-
Examples:
|
42
|
-
\x5 Start dev container servers
|
43
|
-
\x5 > wslave server start
|
44
|
-
\x5 Start or restart dev container servers after resetting all volumes (reinit)
|
45
|
-
\x5 > wslave server start -v
|
46
|
-
\x5 Force stop all dev container servers
|
47
|
-
\x5 > wslave server stop -f
|
48
|
-
\x5 Show logs
|
49
|
-
\x5 > wslave server logs
|
50
|
-
|
51
|
-
|
52
|
-
\x5 * If you do not specify a COMMAND the default is to start a server.
|
53
|
-
\x5 * If a server is alredy running this command will restart the server.
|
54
|
-
LONGDESC
|
55
|
-
method_option :v, type: :boolean, default: false, description: 'remove volume data'
|
56
|
-
method_option :f, type: :boolean, default: false, description: 'force close other servers first'
|
57
|
-
def server(command = 'start')
|
58
|
-
puts 'Starting server...'
|
59
|
-
require_relative '../lib/wslave_docker'
|
60
|
-
WSlaveDocker.new().server(command.to_sym, options['f'], options['v'])
|
61
|
-
end
|
62
|
-
|
63
|
-
desc 'start [options]', "Starts the development server (short for 'server start')"
|
64
|
-
method_option :v, type: :boolean, default: false, description: 'remove volume data'
|
65
|
-
method_option :f, type: :boolean, default: false, description: 'force close other servers first'
|
66
|
-
def start()
|
67
|
-
puts 'Starting server...'
|
68
|
-
require_relative '../lib/wslave_docker'
|
69
|
-
WSlaveDocker.new().server(:start, options['f'], options['v'])
|
70
|
-
end
|
71
|
-
|
72
|
-
desc 'stop [options]', "Stops the development server (short for 'server stop')"
|
73
|
-
method_option :v, type: :boolean, default: false, description: 'remove volume data'
|
74
|
-
method_option :f, type: :boolean, default: false, description: 'force close other servers first'
|
75
|
-
def stop()
|
76
|
-
puts 'Stopping server...'
|
77
|
-
require_relative '../lib/wslave_docker'
|
78
|
-
WSlaveDocker.new().server(:stop, options['f'], options['v'])
|
79
|
-
end
|
80
|
-
|
81
37
|
desc 'sync', "Synchronizes submodules and file permissions"
|
82
38
|
def sync()
|
83
39
|
require_relative '../lib/wslave_tools'
|
@@ -85,39 +41,76 @@ class WSlaveCLI < Thor
|
|
85
41
|
WSlaveTools.sync()
|
86
42
|
end
|
87
43
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
44
|
+
class Server < Thor
|
45
|
+
desc 'start [options]', "Starts the development server"
|
46
|
+
method_option :f, type: :boolean, default: false, description: 'force close other servers first'
|
47
|
+
def start()
|
48
|
+
puts 'Starting server...'
|
49
|
+
require_relative '../lib/wslave_docker'
|
50
|
+
WSlaveDocker.new().server(:start, options['f'])
|
51
|
+
end
|
52
|
+
|
53
|
+
desc 'stop [options]', "Stops the development server"
|
54
|
+
method_option :f, type: :boolean, default: false, description: 'force close other servers first'
|
55
|
+
def stop()
|
56
|
+
puts 'Stopping server...'
|
57
|
+
require_relative '../lib/wslave_docker'
|
58
|
+
WSlaveDocker.new().server(:stop, options['f'])
|
59
|
+
end
|
60
|
+
|
61
|
+
desc 'reset [options]', "Deletes all container data and volumes, then rebuilds and restarts the containers"
|
62
|
+
method_option :f, type: :boolean, default: false, description: 'force close other servers first'
|
63
|
+
def reset()
|
64
|
+
puts 'Stopping server...'
|
65
|
+
require_relative '../lib/wslave_docker'
|
66
|
+
WSlaveDocker.new().server(:reset, options['f'])
|
67
|
+
end
|
68
|
+
|
69
|
+
desc 'remove [options]', "Shuts down containers and deletes all container data and volumes"
|
70
|
+
method_option :f, type: :boolean, default: false, description: 'force close other servers first'
|
71
|
+
def remove()
|
72
|
+
puts 'Stopping server...'
|
73
|
+
require_relative '../lib/wslave_docker'
|
74
|
+
WSlaveDocker.new().server(:remove, options['f'])
|
75
|
+
end
|
93
76
|
end
|
77
|
+
desc 'server COMMAND [options]', "Control the development server container"
|
78
|
+
subcommand 'server', Server
|
94
79
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
def sage(command = '', arg = '')
|
99
|
-
case command
|
100
|
-
when 'create'
|
80
|
+
class Sage < Thor
|
81
|
+
desc 'create THEME_NAME', "Creates a theme with the specified name using Sage"
|
82
|
+
def create(theme_name = "wslave_sage_theme")
|
101
83
|
require_relative '../lib/wslave_sage'
|
102
|
-
puts "Generating sage theme base for #{
|
103
|
-
WSlaveSage.new().create(
|
104
|
-
|
84
|
+
puts "Generating sage theme base for #{theme_name}"
|
85
|
+
WSlaveSage.new().create(theme_name)
|
86
|
+
end
|
87
|
+
|
88
|
+
desc 'update', "Updates theme generator components"
|
89
|
+
def update
|
105
90
|
require_relative '../lib/wslave_sage'
|
106
91
|
WSlaveSage.new().update()
|
107
|
-
|
92
|
+
end
|
93
|
+
|
94
|
+
desc 'dev', "Starts a development server which dynamically compiles the theme"
|
95
|
+
def dev
|
108
96
|
require_relative '../lib/wslave_sage'
|
109
97
|
WSlaveSage.new().dev()
|
110
|
-
|
98
|
+
end
|
99
|
+
|
100
|
+
desc 'build', "Builds the theme (generates development grade static assets)"
|
101
|
+
def build
|
111
102
|
require_relative '../lib/wslave_sage'
|
112
103
|
WSlaveSage.new().build()
|
113
|
-
|
104
|
+
end
|
105
|
+
|
106
|
+
desc 'production', "Builds the theme (generates production grade static assets)"
|
107
|
+
def production
|
114
108
|
require_relative '../lib/wslave_sage'
|
115
109
|
WSlaveSage.new().production()
|
116
|
-
else
|
117
|
-
puts "sage command \"#{command}\" not found."
|
118
|
-
puts "sage commands available: create update dev build production"
|
119
110
|
end
|
120
111
|
end
|
112
|
+
desc 'sage COMMAND', "Generates and manages a Sage theme"
|
113
|
+
subcommand 'sage', Sage
|
121
114
|
end
|
122
115
|
|
123
116
|
WSlaveCLI.start(ARGV)
|
data/lib/wslave_docker.rb
CHANGED
@@ -6,12 +6,16 @@ class WSlaveDocker
|
|
6
6
|
puts 'Initializing WSlave Docker Control'
|
7
7
|
end
|
8
8
|
|
9
|
-
def server(command = :start, force = false
|
9
|
+
def server(command = :start, force = false)
|
10
10
|
case (command)
|
11
11
|
when :start
|
12
|
-
start(force
|
12
|
+
start(force)
|
13
13
|
when :stop
|
14
|
-
stop(force
|
14
|
+
stop(force)
|
15
|
+
when :reset
|
16
|
+
reset(force)
|
17
|
+
when :remove
|
18
|
+
remove(force)
|
15
19
|
when :log
|
16
20
|
log()
|
17
21
|
when :console
|
@@ -22,19 +26,35 @@ class WSlaveDocker
|
|
22
26
|
end
|
23
27
|
end
|
24
28
|
|
25
|
-
def start(force = false
|
29
|
+
def start(force = false)
|
26
30
|
return unless _check()
|
27
31
|
_force_down() if force
|
28
|
-
`docker-compose
|
32
|
+
`docker-compose stop` # Shutdown existing instances
|
29
33
|
_unfuck_dot_htaccess()
|
30
34
|
WSlaveTools.set_dev_perms
|
35
|
+
`docker-compose build`
|
36
|
+
`docker-compose start -d`
|
31
37
|
`docker-compose up -d`
|
32
38
|
end
|
33
39
|
|
34
|
-
def stop(force = false
|
40
|
+
def stop(force = false)
|
35
41
|
return unless _check()
|
36
42
|
_force_down() if force
|
37
|
-
`docker-compose
|
43
|
+
`docker-compose stop`
|
44
|
+
end
|
45
|
+
|
46
|
+
def reset(force = false)
|
47
|
+
return unless _check()
|
48
|
+
_force_down() if force
|
49
|
+
`docker-compose down -v`
|
50
|
+
`docker-compose build`
|
51
|
+
`docker-compose up -d`
|
52
|
+
end
|
53
|
+
|
54
|
+
def remove(force = false)
|
55
|
+
return unless _check()
|
56
|
+
_force_down() if force
|
57
|
+
`docker-compose down -v`
|
38
58
|
end
|
39
59
|
|
40
60
|
def log()
|
data/lib/wslave_new.rb
CHANGED
@@ -57,7 +57,7 @@ class WSlaveNew
|
|
57
57
|
FileUtils.touch("#{path}/public/wp-content/upgrade/.gitkeep")
|
58
58
|
Dir.chdir path
|
59
59
|
|
60
|
-
puts " > Preparing
|
60
|
+
puts " > Preparing static data directory"
|
61
61
|
FileUtils.mkdir("#{path}/public/data") unless Dir.exist?("#{path}/public/data")
|
62
62
|
|
63
63
|
puts " > Setting permissions"
|
@@ -74,12 +74,28 @@ class WSlaveNew
|
|
74
74
|
end
|
75
75
|
|
76
76
|
def get_stable_branch_version(path)
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
#
|
77
|
+
latest_major = 5
|
78
|
+
latest_minor = 7
|
79
|
+
|
80
|
+
reg = /^(\d*)\.(\d)-branch$/
|
81
|
+
puts "> Checking for WordPress versions in: #{path}"
|
82
|
+
cdir = Dir.pwd()
|
83
|
+
Dir.chdir(path)
|
84
|
+
g = Git.open("./")
|
85
|
+
g.branches.remote.each do |branch|
|
86
|
+
ver = reg.match(branch.name)
|
87
|
+
if (ver) # If the branch matched the x.y-branch pattern
|
88
|
+
if ((ver[1].to_i >= latest_major) && (ver[2].to_i > latest_minor))
|
89
|
+
latest_major = ver[1].to_i
|
90
|
+
latest_minor = ver[2].to_i
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
Dir.chdir(cdir)
|
82
96
|
|
97
|
+
latest = "#{latest_major}.#{latest_minor}"
|
98
|
+
puts "> Detected latest WordPress version as: #{latest}"
|
83
99
|
latest
|
84
100
|
end
|
85
101
|
end
|
data/wslave.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'wslave'
|
3
|
-
s.version = '0.
|
3
|
+
s.version = '0.3.4'
|
4
4
|
s.licenses = ['GPL-3.0', 'AGPL-3.0']
|
5
5
|
s.summary = '"Word Slave" generates and controls a WordPress installation'
|
6
6
|
s.description = 'Word Slave includes the wslave command and a control library to generate a ' \
|
@@ -20,13 +20,13 @@ Gem::Specification.new do |s|
|
|
20
20
|
s.bindir = 'bin'
|
21
21
|
s.executables << 'wslave'
|
22
22
|
|
23
|
-
s.add_dependency 'capistrano', '= 3.
|
23
|
+
s.add_dependency 'capistrano', '= 3.16.0'
|
24
24
|
s.add_dependency 'capistrano-git-with-submodules', '~> 2.0', '2.0.4'
|
25
25
|
s.add_dependency 'capistrano-scm-copy', '~> 0.7', '0.7.0'
|
26
26
|
s.add_dependency 'capistrano-file-permissions', '~> 1.0', '1.0.0'
|
27
27
|
|
28
|
-
s.add_dependency 'git', '~> 1.
|
28
|
+
s.add_dependency 'git', '~> 1.8', '1.8.1'
|
29
29
|
|
30
|
-
s.add_dependency 'thor', '~> 1.
|
31
|
-
s.add_dependency 'haikunator', '~> 1.1', '1.1.
|
30
|
+
s.add_dependency 'thor', '~> 1.1', '1.1.0'
|
31
|
+
s.add_dependency 'haikunator', '~> 1.1', '1.1.1'
|
32
32
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wslave
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rei Kagetsuki
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-05-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 3.
|
19
|
+
version: 3.16.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 3.
|
26
|
+
version: 3.16.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: capistrano-git-with-submodules
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -90,40 +90,40 @@ dependencies:
|
|
90
90
|
requirements:
|
91
91
|
- - "~>"
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version: '1.
|
93
|
+
version: '1.8'
|
94
94
|
- - '='
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 1.
|
96
|
+
version: 1.8.1
|
97
97
|
type: :runtime
|
98
98
|
prerelease: false
|
99
99
|
version_requirements: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '1.
|
103
|
+
version: '1.8'
|
104
104
|
- - '='
|
105
105
|
- !ruby/object:Gem::Version
|
106
|
-
version: 1.
|
106
|
+
version: 1.8.1
|
107
107
|
- !ruby/object:Gem::Dependency
|
108
108
|
name: thor
|
109
109
|
requirement: !ruby/object:Gem::Requirement
|
110
110
|
requirements:
|
111
111
|
- - "~>"
|
112
112
|
- !ruby/object:Gem::Version
|
113
|
-
version: '1.
|
113
|
+
version: '1.1'
|
114
114
|
- - '='
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version: 1.0
|
116
|
+
version: 1.1.0
|
117
117
|
type: :runtime
|
118
118
|
prerelease: false
|
119
119
|
version_requirements: !ruby/object:Gem::Requirement
|
120
120
|
requirements:
|
121
121
|
- - "~>"
|
122
122
|
- !ruby/object:Gem::Version
|
123
|
-
version: '1.
|
123
|
+
version: '1.1'
|
124
124
|
- - '='
|
125
125
|
- !ruby/object:Gem::Version
|
126
|
-
version: 1.0
|
126
|
+
version: 1.1.0
|
127
127
|
- !ruby/object:Gem::Dependency
|
128
128
|
name: haikunator
|
129
129
|
requirement: !ruby/object:Gem::Requirement
|
@@ -133,7 +133,7 @@ dependencies:
|
|
133
133
|
version: '1.1'
|
134
134
|
- - '='
|
135
135
|
- !ruby/object:Gem::Version
|
136
|
-
version: 1.1.
|
136
|
+
version: 1.1.1
|
137
137
|
type: :runtime
|
138
138
|
prerelease: false
|
139
139
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -143,7 +143,7 @@ dependencies:
|
|
143
143
|
version: '1.1'
|
144
144
|
- - '='
|
145
145
|
- !ruby/object:Gem::Version
|
146
|
-
version: 1.1.
|
146
|
+
version: 1.1.1
|
147
147
|
description: Word Slave includes the wslave command and a control library to generate
|
148
148
|
a "best practice" WordPress installation and includes a pre-rolled Docker setup
|
149
149
|
for running a development server and a Capistrano setup for deployment.
|
@@ -164,12 +164,15 @@ files:
|
|
164
164
|
- base/config/deploy-tools/wp-config.php.erb
|
165
165
|
- base/config/deploy-tools/wp-config.php.local
|
166
166
|
- base/config/deploy.rb
|
167
|
+
- base/config/deploy/.production.rb.swp
|
168
|
+
- base/config/deploy/.staging.rb.swp
|
167
169
|
- base/config/deploy/production.rb
|
168
170
|
- base/config/deploy/staging.rb
|
169
171
|
- base/docker-compose.yml
|
170
172
|
- base/docker/apache/Dockerfile
|
171
173
|
- base/docker/nginx/Dockerfile
|
172
174
|
- base/docker/nginx/nginx.vhost
|
175
|
+
- base/docker/nginx/php.ini
|
173
176
|
- base/docker/nginx/supervisord.conf
|
174
177
|
- base/public/.htaccess
|
175
178
|
- base/public/wp-config.php
|
@@ -202,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
202
205
|
- !ruby/object:Gem::Version
|
203
206
|
version: '0'
|
204
207
|
requirements: []
|
205
|
-
rubygems_version: 3.
|
208
|
+
rubygems_version: 3.2.15
|
206
209
|
signing_key:
|
207
210
|
specification_version: 4
|
208
211
|
summary: '"Word Slave" generates and controls a WordPress installation'
|