Vendor the external cookbooks

Knife-Zero doesn't include Berkshelf support, so vendoring everything in
the repo is convenient again
This commit is contained in:
Greg Karékinian
2019-10-13 18:32:56 +02:00
parent aa66743166
commit 049d5dd006
1245 changed files with 100630 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
include_recipe "apache2"
include_recipe "apache2::mod_php5"
include_recipe "apache2::mod_rewrite"
# Add virtualhost
web_app "mediawiki" do
server_name node["mediawiki"]["server_name"]
docroot node["mediawiki"]["webdir"]
end

View File

@@ -0,0 +1,31 @@
::Chef::Recipe.send(:include, Opscode::OpenSSL::Password)
package('libmysqlclient-dev') { action :nothing }.run_action(:install)
build_essential 'mediawiki' do
compile_time true
end
node.normal['mediawiki']['db']['pass'] = secure_password
node.save unless Chef::Config[:solo]
db = node["mediawiki"]["db"]
package %w(mysql-client mysql-server)
service 'mysql' do
action [:enable, :start]
end
# Create database
execute "create #{db["name"]} db" do
command "mysql -e \"CREATE DATABASE IF NOT EXISTS #{db["name"]};\""
user "root"
end
# Create user
execute "create #{db["user"]} user" do
command "mysql -e \"CREATE USER IF NOT EXISTS '#{db["user"]}'@'localhost' IDENTIFIED BY '#{db["pass"]}'; GRANT ALL PRIVILEGES ON #{db["name"]}.* to '#{db["user"]}'@'localhost'; FLUSH PRIVILEGES;\""
sensitive true
user "root"
end

View File

@@ -0,0 +1,69 @@
#
# Cookbook Name:: mediawiki
# Recipe:: default
#
# Copyright (C) 2014 YOUR_NAME
#
# All rights reserved - Do Not Redistribute
#
include_recipe "apt"
include_recipe "php::default"
package %w(php-apcu php-mysql php-mbstring)
include_recipe "mediawiki::database"
# Download mediawiki tarball
remote_file "#{Chef::Config[:file_cache_path]}/#{node['mediawiki']['tarball']['name']}" do
source node['mediawiki']['tarball']['url']
notifies :run, "bash[extract_mediawiki]", :immediately
end
# Extract mediawiki tarball
bash "extract_mediawiki" do
user "root"
cwd node["mediawiki"]["docroot_dir"]
code "tar -zxf #{Chef::Config[:file_cache_path]}/#{node['mediawiki']['tarball']['name']}; chown -R #{node['nginx']['user']}:#{node['nginx']['group']} #{node['mediawiki']['docroot_dir']}"
action :nothing
end
# Additional packages
case node["platform_family"]
when "rhel"
package "php-xml"
package "libicu-devel"
when "debian"
package "libicu-dev"
end
if platform?('ubuntu') && node[:platform_version].to_f < 16.04
# bundled with PHP since version 5.3
php_pear "intl" do
action :install
end
end
# Configure mediawiki database
bash "configure_mediawiki_database" do
user node["nginx"]["user"]
cwd node["mediawiki"]["webdir"]
code "php maintenance/install.php" +
" --pass '" + node["mediawiki"]["admin_password"] +
"' --dbname '" + node["mediawiki"]["db"]["name"] +
"' --dbuser '" + node["mediawiki"]["db"]["user"] +
"' --dbpass '" + node["mediawiki"]["db"]["pass"] +
"' --server '" + node["mediawiki"]["server"] +
"' --scriptpath '" + node["mediawiki"]["scriptpath"] +
"' --lang '" + node["mediawiki"]["language_code"] +
"' '" + node["mediawiki"]["site_name"] + "' '" + node["mediawiki"]["admin_user"] + "'"
not_if { File.exist? "#{node["mediawiki"]["webdir"]}/LocalSettings.php" }
action :run
end
file "#{node["mediawiki"]["webdir"]}/LocalSettings.php" do
mode "0640"
owner node["nginx"]["user"]
group node["nginx"]["group"]
end

View File

@@ -0,0 +1,32 @@
#
# Cookbook Name:: mediawiki
# Recipe:: nginx
#
node.default['php-fpm']['pools'] = []
node.override['php-fpm']['package_name'] = "php-fpm"
node.override['php-fpm']['service_name'] = "php7.2-fpm"
node.override['php-fpm']['conf_dir'] = "/etc/php/7.2/fpm/conf.d"
node.override['php-fpm']['pool_conf_dir'] = "/etc/php/7.2/fpm/pool.d"
node.override['php-fpm']['conf_file'] = "/etc/php/7.2/fpm/php-fpm.conf"
include_recipe "php-fpm"
include_recipe 'php-fpm::repository' unless node['php-fpm']['skip_repository_install']
include_recipe "php-fpm::install"
php_fpm_pool "www" do
enable false
end
php_fpm_pool "mediawiki" do
listen "127.0.0.1:9002"
user node['nginx']['user']
group node['nginx']['group']
listen_owner node['nginx']['user']
listen_group node['nginx']['group']
php_options node['mediawiki']['php_options']
start_servers 5
enable true
end
include_recipe "nginx"