wslave 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/base/.gitignore +2 -2
- data/base/config/deploy-tools/nginx.vhost.erb +14 -7
- data/base/docker/apache/Dockerfile +1 -1
- data/base/docker/nginx/nginx.vhost +25 -11
- data/base/docker-compose.yml +3 -3
- data/base/public/.htaccess +10 -5
- data/base/public/wp-config.php +5 -0
- data/bin/wslave +9 -2
- data/lib/wslave_new.rb +15 -1
- data/lib/wslave_sage.rb +5 -2
- data/lib/wslave_tools.rb +14 -5
- data/lib/wslave_update.rb +1 -0
- data/wslave.gemspec +3 -3
- metadata +11 -13
- data/base/config/deploy/.production.rb.swp +0 -0
- data/base/config/deploy/.staging.rb.swp +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3005a61b1ba567a6fce7a42060082c45c7f325615dd3f884459c44a001b0a91b
|
4
|
+
data.tar.gz: b57388304f2e9711ee41be958749bbe0d2bc99d2be320c99ac87922745df9cf1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b4bbb740b9c5922bb4bd01c3b2901fa6d9fa211d54d3af3d3c6da6da80c7addd765558f0f943706b8341b065f533e7ea3cf07445e1ebb4b173e448a21d1b276
|
7
|
+
data.tar.gz: 985284c6599e4675807ae3ea4ea6c2c6f363c2d14a6379fcdc6b0989cd05e3279948056f66bc36c3a336e552496cbc29ba63dc33fe295673c427241f07f37ccf
|
data/base/.gitignore
CHANGED
@@ -12,7 +12,10 @@ server {
|
|
12
12
|
index index.php;
|
13
13
|
|
14
14
|
location / {
|
15
|
-
rewrite ^/
|
15
|
+
rewrite ^/wp-admin$ /wordpress/wp-admin/ redirect;
|
16
|
+
rewrite ^/wp-admin/(.*) /wordpress/wp-admin/$1 redirect;
|
17
|
+
|
18
|
+
rewrite ^/wp-includes/(.*) /wordpress/wp-includes/$1 last;
|
16
19
|
|
17
20
|
rewrite ^/$ /wordpress/index.php last;
|
18
21
|
|
@@ -20,10 +23,9 @@ server {
|
|
20
23
|
if ($request_uri !~* "/wp-config.php") {
|
21
24
|
rewrite ^/wp-(.*)\.php$ /wordpress/wp-$1.php last;
|
22
25
|
}
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
fastcgi_pass unix:<%= server[:php_sock_path] %>;
|
26
|
+
rewrite ^/index\.php$ /wordpress/index.php last;
|
27
|
+
include snippets/fastcgi-php.conf;
|
28
|
+
fastcgi_pass unix:<%= server[:php_sock_path] %>;
|
27
29
|
}
|
28
30
|
|
29
31
|
try_files $uri $uri/ /index.php?$args;
|
@@ -35,9 +37,14 @@ server {
|
|
35
37
|
log_not_found off;
|
36
38
|
}
|
37
39
|
|
40
|
+
# Don't allow PHP to be run from the uploads folder (common attack vector)
|
41
|
+
location ~* /(?:uploads|files|wp-content\/uploads|wp-content\/files)/.*\.php$ {
|
42
|
+
deny all;
|
43
|
+
}
|
44
|
+
|
38
45
|
location /wp-json/ { # Resolves WP Gutenberg 404 issue
|
39
46
|
try_files $uri $uri/ /index.php;
|
40
|
-
}
|
47
|
+
}
|
41
48
|
|
42
49
|
location ~* \.(blade\.php)$ {
|
43
50
|
deny all;
|
@@ -56,4 +63,4 @@ server {
|
|
56
63
|
}
|
57
64
|
|
58
65
|
client_max_body_size 4096M;
|
59
|
-
}
|
66
|
+
}
|
@@ -1,15 +1,25 @@
|
|
1
1
|
server {
|
2
|
-
listen
|
3
|
-
listen [::]:
|
2
|
+
listen 8001 default_server;
|
3
|
+
listen [::]:8001;
|
4
4
|
|
5
|
-
server_name
|
5
|
+
server_name _;
|
6
|
+
|
7
|
+
port_in_redirect on; # Keeps the 8001 in redirects for better local development
|
6
8
|
|
7
9
|
root /var/www/html;
|
8
10
|
|
9
11
|
index index.php;
|
10
12
|
|
13
|
+
rewrite ^http://$host/.* http://$host:$server_port$request_uri;
|
14
|
+
rewrite ^http://$host:$server_port/wp-admin$ http://$host:$server_port/wordpress/wp-admin/;
|
15
|
+
|
16
|
+
proxy_set_header Host $host:$server_port;
|
17
|
+
|
11
18
|
location / {
|
12
|
-
rewrite ^/
|
19
|
+
rewrite ^/wp-admin$ /wordpress/wp-admin/ redirect;
|
20
|
+
rewrite ^/wp-admin/(.*) /wordpress/wp-admin/$1 redirect;
|
21
|
+
|
22
|
+
rewrite ^/wp-includes/(.*) /wordpress/wp-includes/$1;
|
13
23
|
|
14
24
|
rewrite ^/$ /wordpress/index.php last;
|
15
25
|
|
@@ -17,10 +27,10 @@ server {
|
|
17
27
|
if ($request_uri !~* "/wp-config.php") {
|
18
28
|
rewrite ^/wp-(.*)\.php$ /wordpress/wp-$1.php last;
|
19
29
|
}
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
30
|
+
|
31
|
+
rewrite ^/index\.php$ /wordpress/index.php last;
|
32
|
+
include snippets/fastcgi-php.conf;
|
33
|
+
fastcgi_pass unix:/run/php/php7.4-fpm.sock;
|
24
34
|
}
|
25
35
|
|
26
36
|
try_files $uri $uri/ /index.php?$args;
|
@@ -32,9 +42,13 @@ server {
|
|
32
42
|
log_not_found off;
|
33
43
|
}
|
34
44
|
|
45
|
+
location ~* /(?:uploads|files|wp-content\/uploads|wp-content\/files)/.*\.php$ {
|
46
|
+
deny all;
|
47
|
+
}
|
48
|
+
|
35
49
|
location /wp-json/ { # Resolves WP Gutenberg 404 issue
|
36
50
|
try_files $uri $uri/ /index.php;
|
37
|
-
}
|
51
|
+
}
|
38
52
|
|
39
53
|
location ~* \.(blade\.php)$ {
|
40
54
|
deny all;
|
@@ -52,5 +66,5 @@ server {
|
|
52
66
|
deny all;
|
53
67
|
}
|
54
68
|
|
55
|
-
client_max_body_size
|
56
|
-
}
|
69
|
+
client_max_body_size 0;
|
70
|
+
}
|
data/base/docker-compose.yml
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
version: '3.
|
1
|
+
version: '3.8'
|
2
2
|
|
3
3
|
services:
|
4
4
|
db:
|
5
|
-
image: mariadb:10.
|
5
|
+
image: mariadb:10.7-focal
|
6
6
|
volumes:
|
7
7
|
- "./db/dev:/db"
|
8
8
|
- "./db/active:/docker-entrypoint-initdb.d"
|
@@ -27,7 +27,7 @@ services:
|
|
27
27
|
volumes:
|
28
28
|
- "./public:/var/www/html"
|
29
29
|
ports:
|
30
|
-
- "8001:
|
30
|
+
- "8001:8001"
|
31
31
|
environment:
|
32
32
|
WORDPRESS_DB_HOST: db:3306
|
33
33
|
WORDPRESS_DB_PASSWORD: wordpress
|
data/base/public/.htaccess
CHANGED
@@ -2,17 +2,24 @@
|
|
2
2
|
RewriteEngine On
|
3
3
|
RewriteBase /
|
4
4
|
|
5
|
+
# Open the subfoldered index when accessing the apex
|
5
6
|
RewriteRule ^$ wordpress/index.php [L]
|
6
7
|
|
8
|
+
# Special forwarding to wp-admin
|
9
|
+
RewriteRule ^wp-admin$ wp-admin/
|
10
|
+
RewriteRule ^wp-admin/(.*) wordpress/wp-admin/$1 [R=301,L]
|
11
|
+
|
7
12
|
# Skip real files and directories
|
8
13
|
RewriteCond %{REQUEST_FILENAME} !-f
|
9
14
|
RewriteCond %{REQUEST_FILENAME} !-d
|
10
15
|
|
11
16
|
# Otherwise send it to WordPress
|
12
17
|
RewriteRule .* wordpress/index.php [L]
|
18
|
+
|
13
19
|
# BEGIN WordPress
|
14
20
|
# END WordPress
|
15
21
|
</IfModule>
|
22
|
+
|
16
23
|
<FilesMatch ".+\.(blade\.php)$">
|
17
24
|
<IfModule mod_authz_core.c>
|
18
25
|
# Apache 2.4
|
@@ -24,8 +31,6 @@
|
|
24
31
|
Deny from all
|
25
32
|
</IfModule>
|
26
33
|
</FilesMatch>
|
27
|
-
|
28
|
-
php_value
|
29
|
-
php_value
|
30
|
-
php_value max_execution_time 1200
|
31
|
-
php_value max_input_time 2400
|
34
|
+
|
35
|
+
php_value upload_max_filesize 0
|
36
|
+
php_value post_max_size 0
|
data/base/public/wp-config.php
CHANGED
@@ -92,5 +92,10 @@ define('WP_CONTENT_URL', WP_HOME . '/wp-content');
|
|
92
92
|
//define('WP_TEMP_DIR', realpath(ABSPATH . '../../tmp/'));
|
93
93
|
define('FS_METHOD', 'direct');
|
94
94
|
|
95
|
+
define('FORCE_SSL_ADMIN', false);
|
96
|
+
define('FORCE_SSL_LOGIN', false);
|
97
|
+
|
98
|
+
define('WP_CACHE', false);
|
99
|
+
|
95
100
|
/** Sets up WordPress vars and included files. */
|
96
101
|
require_once(ABSPATH . 'wp-settings.php');
|
data/bin/wslave
CHANGED
@@ -20,11 +20,18 @@ class WSlaveCLI < Thor
|
|
20
20
|
option :version, default: '',
|
21
21
|
desc: 'Specify the version, EG: "--version 5.3". To specify edge/development master use "--version edge".'
|
22
22
|
option :wspath, default: '',
|
23
|
-
desc: 'specify the path to the wslave distribution, EG: "--wspath ../wslave".
|
23
|
+
desc: 'specify the path to the wslave distribution, EG: "--wspath ../wslave".
|
24
|
+
NOTE: This is relative to the new app path.'
|
25
|
+
option :wppath, default: '',
|
26
|
+
desc: 'specify the path to a cloned git wordpress distribution, EG: "--wppath /shared/wordpress".
|
27
|
+
NOTE: This is relative to the new app path.
|
28
|
+
NOTE: If no data is found in this directory, wslave will clone the official WordPress repository here and
|
29
|
+
copy it. Also, if there is data here that does not match the format of the official WordPress repository,
|
30
|
+
most wslave functionality will probably be broken.'
|
24
31
|
def new(path = './')
|
25
32
|
require_relative '../lib/wslave_new'
|
26
33
|
real_path = File.expand_path(path)
|
27
|
-
WSlaveNew.new(real_path, options['version'], options['wspath'])
|
34
|
+
WSlaveNew.new(real_path, options['version'], options['wspath'], options['wppath'])
|
28
35
|
end
|
29
36
|
|
30
37
|
desc 'update', "Updates toolchain"
|
data/lib/wslave_new.rb
CHANGED
@@ -6,7 +6,7 @@ require 'git'
|
|
6
6
|
require_relative 'wslave_tools'
|
7
7
|
|
8
8
|
class WSlaveNew
|
9
|
-
def initialize(path, version = '', wspath = '')
|
9
|
+
def initialize(path, version = '', wspath = '', wppath = '')
|
10
10
|
puts '⚙ Initializing Toolchain・・・'
|
11
11
|
|
12
12
|
if (wspath != '')
|
@@ -39,6 +39,20 @@ class WSlaveNew
|
|
39
39
|
|
40
40
|
`cd #{path} && git init && git add --all && git commit -am "initial commit by wslave"`
|
41
41
|
|
42
|
+
if (wppath != '')
|
43
|
+
wppath = File.expand_path(wppath)
|
44
|
+
puts " >> Checking wppath (#{wppath}) ..."
|
45
|
+
if (File.directory? wppath)
|
46
|
+
puts " >> wppath is a folder. Copying..."
|
47
|
+
Dir.chdir path
|
48
|
+
FileUtils.cp_r wppath, "public/wordpress"
|
49
|
+
Dir.chdir "public/wordpress"
|
50
|
+
`git clean -fdx; git stash`
|
51
|
+
`git checkout master`
|
52
|
+
`git pull`
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
42
56
|
`cd #{path} && git submodule add git://github.com/WordPress/WordPress.git public/wordpress`
|
43
57
|
`cd #{path} && git submodule update --init --recursive public/wordpress`
|
44
58
|
if (version == 'edge' || version == 'master')
|
data/lib/wslave_sage.rb
CHANGED
@@ -16,11 +16,14 @@ class WSlaveSage
|
|
16
16
|
project_root = Dir.pwd
|
17
17
|
|
18
18
|
puts "Creating Sage theme at public/wp-content/themes/#{name}"
|
19
|
-
|
19
|
+
Dir.chdir "public/wp-content/themes"
|
20
|
+
`composer create-project roots/sage #{name}`
|
21
|
+
Dir.chdir name
|
22
|
+
`composer require roots/acorn`
|
20
23
|
|
21
24
|
Dir.chdir project_root
|
22
25
|
_write_wslave_sage_config(name)
|
23
|
-
_overwrite_sage_webpack_browsersync_config
|
26
|
+
# _overwrite_sage_webpack_browsersync_config # TODO: sageの更新でwebpack.mix.jsが出力されなくなっている様子
|
24
27
|
end
|
25
28
|
|
26
29
|
def update()
|
data/lib/wslave_tools.rb
CHANGED
@@ -11,20 +11,28 @@ class WSlaveTools
|
|
11
11
|
|
12
12
|
def self.set_dev_perms(path = '.')
|
13
13
|
begin
|
14
|
-
unless Dir.exist?("#{path}/public/
|
15
|
-
FileUtils.mkdir("#{path}/public/
|
16
|
-
FileUtils.touch("#{path}/public/
|
14
|
+
unless Dir.exist?("#{path}/public/data")
|
15
|
+
FileUtils.mkdir("#{path}/public/data")
|
16
|
+
FileUtils.touch("#{path}/public/data/.gitkeep")
|
17
17
|
end
|
18
|
+
FileUtils.chown(nil, 'www-data', "#{path}/public/data")
|
19
|
+
FileUtils.chmod(0775, "#{path}/public/data")
|
20
|
+
|
18
21
|
FileUtils.chown(nil, 'www-data', "#{path}/public/wp-content/themes")
|
19
22
|
FileUtils.chmod(0775, "#{path}/public/wp-content/themes")
|
23
|
+
|
20
24
|
FileUtils.chown(nil, 'www-data', "#{path}/public/wp-content/uploads")
|
21
25
|
FileUtils.chmod(0775, "#{path}/public/wp-content/uploads")
|
26
|
+
|
22
27
|
FileUtils.chown(nil, 'www-data', "#{path}/public/wp-content/plugins")
|
23
28
|
FileUtils.chmod(0775, "#{path}/public/wp-content/plugins")
|
29
|
+
|
30
|
+
unless Dir.exist?("#{path}/public/wp-content/upgrade")
|
31
|
+
FileUtils.mkdir("#{path}/public/wp-content/upgrade")
|
32
|
+
FileUtils.touch("#{path}/public/wp-content/upgrade/.gitkeep")
|
33
|
+
end
|
24
34
|
FileUtils.chown(nil, 'www-data', "#{path}/public/wp-content/upgrade")
|
25
35
|
FileUtils.chmod(0775, "#{path}/public/wp-content/upgrade")
|
26
|
-
FileUtils.chown(nil, 'www-data', "#{path}/public/data")
|
27
|
-
FileUtils.chmod(0775, "#{path}/public/data")
|
28
36
|
|
29
37
|
unless Dir.exist?("#{path}/db")
|
30
38
|
FileUtils.mkdir("#{path}/db")
|
@@ -59,6 +67,7 @@ class WSlaveTools
|
|
59
67
|
end
|
60
68
|
FileUtils.chown(nil, 'www-data', "#{path}/db/production")
|
61
69
|
FileUtils.chmod(0775, "#{path}/db/production")
|
70
|
+
|
62
71
|
rescue Errno::EPERM
|
63
72
|
puts "!!!WARNING!!! Your user does not belong to the www-data group!\n" \
|
64
73
|
" >>> Unable to make folders writable for devlopment. <<<\n" \
|
data/lib/wslave_update.rb
CHANGED
@@ -24,6 +24,7 @@ class WSlaveUpdate
|
|
24
24
|
FileUtils.cp_r("#{base_path}/docker", "#{path}/")
|
25
25
|
FileUtils.cp("#{base_path}/docker-compose.yml", "#{path}/docker-compose.yml")
|
26
26
|
FileUtils.cp("#{base_path}/public/.htaccess", "#{path}/public/.htaccess")
|
27
|
+
FileUtils.cp("#{base_path}/public/wp-config.php", "#{path}/public/wp-config.php")
|
27
28
|
FileUtils.cp_r(Dir.glob("#{base_path}/config/*"), "#{path}/config")
|
28
29
|
FileUtils.cp("#{template_path}/config/database.yml", "#{path}/config/database.yml") unless File.exist? "#{path}/config/database.yml"
|
29
30
|
FileUtils.cp("#{template_path}/config/definitions.yml", "#{path}/config/definitions.yml") unless File.exist? "#{path}/config/definitions.yml"
|
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.
|
3
|
+
s.version = '0.3.5'
|
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 ' \
|
@@ -25,8 +25,8 @@ Gem::Specification.new do |s|
|
|
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.10', '1.10.2'
|
29
29
|
|
30
|
-
s.add_dependency 'thor', '~> 1.
|
30
|
+
s.add_dependency 'thor', '~> 1.2', '1.2.1'
|
31
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.3.
|
4
|
+
version: 0.3.5
|
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: 2022-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capistrano
|
@@ -90,40 +90,40 @@ dependencies:
|
|
90
90
|
requirements:
|
91
91
|
- - "~>"
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version: '1.
|
93
|
+
version: '1.10'
|
94
94
|
- - '='
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 1.
|
96
|
+
version: 1.10.2
|
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.10'
|
104
104
|
- - '='
|
105
105
|
- !ruby/object:Gem::Version
|
106
|
-
version: 1.
|
106
|
+
version: 1.10.2
|
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.2'
|
114
114
|
- - '='
|
115
115
|
- !ruby/object:Gem::Version
|
116
|
-
version: 1.1
|
116
|
+
version: 1.2.1
|
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.2'
|
124
124
|
- - '='
|
125
125
|
- !ruby/object:Gem::Version
|
126
|
-
version: 1.1
|
126
|
+
version: 1.2.1
|
127
127
|
- !ruby/object:Gem::Dependency
|
128
128
|
name: haikunator
|
129
129
|
requirement: !ruby/object:Gem::Requirement
|
@@ -164,8 +164,6 @@ 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
|
169
167
|
- base/config/deploy/production.rb
|
170
168
|
- base/config/deploy/staging.rb
|
171
169
|
- base/docker-compose.yml
|
@@ -205,7 +203,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
205
203
|
- !ruby/object:Gem::Version
|
206
204
|
version: '0'
|
207
205
|
requirements: []
|
208
|
-
rubygems_version: 3.
|
206
|
+
rubygems_version: 3.3.7
|
209
207
|
signing_key:
|
210
208
|
specification_version: 4
|
211
209
|
summary: '"Word Slave" generates and controls a WordPress installation'
|
Binary file
|
Binary file
|