Welcome!

Apache Authors: Pat Romanski, Liz McMillan, Elizabeth White, Christopher Harrold, Janakiram MSV

Related Topics: @DevOpsSummit, Microservices Expo, @CloudExpo, Apache

@DevOpsSummit: Blog Post

XL Deploy and Puppet By @BMoussaud | @DevOpsSummit [#DevOps]

Puppet and XL Deploy can work together if we put each of them in their domain

XL Deploy and Puppet
By Benoit Moussaud

Puppet and XL Deploy can work together if we put each of them in their domain:

  • Puppet manages the provisioning by ensuring the OS and the middleware is correctly configured : This node should have a Tomcat 7.0.42 instance running using a tomcat user and listening en the 8080 port
  • XLD manages the application deployment that takes 2 inputs: a deployment package built by CI tools (Jenkins / TFS) and a environment built by a provisioning tools, e.g. Puppet !

The integration between the two solutions is handled by a module provided by XebiaLabs that will ensure the containers are correctly defined in the XL Deloy repository based on the information managed by Puppet. It uses the REST API offered by the XL Deploy server: so the security permissions are checked as a operator could do it using the GUI or the CLI.

This article shows you how use the xebialabs/xldeploy Puppet module.

The Production environment is based on 2 tomcats instances (tomcat1 & tomcat2) and a MySql database (dbprod) This information is configured in site.pp file: three modules are used xld-base, xld-tomcat, xld-mysql.

node 'tomcat1','tomcat2' {
$environment = "PuppetDemo"
include java
include xld-base
include xld-tomcat
}

node 'dbprod' {
$environment = "PuppetDemo"
include xld-base
include xld-mysql
}

XLD-Base module
This module manages the configuration of the node itself : it is a simple class

xldeploy_ci { "Infrastructure/$environment":
type => 'core.Directory',
rest_url => $xldeploy_url
}

xldeploy_ci { "Environments/$environment":
type => 'core.Directory',
rest_url => $xldeploy_url
}

xldeploy_ci { "Infrastructure/$environment/$fqdn":
type => "overthere.SshHost",
rest_url => $xldeploy_url,
properties => {
os => UNIX,
address => $ipaddress_eth1,
username => vagrant,
password => vagrant,
connectionType => INTERACTIVE_SUDO,
sudoUsername => $sudo_username,
stagingDirectoryPath => $staging_directory_path
},
}

xldeploy_ci {"Environments/$environment/App-$environment":
type => 'udm.Environment',
properties => { },
rest_url => $xldeploy_url
}

The xldeploy_ci resources used here will ensure:

    Infrastructure/$environment and Environments/$environment
  • the overthere ssh host is configured in the repository with the Infrastructure/$environment/$fqdn ID : the fully qualified domain name ($fqdn) and the IP address $ipaddress_eth1 are provided by the Puppet facts. The other parameters ($sudo_username, $staging_directory_path) are provided by the Hiera database.
  • the target environment Environments/$environment/App-$environment is created.

the $rest_url parameters is provided by the hiera configuration, it includes the address, the port, the credentianl and the context of the XL Deploy server. The value used here is : http://admin:[email protected]:4516/deployit

XLD-Tomcat module
This module manages the tomcat configuration and the information that need to be configured in XL Deploy.

The first part of the class is the configuration of the tomcat instance

include java

class { 'tomcat':
version => '7',
sources => true,
sources_src => 'file:/vagrant/tomcat'
}

tomcat::instance { 'appserver':
ensure => present,
server_port => $tomcat_port_mgt,
http_port => $tomcat_port_http,
ajp_port => $tomcat_port_ajp,
}

Then the configuration for XL Deploy repository:

xldeploy_ci { "Infrastructure/$environment/$fqdn/appserver-$hostname":
type => 'tomcat.Server',
properties => {
stopCommand => '/etc/init.d/tomcat-appserver stop',
startCommand => 'nohup /etc/init.d/tomcat-appserver start',
home => '/srv/tomcat/appserver',
stopWaitTime => 0,
startWaitTime => 10,
deploymentGroup => "$deployment_group",
},
rest_url => $xldeploy_url
}

xldeploy_ci { "Infrastructure/$environment/$fqdn/appserver-$hostname/$hostname.vh":
type => 'tomcat.VirtualHost',
properties => {
deploymentGroup => "$deployment_group",
},
rest_url => $xldeploy_url
}

The two xldeploy_ci resources configure the ‘tomcat.Server’ and the associated ‘tomcat.VirtualHost’ Configuration items. They share the same deployment group ($deployment_group) The ‘autorequire’ feature has been implements so it is not necessary to define explicitly ‘require’ between the 2 resources.

The module offers to define dictionaries, to populate them with values managed by Puppet (ex tomcat.http.port or environment name) and to associate them to environments.

xldeploy_ci { "Environments/$environment/$fqdn.dict":
type => "udm.Dictionary",
properties => {
entries => {
"log.RootLevel" => "ERROR",
"log.FilePath" => "/tmp/null",
"tomcat.port" => "$tomcat_port_http",
"tests2.ExecutedHttpRequestTest.url" => "http://localhost:{{tomcat.port}}/petclinic/index.jsp",
"tomcat.DataSource.username" => "scott",
"tomcat.DataSource.password" => "tiger",
"TITLE" => "$environment",
"tomcat.DataSource.driverClassName" => "com.mysql.jdbc.Driver",
"tomcat.DataSource.url" => "jdbc:mysql://localhost/{{tomcat.DataSource.context}}",
"tomcat.DataSource.context" => "petclinic",
"tests2.ExecutedHttpRequestTest.expectedResponseText" => "Home",
},
restrictToContainers => ["Infrastructure/$environment/$fqdn/appserver-$hostname/$hostname.vh", "Infrastructure/$environment/$fqdn/test-runner-$hostname", "Infrastructure/$environment/$fqdn/appserver-$hostname"],
},
rest_url => $xldeploy_url,
require => [Xldeploy_ci["Infrastructure/$environment/$fqdn/appserver-$hostname/$hostname.vh"],
Xldeploy_ci[ "Infrastructure/$environment/$fqdn/test-runner-$hostname"],
Xldeploy_ci["Infrastructure/$environment/$fqdn/appserver-$hostname"]],
}

Finally we gather all these containers and the dictionaries in the target enviroment:

xldeploy_environment_member { "Manage Tomcat members of Environments/$environment/App-$environment":
env => "Environments/$environment/App-$environment",
members => ["Infrastructure/$environment/$fqdn/appserver-$hostname/$hostname.vh", "Infrastructure/$environment/$fqdn/test-runner-$hostname", "Infrastructure/$environment/$fqdn/appserver-$hostname"],
dictionaries => ["Environments/$environment/$fqdn.dict"],
rest_url => $xldeploy_url,
}

Find the complete manifest here: https://github.com/xebialabs-community/xl-deploy-puppet-sample/blob/master/puppet/modules/xld-tomcat/manifests/init.pp

XLD-MySQL module
This module is designed as the previous one: one section to configure the database instance, the other to configure it in XL Deploy. Note the same parameters ($dbuser, $dbpasword and $dbname) are used to configure the database, the SqlContainer and the dictionary for the tomcat datasource. If the security team decides to change it, it’ve been defined in a single location and the information can be propagated to the node and the deployed application.

mysql::db { "$dbname":
user => $dbuser,
password => $dbpassword,
host => '%',
grant => ['all'],
}


xldeploy_ci { "Infrastructure/$environment/$fqdn/mysql-$dbname":
type => 'sql.MySqlClient',
properties => {
username => "$dbuser",
password => "$dbpassword",
databaseName => "$dbname",
mySqlHome => '/usr',
deploymentGroup => "1",
},
rest_url => $xldeploy_url,
}

xldeploy_ci { "Environments/$environment/App-db-$environment":
rest_url => $xldeploy_url,
type => 'udm.Dictionary',
properties => {
entries => {
'db.username' => "$dbuser",
'db.password' => "$dbpassword",
'db.name' => "$dbname",
'db.host' => "$ipaddress_eth1",
'db.url' => "jdbc:mysql://{{db.host}}:3306/{{db.name}}",
}},
}

Find the complete manifest file here: https://github.com/xebialabs-community/xl-deploy-puppet-sample/blob/master/puppet/modules/xld-mysql/manifests/init.pp)

The xl-deploy-puppet-module can manage roles, permission… check out the module documentation for the other features.

Wrap up
The integration between XL Deploy and Puppet applies the separation of concern principle, the one manages the provisioning, the other managed the application deployment and application configuration. The 2 solutions are model based : you describe the target and not the how to reach the target.

You can find all the described manifest files and the whole project based on Vagrant here: https://github.com/xeblialabs-community/xl-deploy-puppet-sample

The post XL Deploy & Puppet appeared first on XebiaLabs.

Read the original blog entry...

More Stories By XebiaLabs Blog

XebiaLabs is the technology leader for automation software for DevOps and Continuous Delivery. It focuses on helping companies accelerate the delivery of new software in the most efficient manner. Its products are simple to use, quick to implement, and provide robust enterprise technology.

@ThingsExpo Stories
SYS-CON Events announced today that Mobile Create USA will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Mobile Create USA Inc. is an MVNO-based business model that uses portable communication devices and cellular-based infrastructure in the development, sales, operation and mobile communications systems incorporating GPS capabi...
While some developers care passionately about how data centers and clouds are architected, for most, it is only the end result that matters. To the majority of companies, technology exists to solve a business problem, and only delivers value when it is solving that problem. 2017 brings the mainstream adoption of containers for production workloads. In his session at 21st Cloud Expo, Ben McCormack, VP of Operations at Evernote, will discuss how data centers of the future will be managed, how th...
There is huge complexity in implementing a successful digital business that requires efficient on-premise and cloud back-end infrastructure, IT and Internet of Things (IoT) data, analytics, Machine Learning, Artificial Intelligence (AI) and Digital Applications. In the data center alone, there are physical and virtual infrastructures, multiple operating systems, multiple applications and new and emerging business and technological paradigms such as cloud computing and XaaS. And then there are pe...
SYS-CON Events announced today that MIRAI Inc. will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. MIRAI Inc. are IT consultants from the public sector whose mission is to solve social issues by technology and innovation and to create a meaningful future for people.
SYS-CON Events announced today that Keisoku Research Consultant Co. will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Keisoku Research Consultant, Co. offers research and consulting in a wide range of civil engineering-related fields from information construction to preservation of cultural properties. For more information, vi...
SYS-CON Events announced today that Massive Networks, that helps your business operate seamlessly with fast, reliable, and secure internet and network solutions, has been named "Exhibitor" of SYS-CON's 21st International Cloud Expo ®, which will take place on Oct 31 - Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. As a premier telecommunications provider, Massive Networks is headquartered out of Louisville, Colorado. With years of experience under their belt, their team of...
SYS-CON Events announced today that Enroute Lab will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Enroute Lab is an industrial design, research and development company of unmanned robotic vehicle system. For more information, please visit http://elab.co.jp/.
SYS-CON Events announced today that Ryobi Systems will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Ryobi Systems Co., Ltd., as an information service company, specialized in business support for local governments and medical industry. We are challenging to achive the precision farming with AI. For more information, visit http:...
What is the best strategy for selecting the right offshore company for your business? In his session at 21st Cloud Expo, Alan Winters, U.S. Head of Business Development at MobiDev, will discuss the things to look for - positive and negative - in evaluating your options. He will also discuss how to maximize productivity with your offshore developers. Before you start your search, clearly understand your business needs and how that impacts software choices.
Real IoT production deployments running at scale are collecting sensor data from hundreds / thousands / millions of devices. The goal is to take business-critical actions on the real-time data and find insights from stored datasets. In his session at @ThingsExpo, John Walicki, Watson IoT Developer Advocate at IBM Cloud, will provide a fast-paced developer journey that follows the IoT sensor data from generation, to edge gateway, to edge analytics, to encryption, to the IBM Bluemix cloud, to Wa...
SYS-CON Events announced today that Fusic will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Fusic Co. provides mocks as virtual IoT devices. You can customize mocks, and get any amount of data at any time in your test. For more information, visit https://fusic.co.jp/english/.
SYS-CON Events announced today that B2Cloud will exhibit at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. B2Cloud specializes in IoT devices for preventive and predictive maintenance in any kind of equipment retrieving data like Energy consumption, working time, temperature, humidity, pressure, etc.
SYS-CON Events announced today that NetApp has been named “Bronze Sponsor” of SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. NetApp is the data authority for hybrid cloud. NetApp provides a full range of hybrid cloud data services that simplify management of applications and data across cloud and on-premises environments to accelerate digital transformation. Together with their partners, NetApp em...
Elon Musk is among the notable industry figures who worries about the power of AI to destroy rather than help society. Mark Zuckerberg, on the other hand, embraces all that is going on. AI is most powerful when deployed across the vast networks being built for Internets of Things in the manufacturing, transportation and logistics, retail, healthcare, government and other sectors. Is AI transforming IoT for the good or the bad? Do we need to worry about its potential destructive power? Or will we...
SYS-CON Events announced today that SIGMA Corporation will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. uLaser flow inspection device from the Japanese top share to Global Standard! Then, make the best use of data to flip to next page. For more information, visit http://www.sigma-k.co.jp/en/.
Agile has finally jumped the technology shark, expanding outside the software world. Enterprises are now increasingly adopting Agile practices across their organizations in order to successfully navigate the disruptive waters that threaten to drown them. In our quest for establishing change as a core competency in our organizations, this business-centric notion of Agile is an essential component of Agile Digital Transformation. In the years since the publication of the Agile Manifesto, the conn...
SYS-CON Events announced today that Nihon Micron will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Nihon Micron Co., Ltd. strives for technological innovation to establish high-density, high-precision processing technology for providing printed circuit board and metal mount RFID tags used for communication devices. For more inf...
SYS-CON Events announced today that Suzuki Inc. will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Suzuki Inc. is a semiconductor-related business, including sales of consuming parts, parts repair, and maintenance for semiconductor manufacturing machines, etc. It is also a health care business providing experimental research for...
SYS-CON Events announced today that Daiya Industry will exhibit at the Japan External Trade Organization (JETRO) Pavilion at SYS-CON's 21st International Cloud Expo®, which will take place on Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA. Daiya Industry specializes in orthotic support systems and assistive devices with pneumatic artificial muscles in order to contribute to an extended healthy life expectancy. For more information, please visit https://www.daiyak...
The Internet giants are fully embracing AI. All the services they offer to their customers are aimed at drawing a map of the world with the data they get. The AIs from these companies are used to build disruptive approaches that cannot be used by established enterprises, which are threatened by these disruptions. However, most leaders underestimate the effect this will have on their businesses. In his session at 21st Cloud Expo, Rene Buest, Director Market Research & Technology Evangelism at Ara...