capistrano-forkcms 1.0.2 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/README.md +17 -4
- data/capistrano-forkcms.gemspec +1 -0
- data/lib/capistrano/forkcms.rb +1 -0
- data/lib/capistrano/forkcms/defaults.rb +6 -1
- data/lib/capistrano/forkcms/version.rb +1 -1
- data/lib/capistrano/tasks/{forkcms.rake → configure.rake} +9 -0
- data/lib/capistrano/tasks/opcache.rake +40 -0
- data/lib/capistrano/tasks/symlink.rake +22 -0
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0adbc416fef6b18cf432dfa74924a7e36711eb52
|
4
|
+
data.tar.gz: 724dba6b24dfa9d04dd29bf665559103966881b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 294dc28ba5f80776698813de6918fca12d6ac2d84e6bafe7576c486909a8667c14cc89856dc1386e42ea7a33b3344d518f4595ffe7af200437085c5fd5d49b21
|
7
|
+
data.tar.gz: 43c71454a43298214d5b04effcd07ac4e30d0a9aa0617cc2c2374ee2306f69a1a501540c993471b68b2285a99608d50a59c268793dc5ee137b07da1111e2d130
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -27,6 +27,7 @@ Require the module in your Capfile:
|
|
27
27
|
The plugin comes with two tasks:
|
28
28
|
|
29
29
|
* `forkcms:configure:composer`, which will configure the `capistrano/composer` plugin.
|
30
|
+
* `forkcms:opcache:reset`, which will reset the opcache.
|
30
31
|
* `forkcms:symlink:document_root`, which will link the document_root to the current-folder.
|
31
32
|
|
32
33
|
But you won't need any of them as everything is wired automagically.
|
@@ -37,7 +38,11 @@ But you won't need any of them as everything is wired automagically.
|
|
37
38
|
Configuration options:
|
38
39
|
|
39
40
|
* `:php_bin_custom_path`, this will allow you to configure a custom PHP binary, the fallback is `php`.
|
40
|
-
|
41
|
+
* `:opcache_reset_strategy`, the reset strategy. Possible options: file, fcgi
|
42
|
+
* `opcache_reset_fcgi_connection_string`, the fcgi-connection string used for the [cachetool](http://gordalina.github.io/cachetool/).
|
43
|
+
required when `:opcache_reset_strategy` is `fcgi`.
|
44
|
+
* `opcache_reset_base_url`, the public url of your website. Required when `:opcache_reset_strategy` is `file`
|
45
|
+
|
41
46
|
|
42
47
|
## How to use with a fresh Fork install
|
43
48
|
|
@@ -78,10 +83,18 @@ set :keep_releases, 3
|
|
78
83
|
|
79
84
|
```
|
80
85
|
server "$your-server-hostname", user: "sites", roles: %w{app db web}
|
81
|
-
set :deploy_to, "$your-path-where-everything-should-be-deployed"
|
82
|
-
set :document_root, "$your-document-root"
|
86
|
+
set :deploy_to, "$your-path-where-everything-should-be-deployed" # eg: /home/johndoe/apps/website
|
87
|
+
set :document_root, "$your-document-root" # eg: /var/www
|
88
|
+
|
89
|
+
set :opcache_reset_strategy, "fcgi"
|
90
|
+
set :opcache_reset_fcgi_connection_string, "$your-php-fpm-socket-or-connection-string" # eg: /var/run/php_71_fpm_sites.sock
|
91
|
+
|
92
|
+
# or if you are not using FCGI/FPM
|
93
|
+
#set :opcache_reset_strategy, "file"
|
94
|
+
#set :opcache_reset_base_url, "$your-public-url" # eg: "http://www.fork-cms.com"
|
95
|
+
|
83
96
|
```
|
84
|
-
|
97
|
+
|
85
98
|
|
86
99
|
## Contributing
|
87
100
|
|
data/capistrano-forkcms.gemspec
CHANGED
data/lib/capistrano/forkcms.rb
CHANGED
@@ -8,15 +8,20 @@ set :linked_dirs, -> { ["app/logs", "app/sessions", "src/Frontend/Files"] }
|
|
8
8
|
# Run required tasks after the stage
|
9
9
|
Capistrano::DSL.stages.each do |stage|
|
10
10
|
after stage, "forkcms:configure:composer"
|
11
|
+
after stage, "forkcms:configure:cachetool"
|
11
12
|
end
|
12
13
|
|
13
14
|
|
14
15
|
# Make sure the composer executable is installed
|
15
16
|
namespace :deploy do
|
16
17
|
after :starting, "composer:install_executable"
|
18
|
+
after :starting, "cachetool:install_executable"
|
17
19
|
after :publishing, "forkcms:symlink:document_root"
|
20
|
+
after :publishing, "forkcms:opcache:reset"
|
18
21
|
end
|
19
22
|
|
20
23
|
|
21
24
|
# Load the tasks
|
22
|
-
load File.expand_path("../../tasks/
|
25
|
+
load File.expand_path("../../tasks/configure.rake", __FILE__)
|
26
|
+
load File.expand_path("../../tasks/opcache.rake", __FILE__)
|
27
|
+
load File.expand_path("../../tasks/symlink.rake", __FILE__)
|
@@ -11,6 +11,15 @@ namespace :forkcms do
|
|
11
11
|
# Set the correct bin
|
12
12
|
SSHKit.config.command_map[:composer] = "#{fetch :php_bin_path} #{fetch :deploy_to}/shared/composer.phar"
|
13
13
|
end
|
14
|
+
|
15
|
+
desc <<-DESC
|
16
|
+
Configures cachetool
|
17
|
+
It make sure the command is mapped correctly and the correct flags are used.
|
18
|
+
DESC
|
19
|
+
task :cachetool do
|
20
|
+
# Set the correct bin
|
21
|
+
SSHKit.config.command_map[:cachetool] = "#{fetch :php_bin_path} #{fetch :deploy_to}/shared/cachetool.phar"
|
22
|
+
end
|
14
23
|
end
|
15
24
|
|
16
25
|
namespace :symlink do
|
@@ -0,0 +1,40 @@
|
|
1
|
+
namespace :forkcms do
|
2
|
+
namespace :opcache do
|
3
|
+
desc <<-DESC
|
4
|
+
Reset the opcache
|
5
|
+
DESC
|
6
|
+
task :reset do
|
7
|
+
if fetch(:opcache_reset_strategy) === "file"
|
8
|
+
invoke "forkcms:opcache:reset_with_file"
|
9
|
+
elsif fetch(:opcache_reset_strategy) === "fcgi"
|
10
|
+
invoke "forkcms:opcache:reset_with_fcgi"
|
11
|
+
else
|
12
|
+
raise "Invalid value for :opcache_reset_strategy, possible values are: file, fcgi."
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
task :reset_with_file do
|
17
|
+
# make sure that we have all needed variables
|
18
|
+
raise "opcache_reset_base_url not set" unless fetch(:opcache_reset_base_url)
|
19
|
+
|
20
|
+
on roles(:web) do
|
21
|
+
stream = StringIO.new("<?php clearstatcache(true); if (function_exists('opcache_reset')) { opcache_reset(); }")
|
22
|
+
upload! stream, "#{current_path}/php-opcache-reset.php"
|
23
|
+
execute :curl, "-L --fail --silent --show-error", "#{fetch :opcache_reset_base_url}/php-opcache-reset.php"
|
24
|
+
execute :rm, "#{current_path}/php-opcache-reset.php"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
task :reset_with_fcgi do
|
29
|
+
# make sure that we have all needed variables
|
30
|
+
raise "opcache_reset_fcgi_connection_string not set" unless fetch(:opcache_reset_fcgi_connection_string)
|
31
|
+
|
32
|
+
invoke "cachetool:run", "opcache:reset", "--fcgi=#{fetch :opcache_reset_fcgi_connection_string}"
|
33
|
+
|
34
|
+
# reenable our command, see https://github.com/capistrano/capistrano/issues/1686 for more information
|
35
|
+
Rake::Task["cachetool:run"].reenable
|
36
|
+
|
37
|
+
invoke "cachetool:run", "stat:clear", "--fcgi=#{fetch :opcache_reset_fcgi_connection_string}"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
namespace :forkcms do
|
2
|
+
namespace :symlink do
|
3
|
+
desc <<-DESC
|
4
|
+
Links the document root to the current folder
|
5
|
+
The document root is the folder that the webserver will serve, it should link to the current path.
|
6
|
+
DESC
|
7
|
+
task :document_root do
|
8
|
+
on roles(:web) do
|
9
|
+
if test("[ -L #{fetch :document_root} ]") && capture("readlink -- #{fetch :document_root}") == "#{current_path}/"
|
10
|
+
# all is well, the symlink is correct
|
11
|
+
elsif test("[ -d #{fetch :document_root} ]") || test("[ -f #{fetch :document_root} ]")
|
12
|
+
error "Document root #{fetch :document_root} already exists."
|
13
|
+
error "To link it, issue the following command:"
|
14
|
+
error "ln -sf #{current_path}/ #{fetch :document_root}"
|
15
|
+
else
|
16
|
+
execute :mkdir, "-p", File.dirname(fetch(:document_root))
|
17
|
+
execute :ln, "-sf", "#{current_path}/", fetch(:document_root)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: capistrano-forkcms
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tijs Verkoyen
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 0.0.6
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: capistrano-cachetool
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: 1.0.0
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: 1.0.0
|
83
97
|
description: Capistrano ForkCMS - Easy deployment of ForkCMS 5+ apps with Ruby over
|
84
98
|
SSH
|
85
99
|
email:
|
@@ -100,7 +114,9 @@ files:
|
|
100
114
|
- lib/capistrano/forkcms.rb
|
101
115
|
- lib/capistrano/forkcms/defaults.rb
|
102
116
|
- lib/capistrano/forkcms/version.rb
|
103
|
-
- lib/capistrano/tasks/
|
117
|
+
- lib/capistrano/tasks/configure.rake
|
118
|
+
- lib/capistrano/tasks/opcache.rake
|
119
|
+
- lib/capistrano/tasks/symlink.rake
|
104
120
|
homepage: https://github.com/tijsverkoyen/capistrano-forkcms
|
105
121
|
licenses:
|
106
122
|
- MIT
|