wslave 0.3.8 → 0.3.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,7 +5,7 @@ logfile_maxbytes=0
5
5
  pidfile=/run/supervisord.pid
6
6
 
7
7
  [program:php-fpm]
8
- command=php-fpm7.4 -F
8
+ command=php-fpm -F
9
9
  stdout_logfile=/dev/stdout
10
10
  stdout_logfile_maxbytes=0
11
11
  stderr_logfile=/dev/stderr
@@ -0,0 +1,9 @@
1
+ # Set user to www-data to try and avoid root owned files being created
2
+ user: www-data
3
+ path: /var/www/html/wordpress
4
+ # Core is managed seperately by git, so disable core file commands
5
+ disabled_commands:
6
+ - core download
7
+ - core install
8
+ - core update
9
+ - config create
@@ -6,6 +6,8 @@ services:
6
6
  volumes:
7
7
  - "./db/dev:/db"
8
8
  - "./db/active:/docker-entrypoint-initdb.d"
9
+ ports:
10
+ - "8003:3306"
9
11
  environment:
10
12
  MYSQL_ROOT_PASSWORD: wordpress
11
13
  MYSQL_DATABASE: wordpress
@@ -1,51 +1,23 @@
1
1
  <?php
2
- /**
3
- * The base configuration for WordPress
4
- *
5
- * The wp-config.php creation script uses this file during the
6
- * installation. You don't have to use the web site, you can
7
- * copy this file to "wp-config.php" and fill in the values.
8
- *
9
- * This file contains the following configurations:
10
- *
11
- * * MySQL settings
12
- * * Secret keys
13
- * * Database table prefix
14
- * * ABSPATH
15
- *
16
- * @link https://codex.wordpress.org/Editing_wp-config.php
17
- *
18
- * @package WordPress
19
- */
20
-
21
- // ** MySQL settings - You can get this info from your web host ** //
2
+ /** DB Info */
22
3
  /** The name of the database for WordPress */
23
4
  define('DB_NAME', 'wordpress');
24
-
25
5
  /** MySQL database username */
26
6
  define('DB_USER', 'root');
27
-
28
7
  /** MySQL database password */
29
8
  define('DB_PASSWORD', 'wordpress');
30
-
31
9
  /** MySQL hostname */
32
- define('DB_HOST', 'db');
33
-
10
+ if (php_sapi_name() == "cli") {
11
+ define('DB_HOST', '127.0.0.1:8003');
12
+ } else {
13
+ define('DB_HOST', 'db');
14
+ }
34
15
  /** Database Charset to use in creating database tables. */
35
16
  define('DB_CHARSET', 'utf8');
36
-
37
17
  /** The Database Collate type. Don't change this if in doubt. */
38
18
  define('DB_COLLATE', '');
39
19
 
40
- /**#@+
41
- * Authentication Unique Keys and Salts.
42
- *
43
- * Change these to different unique phrases!
44
- * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
45
- * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
46
- *
47
- * @since 2.6.0
48
- */
20
+ /** Auth Filler */
49
21
  define('AUTH_KEY', 'put your unique phrase here');
50
22
  define('SECURE_AUTH_KEY', 'put your unique phrase here');
51
23
  define('LOGGED_IN_KEY', 'put your unique phrase here');
@@ -82,14 +54,19 @@ define('WP_DEBUG', false);
82
54
  /* That's all, stop editing! Happy blogging. */
83
55
 
84
56
  /** Absolute path to the WordPress directory. */
85
- if ( !defined('ABSPATH') )
86
- define('ABSPATH', dirname(__FILE__) . '/wordpress/');
87
-
88
- define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST']);
89
- define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/wordpress');
90
- define('WP_CONTENT_DIR', realpath(ABSPATH . '../wp-content/'));
57
+ if (!defined('ABSPATH'))
58
+ define('ABSPATH', dirname(__FILE__) . '/wordpress');
59
+
60
+ if (php_sapi_name() == "cli") {
61
+ define('WP_HOME', 'http://localhost:8001');
62
+ } else {
63
+ define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST']);
64
+ }
65
+ define('WP_SITEURL', WP_HOME . '/wordpress');
66
+ define('WP_CONTENT_DIR', realpath(ABSPATH . '../wp-content'));
91
67
  define('WP_CONTENT_URL', WP_HOME . '/wp-content');
92
68
  //define('WP_TEMP_DIR', realpath(ABSPATH . '../../tmp/'));
69
+
93
70
  define('FS_METHOD', 'direct');
94
71
 
95
72
  define('FORCE_SSL_ADMIN', false);
data/base/wp-cli.yml ADDED
@@ -0,0 +1,8 @@
1
+ path: public/wordpress
2
+ url: http://localhost:8001
3
+ # Core is managed seperately by git, so disable core file commands
4
+ disabled_commands:
5
+ - core download
6
+ - core install
7
+ - core update
8
+ - config create
data/bin/wslave CHANGED
@@ -25,8 +25,8 @@ class WSlaveCLI < Thor
25
25
  option :wppath, default: '',
26
26
  desc: 'specify the path to a cloned git wordpress distribution, EG: "--wppath /shared/wordpress".
27
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,
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
30
  most wslave functionality will probably be broken.'
31
31
  def new(path = './')
32
32
  require_relative '../lib/wslave_new'
@@ -80,6 +80,18 @@ class WSlaveCLI < Thor
80
80
  require_relative '../lib/wslave_docker'
81
81
  WSlaveDocker.new().server(:remove, options['f'])
82
82
  end
83
+
84
+ desc 'log', "Starts tracing the log"
85
+ def log()
86
+ require_relative '../lib/wslave_docker'
87
+ WSlaveDocker.new().log()
88
+ end
89
+
90
+ desc 'console', "Opens a shell/console connection in the nweb container (container must be running)"
91
+ def console()
92
+ require_relative '../lib/wslave_docker'
93
+ WSlaveDocker.new().console()
94
+ end
83
95
  end
84
96
  desc 'server COMMAND [options]', "Control the development server container"
85
97
  subcommand 'server', Server
data/lib/wslave_docker.rb CHANGED
@@ -69,7 +69,7 @@ class WSlaveDocker
69
69
 
70
70
  def console()
71
71
  return unless _check()
72
- system("docker-compose exec web /bin/bash")
72
+ system("docker-compose exec nweb sh -c \"cd /var/www/html; exec /bin/bash\"")
73
73
  end
74
74
 
75
75
  def _check()
data/lib/wslave_tools.rb CHANGED
@@ -20,19 +20,26 @@ class WSlaveTools
20
20
 
21
21
  FileUtils.chown(nil, 'www-data', "#{path}/public/wp-content/themes")
22
22
  FileUtils.chmod(0775, "#{path}/public/wp-content/themes")
23
+ # NOTE: The following lines have been commented out and "replaced" with
24
+ # the above two, which grant blanket ownership to everything in
25
+ # wp-content. If there are no problems with this going forward,
26
+ # this note and the commented lines below should be deleted in a
27
+ # future update.
28
+ #FileUtils.chown(nil, 'www-data', "#{path}/public/wp-content/themes")
29
+ #FileUtils.chmod(0775, "#{path}/public/wp-content/themes")
23
30
 
24
- FileUtils.chown(nil, 'www-data', "#{path}/public/wp-content/uploads")
25
- FileUtils.chmod(0775, "#{path}/public/wp-content/uploads")
31
+ #FileUtils.chown(nil, 'www-data', "#{path}/public/wp-content/uploads")
32
+ #FileUtils.chmod(0775, "#{path}/public/wp-content/uploads")
26
33
 
27
- FileUtils.chown(nil, 'www-data', "#{path}/public/wp-content/plugins")
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
34
- FileUtils.chown(nil, 'www-data', "#{path}/public/wp-content/upgrade")
35
- FileUtils.chmod(0775, "#{path}/public/wp-content/upgrade")
34
+ #FileUtils.chown(nil, 'www-data', "#{path}/public/wp-content/plugins")
35
+ #FileUtils.chmod(0775, "#{path}/public/wp-content/plugins")
36
+ #
37
+ #unless Dir.exist?("#{path}/public/wp-content/upgrade")
38
+ # FileUtils.mkdir("#{path}/public/wp-content/upgrade")
39
+ # FileUtils.touch("#{path}/public/wp-content/upgrade/.gitkeep")
40
+ #end
41
+ #FileUtils.chown(nil, 'www-data', "#{path}/public/wp-content/upgrade")
42
+ #FileUtils.chmod(0775, "#{path}/public/wp-content/upgrade")
36
43
 
37
44
  unless Dir.exist?("#{path}/db")
38
45
  FileUtils.mkdir("#{path}/db")
@@ -68,10 +75,18 @@ class WSlaveTools
68
75
  FileUtils.chown(nil, 'www-data', "#{path}/db/production")
69
76
  FileUtils.chmod(0775, "#{path}/db/production")
70
77
 
71
- rescue Errno::EPERM
72
- puts "!!!WARNING!!! Your user does not belong to the www-data group!\n" \
78
+ # The main reason the exception will fire is becasue the user doesn't belong to the
79
+ # www-data group; but there's other reasons such as the file being somehow being
80
+ # owned by root or the system not even supporting permissions (like some
81
+ # installations of Windows?).
82
+ rescue Errno::EPERM => detail
83
+ puts "!!!WARNING!!! Unable to assign www-data group permissions! \n" \
73
84
  " >>> Unable to make folders writable for devlopment. <<<\n" \
74
85
  " >>> You will not be able to edit files or themes in the WP dev container! <<<\n"
86
+ " >>> NOTE: Check that your user belongs to the www-data group. <<<\n" \
87
+ " >>> NOTE: Check that the files in public/ are owned by *your* user. <<<\n"
88
+
89
+ print " >>>> Original error: " + detail.message
75
90
  end
76
91
  end
77
92
 
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.8'
3
+ s.version = '0.3.9'
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,7 +25,7 @@ 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.10', '1.10.2'
28
+ s.add_dependency 'git', '~> 1.11', '1.11.0'
29
29
 
30
30
  s.add_dependency 'thor', '~> 1.2', '1.2.1'
31
31
  s.add_dependency 'haikunator', '~> 1.1', '1.1.1'
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.8
4
+ version: 0.3.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rei Kagetsuki
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-04-27 00:00:00.000000000 Z
11
+ date: 2022-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -90,20 +90,20 @@ dependencies:
90
90
  requirements:
91
91
  - - "~>"
92
92
  - !ruby/object:Gem::Version
93
- version: '1.10'
93
+ version: '1.11'
94
94
  - - '='
95
95
  - !ruby/object:Gem::Version
96
- version: 1.10.2
96
+ version: 1.11.0
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.10'
103
+ version: '1.11'
104
104
  - - '='
105
105
  - !ruby/object:Gem::Version
106
- version: 1.10.2
106
+ version: 1.11.0
107
107
  - !ruby/object:Gem::Dependency
108
108
  name: thor
109
109
  requirement: !ruby/object:Gem::Requirement
@@ -173,8 +173,10 @@ files:
173
173
  - base/docker/nginx/nginx.vhost
174
174
  - base/docker/nginx/php.ini
175
175
  - base/docker/nginx/supervisord.conf
176
+ - base/docker/nginx/wp-cli.yml
176
177
  - base/public/.htaccess
177
178
  - base/public/wp-config.php
179
+ - base/wp-cli.yml
178
180
  - bin/wslave
179
181
  - lib/wslave_docker.rb
180
182
  - lib/wslave_new.rb