• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here: Home » Automate WordPress Installation With Puppet (Ubuntu, Rackspace Cloud Server)

By Abhishek Ghosh October 25, 2014 8:29 am Updated on October 25, 2014

Automate WordPress Installation With Puppet (Ubuntu, Rackspace Cloud Server)

Advertisement

We can automate WordPress installation with Puppet running on Ubuntu instance on Rackspace Cloud Server for our own multiple WordPress sites. In the age of cloud automation and for this scenario, lesser need of abstraction makes the idea near ideal depending upon the number of websites.

 

Why Automate WordPress Installation With Puppet on Rackspace Cloud Server?

 

Why automate WordPress Installation with Puppet on Rackspace Cloud Server when OpenStack Heat Template Exists? Because OpenStack Heat can not give you the fine granular control for your personalized need? No. Puppet and OpenStack Heat Template, can not be compared so bravely. OpenStack Heat Template is an orchestration tool for managing stacks or applications deployed on Rackspace cloud. Packaging can also be installed via OpenStack Heat Templates to do things like deploying a stack and make it a 4 node WordPress cluster.
Puppet is client-server based. Puppetmaster and Puppet Clients. Declarative Language for write once deploy many. Puppet has open-source Openstack Packages for on-demand Openstack Delivery/Configuration Version control. Deployment of monitoring tools, security tools all possible within private cloud.

That is said, but you can, in many cases should, use both types of tools together. There are also valid strategies for deploying some applications using Heat alone.

Advertisement

---

Automate WordPress Installation With Puppet (Ubuntu, Rackspace Cloud Server)

 

Why Automate WordPress Installation With Puppet on Rackspace Cloud Server?

 

It is not acceptable to think that you are a newbie to install WordPress from Command Line. In this tutorial we will create a Puppet module that can install Apache, MySQL; add a database and a database user on MySQL for WordPress and configure WordPress. It is a kind o template for your need.

We can not downgrade from a server Image – this must be understood. If we could easily use one VHD image optimized for 2 GB instance for 512 MB device, we would never need it. So, this kind of setup is only required when multiple 512, 1 GB, 2 GB to 512 GB Bare Metal installation is needed. Otherwise, the amount of work will not give significant advantage.

First step is to download and install Puppet :

Vim
1
2
3
4
5
6
mkdir -p ~/Downloads && cd ~/Downloads
wget https://apt.puppetlabs.com/puppetlabs-release-trusty.deb
sudo dpkg -i puppetlabs-release-trusty.deb
apt-get update -y && apt-get install puppet
puppet --version
# output

Next we need to set the configuration file to install the components needed to run WordPress :

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
nano /etc/puppet/puppet.conf
*** This Should Look Like This ***
[main]
logdir=/var/log/puppet
vardir=/var/lib/puppet
ssldir=/var/lib/puppet/ssl
rundir=/var/run/puppet
factpath=$vardir/lib/facter
templatedir=$confdir/templates
 
[master]
 
ssl_client_header = SSL_CLIENT_S_DN
ssl_client_verify_header = SSL_CLIENT_VERIFY
*** Example Ends Above This ***

Now install MySQL and Apache :

Vim
1
2
3
4
puppet module install puppetlabs-apache
puppet module install puppetlabs-mysql
# check the list of stuffs
puppet module list

Add modules for WordPress :

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
mkdir -p ~/MyModules && cd ~/MyModules
puppet module generate do-wordpress --skip-interview
# do-wordpress is just a name
# if you do not include `--skip-interview`
# you'll face interactive mode
# do-wordpress is a directory, you can cd and do ls to check
# it
nano ~/MyModules/do-wordpress/metadata.json
*** It Should Look Like This ***
{
  "name": "do-wordpress",
  "version": "0.1.0",
  "author": "do",
  "summary": null,
  "license": "Apache 2.0",
  "source": "",
  "project_page": null,
  "issues_url": null,
  "dependencies": [
    {"name":"puppetlabs/stdlib","version_requirement":">= 1.0.0"}
  ]
}
*** Example Ends Above This Line ***
# we will use prefork
nano ~/MyModules/do-wordpress/manifests/web.pp
*** It Should Look Like This ***
class wordpress::web {
    class {'apache':
        mpm_module => 'prefork'
    }
 
    class {'::apache::mod::php': }
}
# configuration for php and apache2
*** Example Ends Above This Line ***
# we will modify the .conf
nano ~/MyModules/do-wordpress/manifests/conf.pp
*** It Should Look Like This But Values Should Be Changed ***
class wordpress::conf {
    # You can change the values of these variables
    # according to your preferences
 
    $root_password = 'password'
    $db_name = 'wordpress'
    $db_user = 'wordpressuser'
    $db_user_password = 'password'
    $db_host = 'localhost'
    $db_user_host = "${db_user}@${db_host}"
 
    # notice the .*
    $db_user_host_db = "${db_user}@${db_host}/${db_name}.*"
}
*** Example Ends Above This Line ***
# same for MySQL
nano ~/MyModules/do-wordpress/manifests/db.pp
*** It Should Look Like This But Values Should Be Changed ***
class wordpress::db {
 
    class { '::mysql::server':
 
        # we are defining => password, user, privileges and bind
 
        root_password => $wordpress::conf::root_password,
 
        databases => {
            "${wordpress::conf::db_name}" => {
                ensure => 'present',
                charset => 'utf8'
            }
        },
        users => {
            "${wordpress::conf::db_user_host}" => {
                ensure => present,
                password_hash => mysql_password("${wordpress::conf::db_user_password}")
            }
        },
        grants => {
            "${wordpress::conf::db_user_host_db}" => {
                ensure     => 'present',
                options    => ['GRANT'],
                privileges => ['ALL'],
                table      => "${wordpress::conf::db_name}.*",
                user       => "${wordpress::conf::db_user_host}",
            }
        },
    }
 
    # we can toggle binding at my.cnf
    class { '::mysql::client':
        require => Class['::mysql::server'],
        bindings_enable => true
    }
}
*** Example Ends Above This Line ***

Backend is ready, we can install WordPress now :

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
mkdir -p ~/MyModules/do-wordpress/files && cd ~/MyModules/do-wordpress/files
mkdir -p ~/MyModules/do-wordpress/templates && cd /tmp
tar -xvzf ~/MyModules/do-wordpress/files/latest.tar.gz && cp /tmp/wordpress/wp-config-sample.php ~/MyModules/do-wordpress/templates/wp-config.php.erb
rm -rf /tmp/wordpress* latest* && nano ~/MyModules/do-wordpress/templates/wp-config.php.erb
# copy paste this gist and write out with ^ + O
https://gist.github.com/AbhishekGhosh/85dd163c5d70a78f8d7e
# here is the raw
https://gist.githubusercontent.com/AbhishekGhosh/85dd163c5d70a78f8d7e/raw/6ad6531ef9c82bac7a017c1dd6191821e45498fb/puppet-wordpress-multi.php
# edit the wordpress specific file
nano ~/MyModules/do-wordpress/manifests/wp.pp
*** Example Starts Below This Line ***
class wordpress::wp {
    file { '/tmp/latest.tar.gz':
        ensure => present,
        source => "puppet:///modules/wordpress/latest.tar.gz"
    }
    exec { 'extract':
        cwd => "/tmp",
        command => "tar -xvzf latest.tar.gz",
        require => File['/tmp/latest.tar.gz'],
        path => ['/bin'],
    }
    exec { 'copy':
        command => "cp -r /tmp/wordpress/* /var/www/",
        require => Exec['extract'],
        path => ['/bin'],
    }
    file { '/var/www/wp-config.php':
        ensure => present,
        require => Exec['copy'],
        content => template("wordpress/wp-config.php.erb")
    }
}
*** Example Ends Above This Line ***

Do not worry ! this is the last step :

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
nano ~/MyModules/do-wordpress/manifests/init.pp
*** Example Starts Below This Line ***
 
class wordpress {
    class { 'wordpress::conf': }
    class { 'wordpress::web': }
    class { 'wordpress::db': }
    class { 'wordpress::wp':
        require => Notify['Apache Installation Done']
    }
    notify { 'MySQL Installation Done':
        require => Class['wordpress::db']
    }
    notify { 'Apache Installation Done':
        require => Class['wordpress::web']
    }
    notify { 'Wordpress Installation Done':
        require => Class['wordpress::wp']
    }
}
 
*** Example Ends Above This Line ***

Now build your package :

Vim
1
cd ~/MyModules && puppet module build do-wordpress

Now you can use it to install easily. To check the right name, cd to pkg directory :

Vim
1
2
3
4
5
6
7
8
9
10
cd ~/MyModules/do-wordpress/pkg/ && ls -al
# example command to install WordPress
puppet module install ~/MyModules/do-wordpress/pkg/do-wordpress-0.1.0.tar.gz
nano /tmp/install-wp.pp
# add this
class { 'wordpress':
}
# thats it
sudo puppet apply /tmp/install-wp.pp
# point to domain name or bare IP on browser

It is tested on Rackspace PVHVM 2 GB instance. It takes a bit time (~15 minutes) to get the custom setup installed.

Tagged With automate installation wordpress ubuntu , automate wp installation , installation of wordpress on puppet , wordpress pupet ubuntu

This Article Has Been Shared 766 Times!

Facebook Twitter Pinterest
Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to Automate WordPress Installation With Puppet (Ubuntu, Rackspace Cloud Server)

  • Rackspace Cloud Hosting Review : Suits Everyone’s Wallet

    Rackspace Cloud Hosting Review is intended for the users who are seeking a reliable Cloud Computing Platform or a reliance elegant managed Cloud Hosting.

  • Theoretical Foundations of Big Data : Part 2

    Theoretical Foundations of Big Data is second part of our series of articles. We have talked about data privacy & basics of data warehouse.

  • How Google Cloud Platform is Compared to IBM, OVH, DO, Linode?

    How Google Cloud Platform is When Compared to Other Cloud Webhosts IBM, OVH, DO, Linode? Not surprisingly not cost effective in terms of bench-marking.

  • Developer’s Guide : IBM Cloud’s Call for Code for Natural Disaster (Last Date : June 18, 2018)

    IBM invested huge $30 Million for Natural Disaster with prize. Here is some matters discussed around IBM Cloud’s Call for Code for the developers.

  • How to Install Apache Tika on Ubuntu Server

    Apache Tika is a Content Analysis Framework Which Can Be Configure With Web Software Like WordPress For Metadata Extraction of PDF, doc. Here is How to Install Apache Tika on Ubuntu Server.

Additionally, performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

Get new posts by email:

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (22.1K Followers)
  • Twitter (5.8k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • Ways To Make Sure Your Online Course Outshine Others July 3, 2022
  • Will Smart Factories Become the New Assembly Line? July 2, 2022
  • The Cost of Doing Business as a Handyman July 1, 2022
  • Samsung Galaxy S22 Ultra: Long Term Review June 30, 2022
  • How to Make the Most of Your S Pen (S22 Ultra) June 29, 2022

About This Article

Cite this article as: Abhishek Ghosh, "Automate WordPress Installation With Puppet (Ubuntu, Rackspace Cloud Server)," in The Customize Windows, October 25, 2014, July 4, 2022, https://thecustomizewindows.com/2014/10/automate-wordpress-installation-puppet-ubuntu-rackspace-cloud-server/.

Source:The Customize Windows, JiMA.in

This website uses cookies. If you do not want to allow us to use cookies and/or non-personalized Ads, kindly clear browser cookies after closing this webpage.

Read Privacy Policy.

PC users can consult Corrine Chorney for Security.

Want to know more about us? Read Notability and Mentions & Our Setup.

Copyright © 2022 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy