Giter Site home page Giter Site logo

brint / wordpress-cookbook Goto Github PK

View Code? Open in Web Editor NEW
80.0 15.0 176.0 4.26 MB

Development repository for Opscode Cookbook wordpress

Home Page: https://supermarket.chef.io/cookbooks/wordpress

License: Apache License 2.0

Ruby 80.56% HTML 18.26% Shell 1.18%

wordpress-cookbook's Introduction

Build Status Dependency Status

Description

The Chef WordPress cookbook installs and configures WordPress according to the instructions at http://codex.wordpress.org/Installing_WordPress.

Description

This cookbook does not set up the WordPress blog. You will need to do this manually by going to http://hostname/wp-admin/install.php (this URL may be different if you change the attribute values).

Requirements

Platform

  • Ubuntu 12.04, 14.04
  • RHEL/CentOS 5, 6
  • Windows

Cookbooks

  • mysql
  • mysql_chef_gem
  • php
  • apache2
  • iis
  • windows
  • openssl (uses library to generate secure passwords)
  • selinux (used to disable selinux for MySQL on RHEL-based systems)

Attributes

WordPress

  • node['wordpress']['version'] - Version of WordPress to download. Use 'latest' to download most recent version.

  • node['wordpress']['parent_dir'] - Parent directory to where WordPress will be extracted. (Windows Only)

  • node['wordpress']['dir'] - Location to place WordPress files.

  • node['wordpress']['db']['root_password'] - Root password for MySQL (added for support with community cookbook version 6+)

  • node['wordpress']['db']['instance_name'] - Name of the MySQL instance to use with MySQL (community cookbook version 6+)

  • node['wordpress']['db']['name'] - Name of the WordPress MySQL database.

  • node['wordpress']['db']['user'] - Name of the WordPress MySQL user.

  • node['wordpress']['db']['pass'] - Password of the WordPress MySQL user. By default, generated using openssl cookbook.

  • node['wordpress']['db']['prefix'] - Prefix of all MySQL tables created by WordPress.

  • node['wordpress']['db']['host'] - Host of the WordPress MySQL database.

  • node['wordpress']['db']['port'] - Port of the WordPress MySQL database.

  • node['wordpress']['db']['charset'] - Character set of the WordPress MySQL database tables. Defaults to 'utf8'.

  • node['wordpress']['db']['collate'] - Collation of the WordPress MySQL database tables.

  • node['wordpress']['db']['mysql_version'] - Version of MySQL to install (for supporting community cookbook version 6+)

  • node['wordpress']['allow_multisite'] - Enable multisite features (default: false).

  • node['wordpress']['wp_config_options'] - A hash of options to define in wp_config.php, output as key value pairs into a PHP constant e.g. define( '<%= @key %>', <%= @value %> );. Note: for values you will need to add single quotes around text but omit them for booleans and numbers. (default: {}).

  • node['wordpress']['config_perms'] - Permissions to set for a site's wp-config.php.

  • node['wordpress']['server_aliases'] - Aliases to use when setting up Virtual Host with Nginx or Apache

  • node['wordpress']['server_port'] - Port to use when setting up the Virtual Host with Nginx or Apache

  • node['wordpress']['install']['user'] - Install user used for WordPress file permissions and the PHP-FPM user (if applicable)

  • node['wordpress']['install']['group'] - Install group used for WordPress file permissions and the PHP-FPM group (if necessary)

  • node['wordpress']['parent_dir'] - Parent directory of where WordPress will be installed. This is used in the Windows installation to determine where the .zip will be downloaded to.

  • node['wordpress']['dir'] - Path where WordPress should be installed

  • node['wordpress']['url'] - URL to the zip or tarball installer of WordPress

  • node['wordpress']['server_name'] - Hostname used for setting up the Virtual Host configuration for your WordPress site

  • node['wordpress']['php_options'] - Additional PHP settings for the installation.

Usage

Add the "wordpress" recipe to your node's run list or role, or include the recipe in another cookbook.

License and Author

Copyright:: 2010-2013, Chef Software, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

wordpress-cookbook's People

Contributors

brint avatar btm avatar chris-rock avatar comsubvie avatar craigtracey avatar gsreynolds avatar jamesbelchamber avatar jokimaki avatar koseki avatar kri5 avatar lewg avatar lusis avatar nathenharvey avatar ranjib avatar reidab avatar ryandub avatar schisamo avatar sethvargo avatar stormsilver avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wordpress-cookbook's Issues

Error with database.rb (4.0.9) from WordPress (3.0.0) cookbook

Not sure if anyone can shed any light on this issue. But I'm trying to setup a POC on Azure and created a Windows 2012 R2 VM to deploy WorkPress (3.0.0), but I'm running into the error from database.rb (4.0.9) when trying to converge on the Windows client VM node on Azure.

Any ideas? I'm the WordPress cookbook, not the WordPress-Windows version.

BTW in the default.rb under \chef-repo\cookbooks\php\attributes, the path to the MSI file that it is trying to download from http://windows.php.net/downloads/releases/ got moved to http://windows.php.net/downloads/releases/archives/.

Thanks in advance,
Mike Rosado

C:\Windows\system32>chef-client
Starting Chef Client, version 11.18.6
resolving cookbooks for run list: ["wordpress"]
Synchronizing Cookbooks:

  • database

  • mysql

  • build-essential

  • iis

  • tar

  • nginx

  • iptables

  • logrotate

  • pacman

  • apt

  • bluepill

  • ohai

  • runit

  • yum-epel

  • rsyslog

  • packagecloud

  • yum

  • apache2

  • smf

  • xml

  • windows

  • chef-sugar

  • postgresql

  • openssl

  • yum-mysql-community

  • mariadb

  • chef_handler

  • rbac

  • php-fpm

  • wordpress

  • mysql2_chef_gem

  • php

  • selinux
    Compiling Cookbooks...
    Converging 23 resources
    Recipe: iis::default

  • windows_feature[IIS-WebServerRole] action install (up to date)

  • service[iis] action enable (up to date)

  • service[iis] action start (up to date)
    Recipe: iis::mod_cgi

  • windows_feature[IIS-CGI] action install (up to date)
    Recipe: php::package

  • windows_package[PHP 5.3.20] action install (up to date)

  • cookbook_file[C:\Program Files (x86)\PHP/PEAR/go-pear.phar] action create (u
    p to date)

  • template[C:\Program Files (x86)\PHP/pear-options] action create (up to date)

  • execute[install-pear] action run

    • execute go-pear.bat < pear-options
  • windows_path[C:\Program Files (x86)\PHP] action add

    • env[path] action modify (up to date)
    • ruby_block[fix ruby ENV['PATH']] action nothing (skipped due to action :no
      thing)
      (up to date)
      Recipe: php::ini
  • template[C:\Program Files (x86)\PHP/php.ini] action create (up to date)
    Recipe: php::default

  • php_pear_channel[pear.php.net] action update (up to date)

  • php_pear_channel[pecl.php.net] action update (up to date)
    Recipe: wordpress::database

  • mysql2_chef_gem[default] action install

    Error executing action install on resource 'mysql2_chef_gem[default]'

    ArgumentError

    wrong number of arguments(2 for 0)

    Resource Declaration:

    In C:/chef/cache/cookbooks/wordpress/recipes/database.rb

    29: mysql2_chef_gem 'default' do
    30: action :install
    31: end
    32:

    Compiled Resource:

    Declared in C:/chef/cache/cookbooks/wordpress/recipes/database.rb:29:in `f

    rom_file'

    mysql2_chef_gem("default") do
    action [:install]
    retries 0
    retry_delay 2
    guard_interpreter :default
    cookbook_name "wordpress"
    recipe_name "database"
    end

Running handlers:

  • AzureExtension::ExceptionHandler
    Running handlers complete
    Chef Client failed. 1 resources updated in 24.912801 seconds

Please separate web server configuration

I do not use the apache2 cookbook. I want to be able to install Wordpress without necessarily configuration a virtual host entry. Please separate this or at least allow it to be done conditionally based on an attribute.

Version 2.3.0 Didn't include a Changelog

Hey There!

One of the new features of Supermarket makes it so the Changelog is displayed on the site. It would be way cool to see a Changelog entry when you do a new release.

Thanks!
-- cwebber

Getting bind exception while running wordpress cookbook

Hi,

I am getting below error while running wordpress cookbook.

Note: This error is intermittent when I ran 8 times 6 times it went successful and 2 times got failed with same error. please help to resolve this issue.

Chef-server : 12

Chef-clent : 11.16.4

wordpress - 2.1.3

  • service[apache2] action restart

    ================================================================================

    Error executing action restart on resource 'service[apache2]'

    Mixlib::ShellOut::ShellCommandFailed

    Expected process to exit with [0], but received '1'

    ---- Begin output of /sbin/service httpd restart ----

    STDOUT: Stopping httpd: [ OK ]

    Starting httpd: [FAILED]

    STDERR: (98)Address already in use: make_sock: could not bind to address [::]:80

    (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80

    no listening sockets available, shutting down

    Unable to open logs

    ---- End output of /sbin/service httpd restart ----

    Ran /sbin/service httpd restart returned 1

Regards,
Aravind

Multiple WP on same host

You can't use this cookbook as a wrapper cookbook and it can't be used for multiple installs on the same host as it uses attributes to install.

There should be LWRPs to install wordpress site

tar extract fails if deploying with chef-solo

wordpress tar extract fails with access denied error if deployment is done with chef-solo. This is due to tar being executed under the user that does not have access to read ~/chef-solo. Temporarily changing ~/chef-solo to 755 solves the problem.

wordpress.conf.erb not compatible with Apache 2.4

Apache 2.4 has done some radical changes in lots of config parameters. It really broke a lot of things including the main apache2 cookbook. AND Ubuntu packagers have updated the apache2 package to use 2.4 for several releases, not just 14.04. The apache2 cookbook maintainers have a pre-release with fixes (COOK-3900).

But it looks like the wordpress cookbook apache config template contains a couple of lines that are incompatible with apache2.4:

  RewriteLog <%= node['apache']['log_dir'] %>/<%= @application_name %>-rewrite.log
  RewriteLogLevel 0

need to be removed to have wordpress work with Apache 2.4. (http://httpd.apache.org/docs/current/mod/mod_rewrite.html)

Is there a way to override the template source in the wordpress cookbook in a wrapper cookbook? I don't see a way off hand.

These Apache 2.4 changes are a major pain. I don't know what they were thinking by making breaking configuration changes in a dot release.

server_name and server_alias issue

Hello, I've been trying to do a fully installation of wordpress using this cookbook but after the installation the apache configuration has not the correct server name or alias

  • template[/var/www/wordpress/wp-config.php] action create (up to date)
  • template[/etc/httpd/sites-available/wordpress.conf] action create
    • create new file /etc/httpd/sites-available/wordpress.conf
    • update content in file /etc/httpd/sites-available/wordpress.conf from none to e86471
      --- /etc/httpd/sites-available/wordpress.conf 2014-08-19 23:16:00.626466260 -0300
      +++ /tmp/chef-rendered-template20140819-11478-1byllfm 2014-08-19 23:16:00.627466260 -0300
      @@ -1 +1,26 @@
      +<VirtualHost *:80>
    • ServerName
    • ServerAlias
    • DocumentRoot /var/www/wordpress
    • <Directory /var/www/wordpress>
    • Options FollowSymLinks
    • AllowOverride FileInfo Options
    • Order allow,deny
    • Allow from all

I tried to configure the following variables at attributes/default.rb

default['wordpress']['server_aliases'] = [node['fqdn']]
default['wordpress']['server_name'] = node['fqdn']

changing values to other value like as centos-web or something like this but I hadn't lucky. The only way where I could assign a value was when I change values at templates.

Is something wrong on my steps or idea?

Thanks in advance
G.

Version Bump to be pushed on http://community.opscode.com/

There is actually a problem with the mysql and wordpress cookbook on http://community.opscode.com/

Indeed the mysql cookbook used to have a ruby recipe, which is not the case anymore, and this change is now live on http://community.opscode.com/.

Btw, a fix to this as been commited in this repo (version 2.1.2), but the version on http://community.opscode.com/, 2.1.0, still uses mysql::ruby recipe.

I don't know about the process of getting version on the community website/repo, but should be great if the version living there moves to 2.1.2.

Not Compatible with RHEL / Centos 7

I have tried installing this on RHEL 7 with either httpd or NGINX both fail with too many issues to list. I wish this was being maintained. it's above my knowledge....
it's not able to use mariadb either....

Metadata attribute and recipe names should be in lowercase

The name of the cookbook is wordpress but the metadata.rb file describes recipes in the cookbook referring to the cookbook as 'WordPress' instead of 'wordpress'. Also, the file describes attributes as in a 'WordPress' namespace instead of a 'wordpress' one.

Cookbook bootstrap NoMethodError: undefined method `property' for #<Class:0x000000035301a8>

I went through the default.rb and the templates and they all seem to be in order but no matter what, I cannot bootstrap/install the cookbook in ubuntu (vagrant-ubuntu-trusty-64 3.13.0-133-generic) or Centos 7 (3.10.0-693.el7.x86_64) using Chef 13.5.3-1

Any help is appreciated

Thanks

192.168.128.34 [2017-10-16T06:31:58+00:00] ERROR: Running exception handlers
192.168.128.34 [2017-10-16T06:31:58+00:00] ERROR: Exception handlers complete
192.168.128.34 [2017-10-16T06:31:58+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
192.168.128.34 Chef Client failed. 0 resources updated
192.168.128.34 [2017-10-16T06:31:58+00:00] ERROR: undefined method `property' for #Class:0x000000030f9328
192.168.128.34 [2017-10-16T06:31:58+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)

chef-stacktrace.out

Generated at 2017-10-16 06:23:50 +0000
NoMethodError: undefined method property' for #<Class:0x000000035301a8> /var/chef/cache/cookbooks/rsyslog/resources/file_input.rb:19:in class_from_file'
/usr/lib/ruby/vendor_ruby/chef/mixin/from_file.rb:42:in class_eval' /usr/lib/ruby/vendor_ruby/chef/mixin/from_file.rb:42:in class_from_file'
/usr/lib/ruby/vendor_ruby/chef/resource/lwrp_base.rb:54:in build_from_file' /usr/lib/ruby/vendor_ruby/chef/run_context/cookbook_compiler.rb:208:in load_lwrp_resource'
/usr/lib/ruby/vendor_ruby/chef/run_context/cookbook_compiler.rb:193:in block in load_lwrps_from_cookbook' /usr/lib/ruby/vendor_ruby/chef/run_context/cookbook_compiler.rb:192:in each'
/usr/lib/ruby/vendor_ruby/chef/run_context/cookbook_compiler.rb:192:in load_lwrps_from_cookbook' /usr/lib/ruby/vendor_ruby/chef/run_context/cookbook_compiler.rb:120:in block in compile_lwrps'
/usr/lib/ruby/vendor_ruby/chef/run_context/cookbook_compiler.rb:119:in each' /usr/lib/ruby/vendor_ruby/chef/run_context/cookbook_compiler.rb:119:in compile_lwrps'
/usr/lib/ruby/vendor_ruby/chef/run_context/cookbook_compiler.rb:72:in compile' /usr/lib/ruby/vendor_ruby/chef/run_context.rb:86:in load'
/usr/lib/ruby/vendor_ruby/chef/client.rb:250:in setup_run_context' /usr/lib/ruby/vendor_ruby/chef/client.rb:498:in do_run'
/usr/lib/ruby/vendor_ruby/chef/client.rb:199:in block in run' /usr/lib/ruby/vendor_ruby/chef/client.rb:193:in fork'
/usr/lib/ruby/vendor_ruby/chef/client.rb:193:in run' /usr/lib/ruby/vendor_ruby/chef/application.rb:208:in run_chef_client'
/usr/lib/ruby/vendor_ruby/chef/application/client.rb:312:in block in run_application' /usr/lib/ruby/vendor_ruby/chef/application/client.rb:304:in loop'
/usr/lib/ruby/vendor_ruby/chef/application/client.rb:304:in run_application' /usr/lib/ruby/vendor_ruby/chef/application.rb:66:in run'
/usr/bin/chef-client:25:in `

'

Supermarket entry for WordPress 3.0.0 is missing metadata.rb

The current version of the WordPress cookbook (3.0.0) is missing metadata.rb on the Supermarket (https://supermarket.chef.io/cookbooks/wordpress). Version 2.3.0 has a metadata.rb file included.

This causes berks init to fail:

[root@ip-10-0-1-73 chef-repo]# berks init /var/chef/chef-repo/cookbooks/wordpress --skip-vagrant --skip-git
The resource at '/var/chef/chef-repo/cookbooks/wordpress/metadata.rb' does not appear to be a valid cookbook. Does it have a metadata.rb?

How to Handle wp-config.php Edits

Hi,

I use this in a wrapper cookbook and need to add some web proxy configs and the extra configs for multisite to the wp-config.php file. However when Chef runs it overwrites that file from the template.

Do you have a particular way you are handling that in your wrapper cookbooks?

Matt

Adding LWRPs for Themes and Plugins

It would be really awesome if Plugins and Themes could be installed and activated using a LWRP. Has anyone put some thought into this?

Thoughts

Plugins

wordpress_plugin 'Plugin Name' do 
  action :install | :activate | :deactivate | :delete | :network_activate | :network_deactivate
  sites [ 1 ] # an array of site IDs to activate the plugin on in an MU install
  repository 'https://wordpress.org' # The WordPress Repository (Theoretical I have to look into if this is possible)
  source 'https://internal.company.com/plugin-name.(zip|tar|tar.gz)' # Just Ark that
end

Themes

very similar setup for themes but also the possibility of adding theme mod support

Examples

# Install but don't activate
wordpress_plugin 'jetpack' do 
  action :install
end
# Install if missing and activate for the entire network
wordpress_plugin 'buddypress' do 
  action :activate_network
end
# Delete Plugin
wordpress_plugin 'hello-dolly' do 
  action :delete
end
# Disable Plugin
wordpress_plugin 'akismet' do 
  action :disable
end

Errors with mysql cookbook 6.0.0+

I'm finding that when I try to run the wordpress recipe, I immediately get the error:

ERROR: could not find recipe client for cookbook mysql

I think this may be due to the changes in the 6.0.0 version of the mysql cookbook, "Cookbook now provides LWRPs instead of recipes"β€”it looks like, e.g. include_recipe "mysql::client" now won't work.

(Trying with wordpress-2.3.0 and mysql-6.0.6)

Any hints? I only started using chef a few days ago, so this is a little above my head!

Database recipe causing error if run a second time

I'm using Chef with Vagrant. If I run vagrant reload --provision having previously provisioned the machine I get an error:

ERROR: link[/var/run/mysqld/mysqld.sock] (wordpress::database line 56) had an error: Errno::ENOENT:
No such file or directory @ sys_fail2 - (/var/run/mysql-default/mysqld.sock, /var/run/mysqld/mysqld.sock)

wordpress::database line 56

Wordpress DB password is not set correctly

I'm wrapping the wordpress cookbook with my own. I am trying to set the wordpress DB password using attributes:

include_attribute 'wordpress'
default['wordpress']['db']['pass'] = "some-password"

But it is not being set as expected.
The problem is here: https://github.com/brint/wordpress-cookbook/blob/master/recipes/database.rb#L35

It overrides the given password even though the attribute has a value.
After exploring the problem I found out that set_unless will override default precedence attributes.
Changing the attributes file to normal instead of default solves it:

include_attribute 'wordpress'
normal['wordpress']['db']['pass'] = "some-password"

Just thought I should bring this issue to awareness.

Thanks :)

Error Establishing Database Connection (a possible solution to this)

I tried using the nginx recipe of this cookbook today on an ubuntu 14.04 machine and it all installed beautifully. BUT...

When I tried to run Wordpress nothing happened. This turned out to be an easy fix - nginx wasn't running, so I had to type:

sudo service nginx start

This started nginx, even though there was no output from the console.

The second problem I ran into was that on accessing the main web page, I got the error: "Error Establishing Database Connection"

Took me a while to figure out - and after some googling, I came across the cause. Turns out that Wordpress doesn't like the database host being referred to as 'localhost'. Instead, you have to use '127.0.0.1'.

Changing this is quite easy. You have to do this from within your cookbook:

If you are using your own cookbook, you can set the host in recipes/default.rb like this:

node.default['wordpress']['db']['host']  = "127.0.0.1"

or alternatively, you can set it in attributes/default.rb like this (useful if you follow the wrapper cookbook pattern):

default['wordpress']['db']['host'] = "127.0.0.1"

This allows everything to work as expected. But I'm curious - does anyone know why using 'localhost' doesn't work?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.