olympus-hestia-capistrano 0.0.9
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 +7 -0
- data/CHANGELOG.md +22 -0
- data/LICENSE +21 -0
- data/README.md +119 -0
- data/lib/capistrano/olympus-hestia.rb +19 -0
- data/lib/capistrano/tasks/database.rake +48 -0
- data/lib/capistrano/tasks/deploy.rake +107 -0
- data/lib/capistrano/tasks/directories.rake +34 -0
- data/lib/capistrano/tasks/files.rake +72 -0
- data/lib/capistrano/vars/defaults.rb +51 -0
- data/lib/olympus-hestia.rb +0 -0
- data/olympus-hestia-capistrano.gemspec +41 -0
- metadata +118 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: cc3b0115668175ba46ced78bd4f6017e2ff5f96c88ac36378f3b7ba6a937af87
|
|
4
|
+
data.tar.gz: 178e537f15cf3619392bda6459e68dff1d0a36b8ea6caf1a14bcd59386badd65
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 3da938c42743b12161b8324f63da192bfb8fd7a4645fb8fa024bb44646f8947b53a272e35d51c3e1cd28ed39f97a0ea61579e359b9212f6daa9b3e3f0e957307
|
|
7
|
+
data.tar.gz: 77218b8959715771686d71878c96f2b8b6a2d5f72f8c8d7fe2fc498133960b5d1d7e5ffb46edbd8539c7dcc312f9a1e502a8f4bdf1656948925b14f00fa1b169
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
## v0.0.8 (May 14, 2016)
|
|
2
|
+
|
|
3
|
+
## v0.0.7 (April 11, 2016)
|
|
4
|
+
|
|
5
|
+
## v0.0.6 (April 03, 2016)
|
|
6
|
+
Use our own Composer task.
|
|
7
|
+
|
|
8
|
+
## v0.0.5 (April 01, 2016)
|
|
9
|
+
Remove all servers actions.
|
|
10
|
+
|
|
11
|
+
## v0.0.4 (April 01, 2016)
|
|
12
|
+
Required gem included.
|
|
13
|
+
|
|
14
|
+
## v0.0.3 (April 01, 2016)
|
|
15
|
+
Fix path to olympus.rb file.
|
|
16
|
+
|
|
17
|
+
## v0.0.2 (April 01, 2016)
|
|
18
|
+
Remove common.php upload file, make salt.php upload or auto-generated file. Uses now colorize gem.
|
|
19
|
+
This is not a joke! :)
|
|
20
|
+
|
|
21
|
+
## v0.0.1 (March 31, 2016)
|
|
22
|
+
**INITIAL RELEASE**
|
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (C) 2016, Achraf Chouk - achrafchouk@gmail.com
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# Olympus Hestia Capistrano [![RubyGem Version][gem-image]][gem-url]
|
|
2
|
+
> **Olympus Hestia Capistrano** is a Ruby gem which provides a complete solution for deploying **WordPress** website easily with the **Olympus** package.
|
|
3
|
+
|
|
4
|
+
[![Olympus Component][olympus-image]][olympus-url]
|
|
5
|
+
[![Capistrano 3][capistrano-image]][capistrano-url]
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
+ Remote server automation tool with [**Capistrano**](http://capistranorb.com/)
|
|
10
|
+
+ Best gem dependencies with `capistrano-file-permissions` and `colorize`
|
|
11
|
+
+ Database update and [**wp-cli**](https://wp-cli.org/) integration
|
|
12
|
+
+ Tasks ready for **pagespeed**, **web servers** and **varnish**
|
|
13
|
+
+ And more...
|
|
14
|
+
|
|
15
|
+
## Requirements
|
|
16
|
+
|
|
17
|
+
+ [**colorize**](https://github.com/fazibear/colorize)
|
|
18
|
+
+ [**composer**](https://github.com/capistrano/composer)
|
|
19
|
+
+ [**file-permissions**](https://github.com/capistrano/file-permissions)
|
|
20
|
+
|
|
21
|
+
## Initialization
|
|
22
|
+
|
|
23
|
+
All default settings are defined in the `lib/capistrano/vars/defaults.rb` file. Please, refer to it to see exactly how the defaults are set up.
|
|
24
|
+
If you want to override any setting, just set it on your `app/deploy/config.rb` file.
|
|
25
|
+
|
|
26
|
+
```ruby
|
|
27
|
+
# [optional] Setup files and dirs to symlink, setup web user to chown
|
|
28
|
+
set :files, fetch(:files, ['app/config/env.php', 'app/config/salt.php', 'web/.htaccess', 'web/robots.txt'])
|
|
29
|
+
set :dirs, fetch(:dirs, ['web/statics/languages', 'web/statics/plugins', 'web/statics/uploads'])
|
|
30
|
+
set :stage_user, fetch(:stage_user, 'www-data')
|
|
31
|
+
|
|
32
|
+
# Setup Capistrano
|
|
33
|
+
set :log_level, fetch(:log_level, :debug)
|
|
34
|
+
set :keep_releases, fetch(:keep_releases, 3)
|
|
35
|
+
|
|
36
|
+
# Setup Project
|
|
37
|
+
set :application, fetch(:application, 'olympus-capified')
|
|
38
|
+
set :localurl, fetch(:localurl, 'http://www.domain.tld')
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Installation
|
|
42
|
+
|
|
43
|
+
You can easily install the **Olympus Hestia Capistrano** gem simply:
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
# In your Capfile
|
|
47
|
+
require 'capistrano/olympus'
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
# In your Gemfile
|
|
52
|
+
gem 'capistrano', '~> 3.4'
|
|
53
|
+
gem 'olympus-hestia-capistrano', '~> 0.0.8'
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Full example
|
|
57
|
+
|
|
58
|
+
Depending on your stage files, you can deploy simply thanks to the following command line:
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
bundle exec cap production deploy
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Contributing
|
|
65
|
+
|
|
66
|
+
1. Fork it (<https://github.com/GetOlympus/Hestia-Capistrano/fork>)
|
|
67
|
+
2. Create your feature branch (`git checkout -b feature/fooBar`)
|
|
68
|
+
3. Commit your changes (`git commit -am 'Add some fooBar'`)
|
|
69
|
+
4. Push to the branch (`git push origin feature/fooBar`)
|
|
70
|
+
5. Create a new Pull Request
|
|
71
|
+
|
|
72
|
+
## Publishing
|
|
73
|
+
|
|
74
|
+
To publish a new `gem` file, follow these steps:
|
|
75
|
+
|
|
76
|
+
```sh
|
|
77
|
+
gem build olympus-hestia-capistrano.gemspec
|
|
78
|
+
gem push olympus-hestia-capistrano-x.x.x.gem
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Release History
|
|
82
|
+
|
|
83
|
+
* 0.0.9 (December 31, 2019)
|
|
84
|
+
- [x] ADD: change capistrano gem file
|
|
85
|
+
- [x] ADD: contributors file
|
|
86
|
+
|
|
87
|
+
* 0.0.8 (May 14, 2016)
|
|
88
|
+
- [x] ADD: add steps to build new gem file
|
|
89
|
+
|
|
90
|
+
* 0.0.7 (April 11, 2016)
|
|
91
|
+
- [x] ADD: update tasks, create linked_files and linked_dirs in the right way, create symlinks, and more
|
|
92
|
+
|
|
93
|
+
## Authors and Copyright
|
|
94
|
+
|
|
95
|
+
Achraf Chouk
|
|
96
|
+
[![@crewstyle][twitter-image]][twitter-url]
|
|
97
|
+
|
|
98
|
+
Please, read [LICENSE][license-blob] for more information.
|
|
99
|
+
[![MIT][license-image]][license-url]
|
|
100
|
+
|
|
101
|
+
[https://github.com/crewstyle](https://github.com/crewstyle)
|
|
102
|
+
[http://fr.linkedin.com/in/achrafchouk](http://fr.linkedin.com/in/achrafchouk)
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
**Built with ♥ by [Achraf Chouk](http://github.com/crewstyle "Achraf Chouk") ~ (c) since a long time.**
|
|
107
|
+
|
|
108
|
+
<!-- links & imgs dfn's -->
|
|
109
|
+
[olympus-image]: https://img.shields.io/badge/for-Olympus-44cc11.svg?style=flat-square
|
|
110
|
+
[olympus-url]: https://github.com/GetOlympus
|
|
111
|
+
[capistrano-image]: https://img.shields.io/badge/Capistrano-3-52C1DB.svg?style=flat-square
|
|
112
|
+
[capistrano-url]: https://github.com/capistrano/capistrano
|
|
113
|
+
[gem-image]: https://img.shields.io/gem/v/capistrano-olympus.svg?style=flat-square
|
|
114
|
+
[gem-url]: https://rubygems.org/gems/capistrano-olympus
|
|
115
|
+
[license-blob]: https://github.com/GetOlympus/Hestia-Capistrano/blob/master/LICENSE
|
|
116
|
+
[license-image]: https://img.shields.io/badge/license-MIT_License-blue.svg?style=flat-square
|
|
117
|
+
[license-url]: http://opensource.org/licenses/MIT
|
|
118
|
+
[twitter-image]: https://img.shields.io/badge/crewstyle-blue.svg?style=social&logo=twitter
|
|
119
|
+
[twitter-url]: http://twitter.com/crewstyle
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
require 'capistrano/composer'
|
|
2
|
+
require 'capistrano/file-permissions'
|
|
3
|
+
require 'colorize'
|
|
4
|
+
|
|
5
|
+
# Core tasks for deploying Olympus package with WordPress and composer
|
|
6
|
+
load File.expand_path("../tasks/deploy.rake", __FILE__)
|
|
7
|
+
load File.expand_path("../tasks/database.rake", __FILE__)
|
|
8
|
+
load File.expand_path("../tasks/directories.rake", __FILE__)
|
|
9
|
+
load File.expand_path("../tasks/files.rake", __FILE__)
|
|
10
|
+
|
|
11
|
+
# Load defaults variables
|
|
12
|
+
namespace :load do
|
|
13
|
+
|
|
14
|
+
desc "Include defaults vars"
|
|
15
|
+
task :defaults do
|
|
16
|
+
load "capistrano/vars/defaults.rb"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
end
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Database
|
|
2
|
+
namespace :database do
|
|
3
|
+
|
|
4
|
+
desc "Create WordPress database"
|
|
5
|
+
task :do_actions do
|
|
6
|
+
on release_roles(:all) do
|
|
7
|
+
|
|
8
|
+
# Create database
|
|
9
|
+
puts " "
|
|
10
|
+
puts "> Create database.sql file".colorize(:light_blue)
|
|
11
|
+
|
|
12
|
+
io = StringIO.new("CREATE DATABASE IF NOT EXISTS `#{fetch(:database_name)}`;")
|
|
13
|
+
upload! io, File.join(shared_path, "database.sql")
|
|
14
|
+
|
|
15
|
+
execute :chmod, "644 #{shared_path}/database.sql"
|
|
16
|
+
execute :mysql, "-u #{fetch(:database_user)} -p#{fetch(:database_pass)} -h #{fetch(:database_host)} < #{shared_path}/database.sql"
|
|
17
|
+
execute :rm, "#{shared_path}/database.sql"
|
|
18
|
+
|
|
19
|
+
puts "end :database:do_actions".colorize(:light_blue)
|
|
20
|
+
puts " "
|
|
21
|
+
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
desc "Install WordPress CMS"
|
|
26
|
+
task :wp_cli do
|
|
27
|
+
on release_roles(:all) do
|
|
28
|
+
|
|
29
|
+
# Execute WordPress SQL requests
|
|
30
|
+
puts " "
|
|
31
|
+
puts "> Execute wp-cli commands to install WordPress SQL requests".colorize(:light_blue)
|
|
32
|
+
|
|
33
|
+
execute "#{fetch(:sudo)} mkdir -p #{shared_path}/tmp/wpcli"
|
|
34
|
+
execute "#{fetch(:sudo)} wp core download --path=#{shared_path}/tmp/wpcli --force"
|
|
35
|
+
|
|
36
|
+
puts "Execute wp-cli command to generate wp-config.php file".colorize(:light_blue)
|
|
37
|
+
execute "#{fetch(:sudo)} wp core config --path=#{shared_path}/tmp/wpcli --dbname=#{fetch(:database_name)} --dbuser=#{fetch(:database_user)} --dbpass=#{fetch(:database_pass)}"
|
|
38
|
+
|
|
39
|
+
execute "#{fetch(:sudo)} wp core install --path=#{shared_path}/tmp/wpcli --url=#{fetch(:localurl)} --title=#{fetch(:application)} --admin_user=#{fetch(:wordpress_name)} --admin_password=#{fetch(:wordpress_pass)} --admin_email=#{fetch(:wordpress_mail)}"
|
|
40
|
+
execute "#{fetch(:sudo)} rm -rf #{shared_path}/tmp"
|
|
41
|
+
|
|
42
|
+
puts "end :database:wp_cli".colorize(:light_blue)
|
|
43
|
+
puts " "
|
|
44
|
+
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
end
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
module Capistrano
|
|
2
|
+
class FileNotFound < StandardError
|
|
3
|
+
end
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
# Deploy
|
|
7
|
+
namespace :deploy do
|
|
8
|
+
|
|
9
|
+
task :message_start do
|
|
10
|
+
puts " "
|
|
11
|
+
puts " Start deploy ".colorize(:color => :black, :background => :green)
|
|
12
|
+
puts " "
|
|
13
|
+
end
|
|
14
|
+
task :message_finish do
|
|
15
|
+
puts " "
|
|
16
|
+
puts " Finish deploy ".colorize(:color => :black, :background => :green)
|
|
17
|
+
puts " "
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
desc "Initialize folders"
|
|
21
|
+
task :init_folders do
|
|
22
|
+
on release_roles(:all) do
|
|
23
|
+
|
|
24
|
+
puts " "
|
|
25
|
+
puts "> Running deploy:init_folders task".colorize(:color => :light_green, :mode => :bold, :mode => :underline)
|
|
26
|
+
|
|
27
|
+
# Linked dirs
|
|
28
|
+
# Check the very last action made: it means all setup processes are done!
|
|
29
|
+
if test "[ ! -f \"#{shared_path}/web/robots.txt\" ]"
|
|
30
|
+
invoke "directories:do_actions"
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
desc "Initialize files and database"
|
|
37
|
+
task :init_files do
|
|
38
|
+
on release_roles(:all) do
|
|
39
|
+
|
|
40
|
+
puts " "
|
|
41
|
+
puts "> Running deploy:init_files task".colorize(:color => :light_green, :mode => :bold)
|
|
42
|
+
|
|
43
|
+
# Linked files
|
|
44
|
+
# Check the very last action made: it means all setup processes are done!
|
|
45
|
+
if test "[ ! -f \"#{shared_path}/web/robots.txt\" ]"
|
|
46
|
+
invoke "files:before_action"
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
desc "Initialize files, database, composer, and all"
|
|
53
|
+
task :init_all do
|
|
54
|
+
on release_roles(:all) do
|
|
55
|
+
|
|
56
|
+
puts " "
|
|
57
|
+
puts "Running deploy:init_all task".colorize(:color => :light_green, :mode => :bold)
|
|
58
|
+
puts " "
|
|
59
|
+
|
|
60
|
+
# Check the very last action made: it means all setup processes are done!
|
|
61
|
+
if test "[ -f \"#{shared_path}/.tmp\" -o ! -f \"#{shared_path}/web/robots.txt\" ]"
|
|
62
|
+
# Composer install
|
|
63
|
+
invoke "composer:install"
|
|
64
|
+
|
|
65
|
+
# Linked files
|
|
66
|
+
invoke "files:after_action"
|
|
67
|
+
|
|
68
|
+
# Create database
|
|
69
|
+
invoke "database:do_actions"
|
|
70
|
+
|
|
71
|
+
# Install WP
|
|
72
|
+
invoke "database:wp_cli"
|
|
73
|
+
else
|
|
74
|
+
# Composer install
|
|
75
|
+
invoke "composer:install"
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
desc "Restart services and clear caches"
|
|
82
|
+
task :clear_caches do
|
|
83
|
+
on release_roles(:all) do
|
|
84
|
+
|
|
85
|
+
puts " "
|
|
86
|
+
puts "Running deploy:clear_caches task".colorize(:color => :light_green, :mode => :bold)
|
|
87
|
+
puts " "
|
|
88
|
+
|
|
89
|
+
#Do nothing for now...
|
|
90
|
+
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# Messages
|
|
95
|
+
before 'deploy:starting', 'deploy:message_start'
|
|
96
|
+
after 'deploy:finished', 'deploy:message_finish'
|
|
97
|
+
|
|
98
|
+
# Initialize
|
|
99
|
+
before 'deploy:starting', 'deploy:init_folders'
|
|
100
|
+
before 'deploy:check', 'deploy:init_files'
|
|
101
|
+
after 'deploy:updating', 'deploy:init_all'
|
|
102
|
+
|
|
103
|
+
# Restart services and clear caches
|
|
104
|
+
before 'deploy:updated', 'deploy:set_permissions:acl'
|
|
105
|
+
after 'deploy:publishing', 'deploy:clear_caches'
|
|
106
|
+
|
|
107
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Directories
|
|
2
|
+
namespace :directories do
|
|
3
|
+
|
|
4
|
+
desc "Creates directories"
|
|
5
|
+
task :do_actions do
|
|
6
|
+
on release_roles(:all) do
|
|
7
|
+
|
|
8
|
+
# Create app/config folder
|
|
9
|
+
if test "[ ! -d \"#{shared_path}/app/config\" ]"
|
|
10
|
+
puts " "
|
|
11
|
+
puts "> Create app/config folder".colorize(:light_blue)
|
|
12
|
+
execute "#{fetch(:sudo)} mkdir -p #{shared_path}/app/config"
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Create all linked dirs
|
|
16
|
+
fetch(:linked_dirs).each do |folder|
|
|
17
|
+
if test "[ ! -d \"#{shared_path}/#{folder}\" ]"
|
|
18
|
+
puts " "
|
|
19
|
+
puts "> Create #{folder} folder".colorize(:light_blue)
|
|
20
|
+
execute "#{fetch(:sudo)} mkdir -p #{shared_path}/#{folder}"
|
|
21
|
+
|
|
22
|
+
if test "[ -d \"#{release_path}/#{folder}\" ]"
|
|
23
|
+
execute "#{fetch(:sudo)} rm -rf #{release_path}/#{folder}"
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
puts "end :directories".colorize(:light_blue)
|
|
29
|
+
puts " "
|
|
30
|
+
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
end
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Files
|
|
2
|
+
namespace :files do
|
|
3
|
+
|
|
4
|
+
desc "Create shared files"
|
|
5
|
+
task :before_action do
|
|
6
|
+
on release_roles(:all) do
|
|
7
|
+
|
|
8
|
+
# Create temporary (fake) files for symlinks
|
|
9
|
+
fetch(:linked_files).each do |file|
|
|
10
|
+
puts " "
|
|
11
|
+
puts "> Create #{file} temporary file".colorize(:light_black)
|
|
12
|
+
|
|
13
|
+
execute :touch, "#{shared_path}/#{file}"
|
|
14
|
+
execute :chmod, "644 #{shared_path}/#{file}"
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
# Special case
|
|
18
|
+
puts " "
|
|
19
|
+
puts "> Create .tmp temporary file".colorize(:light_black)
|
|
20
|
+
|
|
21
|
+
execute :touch, "#{shared_path}/.tmp"
|
|
22
|
+
execute :chmod, "644 #{shared_path}/.tmp"
|
|
23
|
+
|
|
24
|
+
puts "end :files:before_action".colorize(:light_blue)
|
|
25
|
+
puts " "
|
|
26
|
+
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
desc "Create useful files"
|
|
31
|
+
task :after_action do
|
|
32
|
+
on release_roles(:all) do
|
|
33
|
+
|
|
34
|
+
# Special case
|
|
35
|
+
if test "[ -f \"#{shared_path}/.tmp\" ]"
|
|
36
|
+
puts " "
|
|
37
|
+
puts "> Remove .tmp temporary file".colorize(:light_black)
|
|
38
|
+
|
|
39
|
+
execute :rm, "#{shared_path}/.tmp"
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Create .htaccess file
|
|
43
|
+
puts " "
|
|
44
|
+
puts "> Copy .htaccess file".colorize(:light_blue)
|
|
45
|
+
|
|
46
|
+
execute :cp, "#{release_path}/web/.htaccess.dist", "#{release_path}/web/.htaccess"
|
|
47
|
+
execute :chmod, "644 #{release_path}/web/.htaccess"
|
|
48
|
+
|
|
49
|
+
# Create robots.txt file
|
|
50
|
+
if fetch(:stage) == :staging then
|
|
51
|
+
puts " "
|
|
52
|
+
puts "> Copy robots.txt file for production environment with '#{fetch(:stage_url)}' url".colorize(:light_blue)
|
|
53
|
+
|
|
54
|
+
execute :cp, "#{release_path}/web/robots.txt.dist", "#{release_path}/web/robots.txt"
|
|
55
|
+
execute :chmod, "644 #{release_path}/web/robots.txt"
|
|
56
|
+
execute :sed, "-i 's|http://www.domain.tld|#{fetch(:stage_url)}|g' #{release_path}/web/robots.txt"
|
|
57
|
+
else
|
|
58
|
+
puts " "
|
|
59
|
+
puts "> Create robots.txt file for staging environment".colorize(:light_blue)
|
|
60
|
+
|
|
61
|
+
execute :cp, "#{release_path}/web/robots.txt.dist", "#{release_path}/web/robots.txt"
|
|
62
|
+
execute "echo \"User-agent: *\\nDisallow: /\\n\" > #{release_path}/web/robots.txt"
|
|
63
|
+
execute :chmod, "644 #{release_path}/web/robots.txt"
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
puts "end :files:after_action".colorize(:light_blue)
|
|
67
|
+
puts " "
|
|
68
|
+
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
end
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# ~~~~
|
|
2
|
+
|
|
3
|
+
set :files, fetch(:files, ['app/config/env.php', 'app/config/salt.php', 'web/.htaccess', 'web/robots.txt'])
|
|
4
|
+
set :dirs, fetch(:dirs, ['web/statics/languages', 'web/statics/plugins', 'web/statics/uploads'])
|
|
5
|
+
set :stage_user, fetch(:stage_user, 'www-data')
|
|
6
|
+
|
|
7
|
+
# ~~~~
|
|
8
|
+
|
|
9
|
+
# Setup Git
|
|
10
|
+
set :repo_url, 'git@github.com:GetOlympus/Olympus.git'
|
|
11
|
+
set :scm, :git
|
|
12
|
+
set :git_enable_submodules, true
|
|
13
|
+
|
|
14
|
+
# Setup SSH
|
|
15
|
+
set :copy_exclude, ['.DS_Store', '.git', '.gitignore', '.gitmodules']
|
|
16
|
+
set :use_sudo, false
|
|
17
|
+
set :sudo, "sudo -u #{fetch(:stage_user)} -i --"
|
|
18
|
+
set :ssh_options, {
|
|
19
|
+
forward_agent: true
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
# ~~~~
|
|
23
|
+
|
|
24
|
+
# Setup Composer
|
|
25
|
+
set :composer_flags, '--no-dev --prefer-dist --optimize-autoloader'
|
|
26
|
+
set :composer_install_flags, :composer_flags
|
|
27
|
+
|
|
28
|
+
# ~~~~
|
|
29
|
+
|
|
30
|
+
# Setup File permissions
|
|
31
|
+
set :file_permissions_paths, :files + :dirs
|
|
32
|
+
set :file_permissions_users, [:stage_user]
|
|
33
|
+
|
|
34
|
+
# ~~~~
|
|
35
|
+
|
|
36
|
+
# Setup Symlinks
|
|
37
|
+
set :linked_files, :files
|
|
38
|
+
set :linked_dirs, :dirs
|
|
39
|
+
|
|
40
|
+
# ~~~~
|
|
41
|
+
|
|
42
|
+
# Setup Database
|
|
43
|
+
set :database_host, ask("Enter the database hostname:".colorize(:magenta), 'localhost')
|
|
44
|
+
set :database_name, ask("Enter the database name:".colorize(:magenta), 'database_name_here')
|
|
45
|
+
set :database_user, ask("Enter the database user:".colorize(:magenta), 'username_here')
|
|
46
|
+
set :database_pass, ask("Enter the database password:".colorize(:magenta), 'password_here', echo: false)
|
|
47
|
+
|
|
48
|
+
# Setup WordPress
|
|
49
|
+
set :wordpress_name, ask("Enter the admin username:".colorize(:magenta), 'admin')
|
|
50
|
+
set :wordpress_mail, ask("Enter the admin email address:".colorize(:magenta), 'admin@domain.tld')
|
|
51
|
+
set :wordpress_pass, ask("Enter the admin password:".colorize(:magenta), 'password', echo: false)
|
|
File without changes
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
|
|
5
|
+
# Specifications
|
|
6
|
+
Gem::Specification.new do |gem|
|
|
7
|
+
gem.name = 'olympus-hestia-capistrano'
|
|
8
|
+
gem.version = '0.0.9'
|
|
9
|
+
gem.date = Time.now.strftime("%Y-%m-%d")
|
|
10
|
+
gem.authors = ['Achraf Chouk']
|
|
11
|
+
gem.email = ['achrafchouk@gmail.com']
|
|
12
|
+
gem.description = 'Olympus Hestia Capistrano is a Capistrano bundle tasks for deploying WordPress website easily with the Olympus package.'
|
|
13
|
+
gem.summary = 'Ruby gem which provides a complete solution for deploying WordPress website with the Olympus package.'
|
|
14
|
+
gem.homepage = 'https://github.com/GetOlympus/Hestia-Capistrano'
|
|
15
|
+
gem.license = 'MIT'
|
|
16
|
+
|
|
17
|
+
gem.files = [
|
|
18
|
+
'CHANGELOG.md',
|
|
19
|
+
'LICENSE',
|
|
20
|
+
'README.md',
|
|
21
|
+
'olympus-hestia-capistrano.gemspec',
|
|
22
|
+
'lib/olympus-hestia.rb',
|
|
23
|
+
'lib/capistrano/olympus-hestia.rb',
|
|
24
|
+
'lib/capistrano/tasks/database.rake',
|
|
25
|
+
'lib/capistrano/tasks/deploy.rake',
|
|
26
|
+
'lib/capistrano/tasks/directories.rake',
|
|
27
|
+
'lib/capistrano/tasks/files.rake',
|
|
28
|
+
'lib/capistrano/vars/defaults.rb',
|
|
29
|
+
]
|
|
30
|
+
gem.executables = gem.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
|
31
|
+
|
|
32
|
+
# no tests as of yet
|
|
33
|
+
#gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
|
34
|
+
|
|
35
|
+
gem.require_paths = ['lib']
|
|
36
|
+
|
|
37
|
+
gem.add_dependency 'capistrano', '~> 3.4'
|
|
38
|
+
gem.add_dependency 'capistrano-composer', '~> 0.0.3'
|
|
39
|
+
gem.add_dependency 'colorize', '~> 0.7.7'
|
|
40
|
+
gem.add_runtime_dependency 'capistrano-file-permissions', '~> 1.0', '>= 1.0.0'
|
|
41
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: olympus-hestia-capistrano
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.9
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Achraf Chouk
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2020-01-01 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: capistrano
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '3.4'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '3.4'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: capistrano-composer
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: 0.0.3
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: 0.0.3
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: colorize
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: 0.7.7
|
|
48
|
+
type: :runtime
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: 0.7.7
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: capistrano-file-permissions
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - ">="
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: 1.0.0
|
|
62
|
+
- - "~>"
|
|
63
|
+
- !ruby/object:Gem::Version
|
|
64
|
+
version: '1.0'
|
|
65
|
+
type: :runtime
|
|
66
|
+
prerelease: false
|
|
67
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
68
|
+
requirements:
|
|
69
|
+
- - ">="
|
|
70
|
+
- !ruby/object:Gem::Version
|
|
71
|
+
version: 1.0.0
|
|
72
|
+
- - "~>"
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: '1.0'
|
|
75
|
+
description: Olympus Hestia Capistrano is a Capistrano bundle tasks for deploying
|
|
76
|
+
WordPress website easily with the Olympus package.
|
|
77
|
+
email:
|
|
78
|
+
- achrafchouk@gmail.com
|
|
79
|
+
executables: []
|
|
80
|
+
extensions: []
|
|
81
|
+
extra_rdoc_files: []
|
|
82
|
+
files:
|
|
83
|
+
- CHANGELOG.md
|
|
84
|
+
- LICENSE
|
|
85
|
+
- README.md
|
|
86
|
+
- lib/capistrano/olympus-hestia.rb
|
|
87
|
+
- lib/capistrano/tasks/database.rake
|
|
88
|
+
- lib/capistrano/tasks/deploy.rake
|
|
89
|
+
- lib/capistrano/tasks/directories.rake
|
|
90
|
+
- lib/capistrano/tasks/files.rake
|
|
91
|
+
- lib/capistrano/vars/defaults.rb
|
|
92
|
+
- lib/olympus-hestia.rb
|
|
93
|
+
- olympus-hestia-capistrano.gemspec
|
|
94
|
+
homepage: https://github.com/GetOlympus/Hestia-Capistrano
|
|
95
|
+
licenses:
|
|
96
|
+
- MIT
|
|
97
|
+
metadata: {}
|
|
98
|
+
post_install_message:
|
|
99
|
+
rdoc_options: []
|
|
100
|
+
require_paths:
|
|
101
|
+
- lib
|
|
102
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
103
|
+
requirements:
|
|
104
|
+
- - ">="
|
|
105
|
+
- !ruby/object:Gem::Version
|
|
106
|
+
version: '0'
|
|
107
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
|
+
requirements:
|
|
109
|
+
- - ">="
|
|
110
|
+
- !ruby/object:Gem::Version
|
|
111
|
+
version: '0'
|
|
112
|
+
requirements: []
|
|
113
|
+
rubygems_version: 3.0.3
|
|
114
|
+
signing_key:
|
|
115
|
+
specification_version: 4
|
|
116
|
+
summary: Ruby gem which provides a complete solution for deploying WordPress website
|
|
117
|
+
with the Olympus package.
|
|
118
|
+
test_files: []
|