wslave 0.3.6 → 0.3.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/base/config/deploy/production.rb +20 -7
- data/base/config/deploy/staging.rb +17 -4
- data/base/config/deploy-tools/gen-wp-config.rb +2 -2
- data/base/config/deploy.rb +1 -1
- data/base/docker/apache/Dockerfile +1 -1
- data/base/docker/nginx/Dockerfile +32 -12
- data/base/docker/nginx/nginx.vhost +1 -1
- data/base/docker/nginx/php.ini +0 -874
- data/base/docker/nginx/supervisord.conf +1 -1
- data/base/docker/nginx/wp-cli.yml +9 -0
- data/base/docker-compose.yml +2 -0
- data/base/public/.htaccess +12 -17
- data/base/public/wp-config.php +18 -41
- data/base/wp-cli.yml +8 -0
- data/bin/wslave +14 -2
- data/lib/wslave_docker.rb +1 -1
- data/lib/wslave_tools.rb +28 -13
- data/templates/config/definitions.yml +4 -0
- data/wslave.gemspec +2 -2
- metadata +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae8f5b776137111cf2c79936a1f7bc17126fe3a884441865cf5fa8895305a9ee
|
4
|
+
data.tar.gz: 9a604e9920dd201fec828720230c61036d933ac17625824f8148590864038ee0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5cd61b1d6aed6bde6295cd27bc6d268373cb9e2a63ffc35dfaad03fb209395d209a95d45944f66eb24c588c508f546b944b2b6afb820f89fac5e960c0b36064c
|
7
|
+
data.tar.gz: 108c3f32c3fd2b2671889002f003a9c866e3a03f3757b75eac0863fad877bffbec35e660f7f31390e25a41d3a603b84b375022e4b9df2237f2f790b54acbd91d
|
@@ -2,8 +2,8 @@ require 'yaml'
|
|
2
2
|
require 'date'
|
3
3
|
require 'wslave_sage'
|
4
4
|
|
5
|
-
opts = YAML.load_file('config/definitions.yml')
|
6
|
-
db_info = YAML.load_file('config/database.yml')
|
5
|
+
opts = YAML.load_file('config/definitions.yml', aliases: true)
|
6
|
+
db_info = YAML.load_file('config/database.yml', aliases: true)
|
7
7
|
|
8
8
|
deploy_user = opts['deployer']['user']
|
9
9
|
deploy_group = opts['deployer']['www_data_group']
|
@@ -137,10 +137,10 @@ namespace :deploy do
|
|
137
137
|
end
|
138
138
|
end
|
139
139
|
|
140
|
-
desc 'Finds and replaces localhost:8000
|
140
|
+
desc 'Finds and replaces localhost:8000 / localhost:8001and your Staging address with the Production address'
|
141
141
|
task :chikan do
|
142
142
|
on roles(:web) do
|
143
|
-
puts 'Replacing localhost:8000 and
|
143
|
+
puts 'Replacing localhost:8000 / localhost:8001 and Staging URLs with Production URLs...'
|
144
144
|
|
145
145
|
# Set an anchor to first homogonize instances of URL's, then replace all the anchors
|
146
146
|
anchor = "URL_REPLACEMENT_ANCHOR_00000"
|
@@ -159,14 +159,16 @@ namespace :deploy do
|
|
159
159
|
# replace instances of it with something that won't match
|
160
160
|
db_data = db_data.gsub(/#{opts['deployer']['fqdn']['production']}/, anchor)
|
161
161
|
|
162
|
-
# Set
|
163
|
-
if opts['deployer']['fqdn']['
|
164
|
-
db_data = db_data.gsub(/#{opts['deployer']['fqdn']['
|
162
|
+
# Set production URL's to the anchor
|
163
|
+
if opts['deployer']['fqdn']['production'] != ''
|
164
|
+
db_data = db_data.gsub(/#{opts['deployer']['fqdn']['production']}/, anchor)
|
165
165
|
end
|
166
166
|
|
167
167
|
# Set localhost entries to the anchor
|
168
168
|
db_data = db_data.gsub(/localhost\%3A8000/, anchor)
|
169
169
|
db_data = db_data.gsub(/localhost:8000/, anchor)
|
170
|
+
db_data = db_data.gsub(/localhost\%3A8001/, anchor)
|
171
|
+
db_data = db_data.gsub(/localhost:8001/, anchor)
|
170
172
|
|
171
173
|
# Replace anchors with the correct target URL
|
172
174
|
db_data = db_data.gsub(anchor, "#{opts['deployer']['fqdn']['production']}")
|
@@ -197,6 +199,16 @@ namespace :deploy do
|
|
197
199
|
end
|
198
200
|
end
|
199
201
|
|
202
|
+
desc 'Creates an additional symlink at the path specified in definitions.yml to current/public'
|
203
|
+
task :set_symlink do
|
204
|
+
on roles(:web) do
|
205
|
+
puts 'Setting symlink'
|
206
|
+
if (opts['deployer'].include?('symlink') && opts['deployer']['symlink'].include?('production'))
|
207
|
+
execute "ln -s #{deploy_path}/current/public #{opts['deployer']['root']}/#{opts['deployer']['symlink']['production']}"
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
200
212
|
desc 'Perform special seed tasks required on intial seed'
|
201
213
|
task :initial do
|
202
214
|
on roles(:web) do
|
@@ -220,6 +232,7 @@ namespace :deploy do
|
|
220
232
|
invoke('deploy:chikan')
|
221
233
|
invoke('deploy:sage')
|
222
234
|
invoke('deploy:set_permissions')
|
235
|
+
invoke('deploy:set_symlink')
|
223
236
|
end
|
224
237
|
end
|
225
238
|
|
@@ -2,8 +2,8 @@ require 'yaml'
|
|
2
2
|
require 'date'
|
3
3
|
require 'wslave_sage'
|
4
4
|
|
5
|
-
opts = YAML.load_file('config/definitions.yml')
|
6
|
-
db_info = YAML.load_file('config/database.yml')
|
5
|
+
opts = YAML.load_file('config/definitions.yml', aliases: true)
|
6
|
+
db_info = YAML.load_file('config/database.yml', aliases: true)
|
7
7
|
|
8
8
|
deploy_user = opts['deployer']['user']
|
9
9
|
deploy_group = opts['deployer']['www_data_group']
|
@@ -137,10 +137,10 @@ namespace :deploy do
|
|
137
137
|
end
|
138
138
|
end
|
139
139
|
|
140
|
-
desc 'Finds and replaces localhost:8000 and your Production address with the Staging address'
|
140
|
+
desc 'Finds and replaces localhost:8000 / localhost:8001 and your Production address with the Staging address'
|
141
141
|
task :chikan do
|
142
142
|
on roles(:web) do
|
143
|
-
puts 'Replacing localhost:8000 and Production URLs with Staging URLs...'
|
143
|
+
puts 'Replacing localhost:8000 / localhost:8001 and Production URLs with Staging URLs...'
|
144
144
|
|
145
145
|
# Set an anchor to first homogonize instances of URL's, then replace all the anchors
|
146
146
|
anchor = "URL_REPLACEMENT_ANCHOR_00000"
|
@@ -167,6 +167,8 @@ namespace :deploy do
|
|
167
167
|
# Set localhost entries to the anchor
|
168
168
|
db_data = db_data.gsub(/localhost\%3A8000/, anchor)
|
169
169
|
db_data = db_data.gsub(/localhost:8000/, anchor)
|
170
|
+
db_data = db_data.gsub(/localhost\%3A8001/, anchor)
|
171
|
+
db_data = db_data.gsub(/localhost:8001/, anchor)
|
170
172
|
|
171
173
|
# Replace anchors with the correct target URL
|
172
174
|
db_data = db_data.gsub(anchor, "#{opts['deployer']['fqdn']['staging']}")
|
@@ -197,6 +199,16 @@ namespace :deploy do
|
|
197
199
|
end
|
198
200
|
end
|
199
201
|
|
202
|
+
desc 'Creates an additional symlink at the path specified in definitions.yml to current/public'
|
203
|
+
task :set_symlink do
|
204
|
+
on roles(:web) do
|
205
|
+
puts 'Setting symlink'
|
206
|
+
if (opts['deployer'].include?('symlink') && opts['deployer']['symlink'].include?('staging'))
|
207
|
+
execute "ln -s #{deploy_path}/current/public #{opts['deployer']['root']}/#{opts['deployer']['symlink']['staging']}"
|
208
|
+
end
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
200
212
|
desc 'Perform special seed tasks required on intial seed'
|
201
213
|
task :initial do
|
202
214
|
on roles(:web) do
|
@@ -220,6 +232,7 @@ namespace :deploy do
|
|
220
232
|
invoke('deploy:chikan')
|
221
233
|
invoke('deploy:sage')
|
222
234
|
invoke('deploy:set_permissions')
|
235
|
+
invoke('deploy:set_symlink')
|
223
236
|
end
|
224
237
|
end
|
225
238
|
|
@@ -8,8 +8,8 @@ def GenerateWPConfig(profile = 'production', out_path = './')
|
|
8
8
|
config_path = File.dirname(File.expand_path(File.dirname(__FILE__)))
|
9
9
|
vars = {}
|
10
10
|
vars[:profile] = profile.to_sym
|
11
|
-
vars[:db_info] = YAML.load_file("#{config_path}/database.yml")
|
12
|
-
vars[:salt] = YAML.load_file("#{config_path}/salts.yml")
|
11
|
+
vars[:db_info] = YAML.load_file("#{config_path}/database.yml", aliases: true)
|
12
|
+
vars[:salt] = YAML.load_file("#{config_path}/salts.yml", aliases: true)
|
13
13
|
|
14
14
|
erb_source = File.read("#{config_path}/deploy-tools/wp-config.php.erb")
|
15
15
|
rend = ERB.new(erb_source)
|
data/base/config/deploy.rb
CHANGED
@@ -1,27 +1,47 @@
|
|
1
|
-
FROM ubuntu:
|
1
|
+
FROM ubuntu:22.04
|
2
2
|
|
3
3
|
RUN apt-get update && apt-get dist-upgrade -y
|
4
4
|
RUN DEBIAN_FRONTEND="noninteractive" apt-get -y install tzdata
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
php7.4-json php7.4-imagick php7.4-xml php7.4-zip php7.4-iconv \
|
5
|
+
|
6
|
+
RUN apt-get install -y nginx php-fpm php-mysql \
|
7
|
+
php-mbstring php-curl php-dom \
|
8
|
+
php-imagick php-xml php-zip \
|
9
|
+
composer nodejs npm \
|
11
10
|
libpng-dev libjpeg-dev \
|
12
11
|
mariadb-client mariadb-common \
|
13
|
-
supervisor curl
|
12
|
+
supervisor curl less neovim emacs
|
14
13
|
RUN apt-get clean
|
15
|
-
|
14
|
+
|
16
15
|
RUN mkdir /db \
|
17
|
-
&& chmod 777 /db
|
16
|
+
&& chmod 777 /db
|
18
17
|
|
19
18
|
COPY nginx.vhost /etc/nginx/sites-enabled/default
|
20
19
|
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
21
|
-
|
20
|
+
|
21
|
+
# NOTE: When the PHP FPM version changes, you MUST change the
|
22
|
+
# version definition right below this comment, then you must
|
23
|
+
# rebuild the nweb image!
|
24
|
+
ARG PHP_FPM_VERSION=8.1
|
25
|
+
RUN mkdir -p /run/php
|
26
|
+
COPY php.ini /etc/php/$PHP_FPM_VERSION/fpm/php.ini
|
27
|
+
RUN ln -s /usr/sbin/php-fpm$PHP_FPM_VERSION /usr/sbin/php-fpm
|
28
|
+
RUN ln -s /run/php/php$PHP_FPM_VERSION-fpm.sock /run/php/php-fpm.sock
|
29
|
+
RUN ln -s /run/php/php$PHP_FPM_VERSION-fpm.pid /run/php/php-fpm.pid
|
30
|
+
|
31
|
+
RUN npm install yarn -g
|
32
|
+
|
33
|
+
# The lines below install wp-cli in the container. However, since
|
34
|
+
# wp-cli is run as root it causes various permission problems. In
|
35
|
+
# the future this may be re-added with some method of correcting
|
36
|
+
# permissions. Until then, please use wp-cli locally.
|
37
|
+
#RUN curl https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar -o /usr/local/bin/wp
|
38
|
+
#RUN chmod +x /usr/local/bin/wp
|
39
|
+
#RUN mkdir /root/.wp-cli
|
40
|
+
#COPY wp-cli.yml /root/.wp-cli/config.yml
|
41
|
+
#RUN echo 'alias wp="wp --allow-root"' >> /root/.bashrc
|
22
42
|
|
23
43
|
RUN ln -sf /dev/stdout /var/log/nginx/access.log \
|
24
|
-
|
44
|
+
&& ln -sf /dev/stderr /var/log/nginx/error.log
|
25
45
|
|
26
46
|
EXPOSE 80
|
27
47
|
|