Más contenido relacionado La actualidad más candente (20) Similar a Taming AEM deployments (20) Más de Jakub Wadolowski (12) Taming AEM deployments1. APACHE SLING & FRIENDS TECH MEETUP
BERLIN, 25-27 SEPTEMBER 2017
Taming AEM deployments
Jakub Wądołowski, Cognifide
2. The road to efficient AEM delivery
2https://flic.kr/p/z8g25R
▪ Starts on your computer
▪ Ends in production
▪ Includes everything in between
6. What’s in the box?
6https://flic.kr/p/cMBbTu
▪ AEM Author & AEM Publish
▪ Preinstalled packages
▪ Dispatcher
▪ Solr Master & Slave
▪ knot.x
7. Vagrant in practice (1/3)
7
# Install prerequisites:
# * Vagrant
# * VirtualBox
# * ChefDK
$ git clone git@example.org:xyz/vagrant.git
$ cd project-vagrant
$ rake init
$ rake up
8. Vagrant in practice (2/3)
8
▪ http://localhost:4502 (AEM Author)
▪ http://localhost:4503 (AEM Publish)
▪ https://example.vagrant (Dispatcher)
▪ http://localhost:8983 (Solr)
▪ etc
9. Vagrant in practice (3/3)
9
$ rake provision:publish
...
Chef Client finished, 8/196 resources updated in 02
minutes 02 seconds
$ rake provision:httpd
...
Chef Client finished, 4/41 resources updated in 19
seconds
14. Use case (1/4)
14
▪ 17 Chef cookbook repos
▪ 2 CI related repos
▪ 3 config repos
▪ 4 app repos
▪ 2 infrastructure repos
https://flic.kr/p/bF3Nwm
15. Use case (2/4)
15
▪ Each repository has its own lifecycle
▪ Simple Git flow
https://flic.kr/p/peZfvA
16. Use case (3/4)
16
$ tree -L 1
.
├── aem
├── domain
├── knotx-autocomplete
├── knotx-download
├── knotx-filters
├── knotx-index
├── knotx-search
├── pom.xml
└── solr
8 directories, 1 file
https://flic.kr/p/fnPQuz
17. Use case (3/4)
17
$ tree -L 1
.
├── aem
├── domain
├── knotx-autocomplete
├── knotx-download
├── knotx-filters
├── knotx-index
├── knotx-search
├── pom.xml
└── solr
8 directories, 1 file
https://flic.kr/p/fnPQuz
18. Use case (3/4)
18
$ tree -L 1
.
├── aem
├── domain
├── knotx-autocomplete
├── knotx-download
├── knotx-filters
├── knotx-index
├── knotx-search
├── pom.xml
└── solr
8 directories, 1 file
https://flic.kr/p/fnPQuz
19. Use case (3/4)
19
$ tree -L 1
.
├── aem
├── domain
├── knotx-autocomplete
├── knotx-download
├── knotx-filters
├── knotx-index
├── knotx-search
├── solr
└── pom.xml
8 directories, 1 file
https://flic.kr/p/fnPQuz
20. Use case (3/4)
20
$ tree -L 1
.
├── aem
├── domain
├── knotx-autocomplete
├── knotx-download
├── knotx-filters
├── knotx-index
├── knotx-search
├── solr
└── pom.xml
8 directories, 1 file
https://flic.kr/p/fnPQuz
21. Use case (4/4)
21
▪ Compatibility matrix is no longer needed
▪ End-to-end testing
▪ One release contains multiple artifacts
23. 23
node('master') {
stage('Checkout') {
dir('app') {
git url: 'git://example.com/aem-project.git', branch: 'master'
}
dir('tests') {
git url: 'git://example.com/tests.git', branch: 'master'
}
}
stage('Build') {
node('aem') {
dir('app/aem') {
sh 'mvn clean install'
}
}
}
stage('Test') {
dir('tests') {
sh './gradlew clean contractTests'
}
}
}
24. 24
node('master') {
stage('Checkout') {
dir('app') {
git url: 'git://example.com/aem-project.git', branch: 'master'
}
dir('tests') {
git url: 'git://example.com/tests.git', branch: 'master'
}
}
stage('Build') {
node('aem') {
dir('app/aem') {
sh 'mvn clean install'
}
}
}
stage('Test') {
dir('tests') {
sh './gradlew clean contractTests'
}
}
}
25. 25
node('master') {
stage('Checkout') {
dir('app') {
git url: 'git://example.com/aem-project.git', branch: 'master'
}
dir('tests') {
git url: 'git://example.com/tests.git', branch: 'master'
}
}
stage('Build') {
node('aem') {
dir('app/aem') {
sh 'mvn clean install'
}
}
}
stage('Test') {
dir('tests') {
sh './gradlew clean contractTests'
}
}
}
26. 26
node('master') {
stage('Checkout') {
dir('app') {
git url: 'git://example.com/aem-project.git', branch: 'master'
}
dir('tests') {
git url: 'git://example.com/tests.git', branch: 'master'
}
}
stage('Build') {
node('aem') {
dir('app/aem') {
sh 'mvn clean install'
}
}
}
stage('Test') {
dir('tests') {
sh './gradlew clean contractTests'
}
}
}
48. Testing
48
▪ Unit tests
▪ Bobcat
▪ github.com/Cognifide/bobcat
▪ Zalenium & Docker
▪ github.com/zalando/zalenium
▪ AET
▪ github.com/Cognifide/aet
https://flic.kr/p/juzgT9
61. 61
cq_package 'Author: Core app' do
username 'admin'
password 'admin'
instance 'http://localhost:4502'
source 'https://artifacts.example.com/xyz/1.0/xyz-1.0.3-full.zip'
http_user 'basic_auth_user'
http_pass 'basic_auth_password'
action :deploy
end
62. 62
cq_package 'Author: Core app' do
username 'admin'
password 'admin'
instance 'http://localhost:4502'
source 'https://artifacts.example.com/xyz/1.0/xyz-1.0.3-full.zip'
http_user 'basic_auth_user'
http_pass 'basic_auth_password'
action :deploy
end
63. 63
cq_package 'Author: Core app' do
username 'admin'
password 'admin'
instance 'http://localhost:4502'
source 'https://artifacts.example.com/xyz/1.0/xyz-1.0.3-full.zip'
http_user 'basic_auth_user'
http_pass 'basic_auth_password'
action :deploy
end
64. 64
cq_package 'Author: Core app' do
username 'admin'
password 'admin'
instance 'http://localhost:4502'
source 'https://artifacts.example.com/xyz/1.0/xyz-1.0.3-full.zip'
http_user 'basic_auth_user'
http_pass 'basic_auth_password'
action :deploy
end
65. 65
cq_package 'Author: Core app' do
username node['cq']['author']['credentials']['login']
password node['cq']['author']['credentials']['password']
instance "http://localhost:#{node['cq']['author']['port']}"
source "https://artifacts.example.com/xyz/#{ver_dir}/"
"xyz-#{ver}-full.zip"
http_user node['xyz-webapp']['nexus']['user']
http_pass node['xyz-webapp']['nexus']['password']
action :deploy
end
66. 66
cq_package 'Author: Core app' do
username 'admin'
password 'admin'
instance 'http://localhost:4502'
source 'https://artifacts.example.com/xyz/1.0/xyz-1.0.3-full.zip'
http_user 'basic_auth_user'
http_pass 'basic_auth_password'
action :deploy
notifies :restart, 'service[cq62-author]', :immediately
end
service 'cq62-author' do
action :nothing
end
67. 67
cq_package 'Author: Core app' do
username 'admin'
password 'admin'
instance 'http://localhost:4502'
source 'https://artifacts.example.com/xyz/1.0/xyz-1.0.3-full.zip'
http_user 'basic_auth_user'
http_pass 'basic_auth_password'
action :deploy
notifies :restart, 'service[cq62-author]', :immediately
end
service 'cq62-author' do
action :nothing
end
68. 68
cq_package 'Author: Core app' do
username 'admin'
password 'admin'
instance 'http://localhost:4502'
source 'https://artifacts.example.com/xyz/1.0/xyz-1.0.3-full.zip'
http_user 'basic_auth_user'
http_pass 'basic_auth_password'
action :deploy
notifies :restart, 'service[cq62-author]', :immediately
end
service 'cq62-author' do
action :nothing
end
69. 69
cq_package 'Author: Core app' do
username 'admin'
password 'admin'
instance 'http://localhost:4502'
source 'https://artifacts.example.com/xyz/1.0/xyz-1.0.3-full.zip'
http_user 'basic_auth_user'
http_pass 'basic_auth_password'
action :deploy
notifies :restart, 'service[cq62-author]', :immediately
end
service 'cq62-author' do
action :nothing
end
74. 74
$ chef-client
# ...
Chef Client finished, 39/652 resources updated in 09 minutes 46 seconds
$ chef-client
# ...
Chef Client finished, 0/652 resources updated in 01 minutes 58 seconds
75. 75
$ chef-client
# ...
Chef Client finished, 39/652 resources updated in 09 minutes 46 seconds
$ chef-client
# ...
Chef Client finished, 0/652 resources updated in 01 minutes 58 seconds
76. 76
$ grep cq_package recipes/author*.rb | wc -l
70
$ grep cq_jcr recipes/author*.rb | wc -l
20
$ grep cq_package recipes/publish*.rb | wc -l
67
$ grep cq_jcr recipes/publish*.rb | wc -l
11
77. What’s currently available?
77
▪ cq_package
▪ cq_osgi_config
▪ cq_osgi_bundle
▪ cq_osgi_component
▪ cq_user
▪ cq_jcr
▪ groovy_script
▪ apm_script
▪ …
https://flic.kr/p/qhRjAF
82. 82
$ knife ssh
'chef_environment:xyz-prod AND tags:aem AND tags:author'
'sudo -u apache /bin/touch /path/to/maintenance/maintenance.lock'
83. 83
$ knife ssh
'chef_environment:xyz-prod AND tags:aem AND tags:author'
'sudo -u apache /bin/touch /path/to/maintenance/maintenance.lock'
84. 84
$ knife ssh
'chef_environment:xyz-prod AND tags:aem AND tags:author'
'sudo -u apache /bin/touch /path/to/maintenance/maintenance.lock'
86. 86
$ knife ssh
'chef_environment:xyz-prod AND tags:dispatcher AND tags:us-east-1a'
'sudo -u apache /bin/touch /path/to/maintenance/deployment.lock'
87. 87
$ knife ssh
'chef_environment:xyz-prod AND tags:dispatcher AND tags:us-east-1a'
'sudo -u apache /bin/touch /path/to/maintenance/deployment.lock'
88. 88
$ knife ssh
'chef_environment:xyz-prod AND tags:dispatcher AND tags:us-east-1a'
'sudo -u apache /bin/touch /path/to/maintenance/deployment.lock'
90. 90
$ knife ssh
'chef_environment:xyz-prod AND (
(tags:dispatcher AND tags:us-east-1a) OR
(tags:aem AND tags:publish AND tags:us-east-1a)
)'
'sudo /usr/bin/chef-client'
91. 91
$ knife ssh
'chef_environment:xyz-prod AND (
(tags:dispatcher AND tags:us-east-1a) OR
(tags:aem AND tags:publish AND tags:us-east-1a)
)'
'sudo /usr/bin/chef-client'
92. 92
$ knife ssh
'chef_environment:xyz-prod AND (
(tags:dispatcher AND tags:us-east-1a) OR
(tags:aem AND tags:publish AND tags:us-east-1a)
)'
'sudo /usr/bin/chef-client'
93. 93
$ knife ssh
'chef_environment:xyz-prod AND tags:dispatcher AND tags:us-east-1a'
'sudo -u apache /usr/bin/rm -f /path/to/maintenance/deployment.lock'