dkdeploy-php 7.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +19 -0
- data/.rubocop.yml +22 -0
- data/.travis.yml +12 -0
- data/Berksfile +3 -0
- data/Berksfile.lock +61 -0
- data/CHANGELOG.md +11 -0
- data/CONTRIBUTORS.md +16 -0
- data/Gemfile +3 -0
- data/LICENSE +7 -0
- data/README.md +84 -0
- data/Rakefile +5 -0
- data/Vagrantfile +63 -0
- data/config/vm/cookbooks/dkdeploy-php/attributes/default.rb +1 -0
- data/config/vm/cookbooks/dkdeploy-php/metadata.rb +12 -0
- data/config/vm/cookbooks/dkdeploy-php/recipes/default.rb +77 -0
- data/config/vm/cookbooks/dkdeploy-php/templates/default/web_app.conf.erb +28 -0
- data/dkdeploy-php.gemspec +27 -0
- data/features/composer.feature +20 -0
- data/features/db.feature +84 -0
- data/features/php.feature +44 -0
- data/features/support/env.rb +14 -0
- data/features/support/path.rb +30 -0
- data/features/support/step_definitions/steps.rb +15 -0
- data/features/support/templates/empty-doctrine-migration.erb +20 -0
- data/lib/capistrano/dkdeploy/php.rb +25 -0
- data/lib/dkdeploy/php/helpers/db.rb +43 -0
- data/lib/dkdeploy/php/helpers/http.rb +60 -0
- data/lib/dkdeploy/php/i18n.rb +74 -0
- data/lib/dkdeploy/php/tasks/composer.rake +50 -0
- data/lib/dkdeploy/php/tasks/db.rake +121 -0
- data/lib/dkdeploy/php/tasks/php.rake +90 -0
- data/lib/dkdeploy/php/version.rb +15 -0
- data/spec/fixtures/application/Capfile +8 -0
- data/spec/fixtures/application/Gemfile +6 -0
- data/spec/fixtures/application/config/deploy.rb +8 -0
- data/spec/fixtures/application/config/deploy/dev.rb +40 -0
- data/spec/fixtures/application/config/migrations/cli-config.php.erb +23 -0
- data/spec/fixtures/application/config/migrations/migrations.yml.erb +4 -0
- data/spec/fixtures/application/htdocs/.hidden/.gitkeep +0 -0
- data/spec/fixtures/application/htdocs/composer.json +22 -0
- data/spec/fixtures/application/vendor/composer.phar +0 -0
- data/spec/fixtures/application/vendor/doctrine-migrations.phar +0 -0
- data/spec/fixtures/capistrano/configuration/server_with_faulty_domain_configuration.rb +2 -0
- data/spec/fixtures/capistrano/configuration/server_with_valid_domain.rb +2 -0
- data/vendor/apc_clear.php +14 -0
- data/vendor/opcache_reset.php +10 -0
- metadata +185 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6a8f99bb5b8677969ae183f2c5e56a2f9551fbd0
|
4
|
+
data.tar.gz: 8f2dc818873f8826c6698f7d46ee0b22e30519a3
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c1077a4daf35b6432aaff715202c383a6baf9c47b04e38e2379f085f497b11d6d1febf54ff9317e66b45d09be006334677f8b94e766f1f2c59c658ebc995a339
|
7
|
+
data.tar.gz: ae949b9b0f3f28401d145a314a70fdd1816f3b29efa347f5cd86f9c4e8b3d34ed8ffb3ea925a74e055f449df45958b70e4134252fb6c821ca032c062774057e0
|
data/.gitignore
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
AllCops:
|
2
|
+
Exclude:
|
3
|
+
- 'tmp/**/*'
|
4
|
+
- 'spec/fixtures/application/htdocs/stylesheets/**/config.rb'
|
5
|
+
- 'Vagrantfile'
|
6
|
+
- 'config/**/*'
|
7
|
+
GlobalVars:
|
8
|
+
AllowedVariables: []
|
9
|
+
MethodLength:
|
10
|
+
Max: 25
|
11
|
+
LineLength:
|
12
|
+
Max: 200
|
13
|
+
SpecialGlobalVars:
|
14
|
+
Enabled: false
|
15
|
+
BracesAroundHashParameters:
|
16
|
+
Enabled: false
|
17
|
+
CyclomaticComplexity:
|
18
|
+
Max: 10
|
19
|
+
Metrics/AbcSize:
|
20
|
+
Max: 30
|
21
|
+
Style/SignalException:
|
22
|
+
EnforcedStyle: only_raise
|
data/.travis.yml
ADDED
data/Berksfile
ADDED
data/Berksfile.lock
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
DEPENDENCIES
|
2
|
+
dkdeploy-php
|
3
|
+
path: config/vm/cookbooks/dkdeploy-php
|
4
|
+
|
5
|
+
GRAPH
|
6
|
+
apache2 (3.2.2)
|
7
|
+
apt (3.0.0)
|
8
|
+
build-essential (3.2.0)
|
9
|
+
seven_zip (>= 0.0.0)
|
10
|
+
chef-sugar (3.3.0)
|
11
|
+
chef_handler (1.3.0)
|
12
|
+
database (5.1.2)
|
13
|
+
postgresql (>= 1.0.0)
|
14
|
+
dkdeploy-php (1.0.0)
|
15
|
+
apache2 (~> 3.2)
|
16
|
+
apt (~> 3.0)
|
17
|
+
database (~> 5.1)
|
18
|
+
mysql (~> 6.1)
|
19
|
+
mysql2_chef_gem (~> 1.0)
|
20
|
+
php (~> 1.9)
|
21
|
+
iis (4.1.7)
|
22
|
+
windows (>= 1.34.6)
|
23
|
+
mariadb (0.3.1)
|
24
|
+
apt (>= 0.0.0)
|
25
|
+
yum (>= 0.0.0)
|
26
|
+
yum-epel (>= 0.0.0)
|
27
|
+
mysql (6.1.3)
|
28
|
+
smf (>= 0.0.0)
|
29
|
+
yum-mysql-community (>= 0.0.0)
|
30
|
+
mysql2_chef_gem (1.1.0)
|
31
|
+
build-essential (>= 0.0.0)
|
32
|
+
mariadb (>= 0.0.0)
|
33
|
+
mysql (>= 6.0)
|
34
|
+
openssl (4.4.0)
|
35
|
+
chef-sugar (>= 3.1.1)
|
36
|
+
php (1.9.0)
|
37
|
+
build-essential (>= 0.0.0)
|
38
|
+
iis (>= 0.0.0)
|
39
|
+
mysql (>= 6.0.0)
|
40
|
+
windows (>= 1.39.1)
|
41
|
+
xml (>= 0.0.0)
|
42
|
+
yum-epel (>= 0.0.0)
|
43
|
+
postgresql (4.0.6)
|
44
|
+
apt (>= 1.9.0)
|
45
|
+
build-essential (>= 0.0.0)
|
46
|
+
openssl (~> 4.0)
|
47
|
+
rbac (1.0.3)
|
48
|
+
seven_zip (2.0.0)
|
49
|
+
windows (>= 1.2.2)
|
50
|
+
smf (2.2.8)
|
51
|
+
rbac (>= 1.0.1)
|
52
|
+
windows (1.40.0)
|
53
|
+
chef_handler (>= 0.0.0)
|
54
|
+
xml (2.0.0)
|
55
|
+
build-essential (>= 0.0.0)
|
56
|
+
chef-sugar (>= 0.0.0)
|
57
|
+
yum (3.10.0)
|
58
|
+
yum-epel (0.7.0)
|
59
|
+
yum (>= 3.6.3)
|
60
|
+
yum-mysql-community (0.2.0)
|
61
|
+
yum (>= 3.2)
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# Changelog
|
2
|
+
All notable changes to this project will be documented in this file.
|
3
|
+
This project adheres to [Semantic Versioning](http://semver.org/).
|
4
|
+
|
5
|
+
## [7.0.0] - 2016-07-01
|
6
|
+
### Summary
|
7
|
+
|
8
|
+
- first public release
|
9
|
+
|
10
|
+
[Unreleased]: https://github.com/dkdeploy/dkdeploy-php/compare/master...develop
|
11
|
+
[7.0.0]: https://github.com/dkdeploy/dkdeploy-php/releases/tag/v7.0.0
|
data/CONTRIBUTORS.md
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# dkdeploy CONTRIBUTORS
|
2
|
+
|
3
|
+
The dkdeploy core maintainers would like to recognize following contributors (in alphabetic order):
|
4
|
+
|
5
|
+
- Sascha Egerer
|
6
|
+
- Christoph Gerold
|
7
|
+
- Johannes Goslar
|
8
|
+
- Kieran Hayes
|
9
|
+
- Wilfried Irßlinger
|
10
|
+
- Thomas Jahnke
|
11
|
+
- Gleb Levitin
|
12
|
+
- Luka Lüdicke
|
13
|
+
- Nicolai Reuschling
|
14
|
+
- Lars Tode
|
15
|
+
- Timo Webler
|
16
|
+
- Mike Zaschka
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
Copyright (c) 2014-2016 dkd Internet Service GmbH, Frankfurt am Main (Germany), https://dkd.de/
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
|
+
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
6
|
+
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# Dkdeploy::Php
|
2
|
+
|
3
|
+
[![Build Status](https://api.travis-ci.org/dkdeploy/dkdeploy-php.svg?branch=develop)](https://travis-ci.org/repositories/dkdeploy/dkdeploy-php)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/dkdeploy-php.svg)](https://badge.fury.io/rb/dkdeploy-php) [![Inline docs](http://inch-ci.org/github/dkdeploy/dkdeploy-php.svg?branch=develop)](http://inch-ci.org/github/dkdeploy/dkdeploy-php)
|
5
|
+
|
6
|
+
## Description
|
7
|
+
|
8
|
+
This Rubygem `dkdeploy-php` ruby gem represents the extension of [Capistrano](http://capistranorb.com/) tasks directed to the advanced deployment process.
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Add this line to your application's `Gemfile`
|
13
|
+
|
14
|
+
gem 'dkdeploy-php', '~> 7.0'
|
15
|
+
|
16
|
+
and then execute
|
17
|
+
|
18
|
+
bundle install
|
19
|
+
|
20
|
+
or install it yourself as
|
21
|
+
|
22
|
+
gem install dkdeploy-php
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
Run in your project root
|
27
|
+
|
28
|
+
cap install STAGES='dev,integration,testing,production'
|
29
|
+
|
30
|
+
This command will create the following Capistrano file structure with all the standard pre-configured constants.
|
31
|
+
Please be aware of the difference to the [native installation](http://capistranorb.com/documentation/getting-started/preparing-your-application/) of Capistrano.
|
32
|
+
Certainly you have to adjust `config/deploy.rb` and respective stages and customize them for your needs.
|
33
|
+
|
34
|
+
<pre>
|
35
|
+
├── Capfile
|
36
|
+
└── config
|
37
|
+
├── deploy
|
38
|
+
│ ├── dev.rb
|
39
|
+
│ ├── integration.rb
|
40
|
+
│ ├── testing.rb
|
41
|
+
│ └── production.rb
|
42
|
+
└── deploy.rb
|
43
|
+
</pre>
|
44
|
+
|
45
|
+
As next you have to append the following line to the `Capfile` in order to make use of dkdeploy extensions in addition to the standard Capistrano tasks:
|
46
|
+
|
47
|
+
require 'capistrano/dkdeploy/php'
|
48
|
+
|
49
|
+
To convince yourself, that Capistrano tasks list has been extended, please run
|
50
|
+
|
51
|
+
cap -T
|
52
|
+
|
53
|
+
Please note, that dkdeploy uses the local copy strategy and overwrites the `:scm` constant. If you want to use it,
|
54
|
+
you should do nothing more. However if you want to change it for example to `:git`, please add the following line to `deploy.rb`
|
55
|
+
|
56
|
+
set :scm, :git
|
57
|
+
|
58
|
+
For more information about available Capistrano constants please use the [Capistrano documentation](http://capistranorb.com/documentation/getting-started/preparing-your-application/).
|
59
|
+
The complete list of the dkdeploy-php constants you find in `/lib/capistrano/dkdeploy/php.rb`.
|
60
|
+
|
61
|
+
## Testing
|
62
|
+
|
63
|
+
### Prerequisite
|
64
|
+
|
65
|
+
Vagrant `landrush` plugin is needed. If there are issues, make sure that the following IPv4 address is used for this domain
|
66
|
+
|
67
|
+
192.168.156.181 dkdeploy-php.dev
|
68
|
+
|
69
|
+
### Running tests
|
70
|
+
|
71
|
+
1. Starting the local box (`vagrant up --provision`)
|
72
|
+
2. Checking coding styles (`rubocop`)
|
73
|
+
3. Running BDD cucumber tests (`cucumber`)
|
74
|
+
|
75
|
+
## Contributing
|
76
|
+
|
77
|
+
1. Install [git flow](https://github.com/nvie/gitflow)
|
78
|
+
2. If project is not checked out already do git clone `git@github.com:dkdeploy/dkdeploy-php.git`
|
79
|
+
3. Checkout origin develop branch (`git checkout --track -b develop origin/develop`)
|
80
|
+
4. Git flow initialze `git flow init -d`
|
81
|
+
5. Installing gems `bundle install`
|
82
|
+
6. Create new feature branch (`git flow feature start my-new-feature`)
|
83
|
+
7. Run tests (README.md Testing)
|
84
|
+
8. Commit your changes (`git commit -am 'Add some feature'`)
|
data/Rakefile
ADDED
data/Vagrantfile
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
unless Vagrant.has_plugin?('vagrant-berkshelf')
|
2
|
+
puts "Please install vagrant plugin vagrant-berkshelfs first\n"
|
3
|
+
puts " vagrant plugin install vagrant-berkshelf\n\n"
|
4
|
+
puts "Exit vagrant\n\n"
|
5
|
+
abort
|
6
|
+
end
|
7
|
+
|
8
|
+
unless Vagrant.has_plugin?('vagrant-omnibus')
|
9
|
+
puts "Please install vagrant plugin vagrant-omnibus first\n"
|
10
|
+
puts " vagrant plugin install vagrant-omnibus\n\n"
|
11
|
+
puts "Exit vagrant\n\n"
|
12
|
+
abort
|
13
|
+
end
|
14
|
+
|
15
|
+
Vagrant.require_version '>= 1.8.1'
|
16
|
+
chef_version = '12.9.41'
|
17
|
+
|
18
|
+
Vagrant.configure('2') do |config|
|
19
|
+
domain = 'dkdeploy-php.dev'
|
20
|
+
domain_second = 'second-dkdeploy-php.dev'
|
21
|
+
ip_address = '192.168.156.181'
|
22
|
+
|
23
|
+
config.vm.box = 'ubuntu/trusty64'
|
24
|
+
config.vm.box_check_update = false
|
25
|
+
config.berkshelf.enabled = true
|
26
|
+
config.omnibus.chef_version = chef_version
|
27
|
+
|
28
|
+
config.vm.define('dkdeploy-php', primary: true) do |master_config|
|
29
|
+
master_config.vm.network 'private_network', ip: ip_address
|
30
|
+
|
31
|
+
# Chef settings
|
32
|
+
master_config.vm.provision :chef_solo do |chef|
|
33
|
+
chef.version = chef_version
|
34
|
+
chef.install = false # omnibus does it already
|
35
|
+
chef.log_level = :info
|
36
|
+
chef.add_recipe 'dkdeploy-php'
|
37
|
+
chef.json = {}
|
38
|
+
end
|
39
|
+
|
40
|
+
# Memory limit and name of VirtualBox
|
41
|
+
master_config.vm.provider 'virtualbox' do |virtualbox|
|
42
|
+
virtualbox.name = domain
|
43
|
+
virtualbox.gui = ENV['ENABLE_GUI_MODE'] && (ENV['ENABLE_GUI_MODE'] =~ /^(true|yes|y|1)$/i ? true : false)
|
44
|
+
virtualbox.customize [
|
45
|
+
'modifyvm', :id,
|
46
|
+
'--natdnsproxy1', 'off',
|
47
|
+
'--natdnshostresolver1', 'on',
|
48
|
+
'--memory', '1024',
|
49
|
+
'--name', 'dkdeploy-php'
|
50
|
+
]
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
if Vagrant.has_plugin?('landrush')
|
55
|
+
config.landrush.enabled = true
|
56
|
+
config.landrush.guest_redirect_dns = false
|
57
|
+
config.landrush.tld = 'dev'
|
58
|
+
config.landrush.host domain, ip_address
|
59
|
+
config.landrush.host domain_second, ip_address
|
60
|
+
else
|
61
|
+
config.vm.post_up_message = "Either install Vagrant plugin 'landrush' or add this entry to your host file: #{ip_address} #{domain} #{domain_second}"
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
default['apache']['mpm'] = 'prefork'
|
@@ -0,0 +1,12 @@
|
|
1
|
+
name 'dkdeploy-php'
|
2
|
+
maintainer 'dkd Internet Service GmbH'
|
3
|
+
license 'MIT'
|
4
|
+
description 'Project cookbook'
|
5
|
+
version '1.0'
|
6
|
+
|
7
|
+
depends 'mysql', '~> 6.1'
|
8
|
+
depends 'mysql2_chef_gem', '~> 1.0'
|
9
|
+
depends 'database', '~> 5.1'
|
10
|
+
depends 'apache2', '~> 3.2'
|
11
|
+
depends 'php', '~> 1.9'
|
12
|
+
depends 'apt', '~> 3.0'
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# update apt packages
|
2
|
+
include_recipe 'apt'
|
3
|
+
|
4
|
+
# Create unix user for tests
|
5
|
+
user 'test-user' do
|
6
|
+
action :create
|
7
|
+
end
|
8
|
+
|
9
|
+
group 'test-group' do
|
10
|
+
action :create
|
11
|
+
append true
|
12
|
+
members 'test-user'
|
13
|
+
end
|
14
|
+
|
15
|
+
group 'www-data' do
|
16
|
+
action :create
|
17
|
+
append true
|
18
|
+
members 'vagrant'
|
19
|
+
end
|
20
|
+
|
21
|
+
# PHP
|
22
|
+
include_recipe 'php'
|
23
|
+
include_recipe 'php::module_mysql'
|
24
|
+
|
25
|
+
mysql_service 'default' do
|
26
|
+
port '3306'
|
27
|
+
# Need for remote connection
|
28
|
+
bind_address '0.0.0.0'
|
29
|
+
action [:create, :start]
|
30
|
+
end
|
31
|
+
|
32
|
+
mysql2_chef_gem 'default' do
|
33
|
+
action :install
|
34
|
+
end
|
35
|
+
|
36
|
+
mysql_connection_info = {
|
37
|
+
:host => '127.0.0.1',
|
38
|
+
:username => 'root',
|
39
|
+
:password => 'ilikerandompasswords'
|
40
|
+
}
|
41
|
+
|
42
|
+
mysql_database_user 'root' do
|
43
|
+
connection mysql_connection_info
|
44
|
+
host '%'
|
45
|
+
password 'ilikerandompasswords'
|
46
|
+
action :create
|
47
|
+
privileges [:all]
|
48
|
+
action :grant
|
49
|
+
end
|
50
|
+
|
51
|
+
mysql_database 'dkdeploy_php' do
|
52
|
+
connection mysql_connection_info
|
53
|
+
action :create
|
54
|
+
end
|
55
|
+
|
56
|
+
# Apache
|
57
|
+
include_recipe 'apache2'
|
58
|
+
include_recipe 'apache2::mod_php5'
|
59
|
+
|
60
|
+
# install apache2-utils. It is needed for the assets:add_htpasswd task
|
61
|
+
package 'apache2-utils' do
|
62
|
+
action :install
|
63
|
+
end
|
64
|
+
|
65
|
+
web_app 'dkdeploy-php.dev' do
|
66
|
+
server_name 'dkdeploy-php.dev'
|
67
|
+
server_aliases ['second-dkdeploy-php.dev']
|
68
|
+
docroot '/var/www/dkdeploy/current/'
|
69
|
+
template 'web_app.conf.erb'
|
70
|
+
end
|
71
|
+
|
72
|
+
directory '/var/www/' do
|
73
|
+
owner 'vagrant' # deployment is done by vagrant user
|
74
|
+
group 'www-data' # apache2 is executed by www-data and needs access to directory
|
75
|
+
mode '0770'
|
76
|
+
action :create
|
77
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
<VirtualHost *:80>
|
2
|
+
ServerName <%= @params[:server_name] %>
|
3
|
+
ServerAlias <%= @params[:server_aliases].join(' ') %>
|
4
|
+
DocumentRoot <%= @params[:docroot] %>
|
5
|
+
RewriteEngine On
|
6
|
+
|
7
|
+
<Directory <%= @params[:docroot] %>>
|
8
|
+
Options FollowSymLinks
|
9
|
+
AllowOverride None
|
10
|
+
Require all granted
|
11
|
+
</Directory>
|
12
|
+
|
13
|
+
<Directory />
|
14
|
+
Options FollowSymLinks
|
15
|
+
AllowOverride None
|
16
|
+
</Directory>
|
17
|
+
|
18
|
+
LogLevel info
|
19
|
+
ErrorLog <%= node[:apache][:log_dir] %>/<%= @params[:name] %>-error.log
|
20
|
+
CustomLog <%= node[:apache][:log_dir] %>/<%= @params[:name] %>-access.log combined
|
21
|
+
|
22
|
+
RewriteEngine On
|
23
|
+
LogLevel info rewrite:trace2 alias:debug
|
24
|
+
|
25
|
+
# Deactivate php realpath cache
|
26
|
+
php_admin_value realpath_cache_ttl 0
|
27
|
+
php_admin_value realpath_cache_size 0k
|
28
|
+
</VirtualHost>
|