Fix issues with the kosmos-mastodon cookbook #8

Closed
greg wants to merge 6 commits from bugfix/nodejs_update_mastodon_fixes into master
8 changed files with 66 additions and 54 deletions

View File

@ -39,7 +39,7 @@ cookbook 'apt', '~> 7.0.0'
cookbook 'git', '= 6.0.0'
cookbook 'hostsfile', '= 2.4.5'
cookbook 'ohai', '= 5.0.4'
cookbook 'nodejs', '~> 5.0.0'
cookbook 'nodejs', '~> 6.0.0'
# Deprecated, but wordpress and mediawiki depend on it and it would painful
# to change it without moving the databases
cookbook 'database', '= 6.1.1'

View File

@ -33,7 +33,7 @@ DEPENDENCIES
mingw (= 2.0.0)
mysql (= 6.1.3)
mysql2_chef_gem (= 1.1.0)
nodejs (~> 5.0.0)
nodejs (~> 6.0.0)
ntp (= 3.4.0)
ohai (= 5.0.4)
openssl (= 7.1.0)
@ -144,9 +144,9 @@ GRAPH
build-essential (>= 0.0.0)
mariadb (>= 0.0.0)
mysql (>= 6.0)
nodejs (5.0.0)
nodejs (6.0.0)
ark (>= 2.0.2)
build-essential (>= 0.0.0)
build-essential (>= 5.0)
ntp (3.4.0)
ohai (5.0.4)
openssl (7.1.0)

View File

@ -1,5 +1,10 @@
# NodeJS Cookbook Changelog
## 6.0.0 (2018-10-11)
- Use the build_essential resource in the source install recipe instead of the build-essential::default recipe. This way we can use the new built-in build_essential resource in Chef 14+
- Set default version to Node.js v8.12.0
## 5.0.0 (2017-11-15)
- nodejs_npm resource has been converted to a custom resource and renamed to npm_package. The existing resource name will continue to function, but over time code should be updated for the new name. This name change has been made so we can eventually merge this resource into the chef-client.

View File

@ -24,17 +24,17 @@ else
default['nodejs']['install_method'] = 'source'
end
default['nodejs']['version'] = '6.10.2'
default['nodejs']['version'] = '8.12.0'
default['nodejs']['prefix_url']['node'] = 'https://nodejs.org/dist/'
default['nodejs']['source']['url'] = nil # Auto generated
default['nodejs']['source']['checksum'] = '9b897dd6604d50ae5fff25fd14b1c4035462d0598735799e0cfb4f17cb6e0d19'
default['nodejs']['source']['checksum'] = 'b4797843136edd9195c28221a1680ae52c29d867fc5fc1c99f7d6e2f2126a67b'
default['nodejs']['binary']['url'] = nil # Auto generated
default['nodejs']['binary']['checksum']['linux_x64'] = '35accd2d9ccac747eff0f236e2843bc2198ba7765e2340441d6230861bae4e1b'
default['nodejs']['binary']['checksum']['linux_x86'] = '6721221fab4e3b3a1be6573900b9e368c7a74ac1c1c3ae982e49c5583e8962e3'
default['nodejs']['binary']['checksum']['linux_arm64'] = '97de0340b6dbf38e3d995df880a94c58d403c3054676d8fc9192b83a3735f0b8'
default['nodejs']['binary']['checksum']['linux_x64'] = '3df19b748ee2b6dfe3a03448ebc6186a3a86aeab557018d77a0f7f3314594ef6'
default['nodejs']['binary']['checksum']['linux_x86'] = '56ecffbd8a656991f71e4b53ab00af333c97453062cadc20a2103b933088d24d'
default['nodejs']['binary']['checksum']['linux_arm64'] = '781ecf1ecb14b4c671ef0732988636282d6fb7071c4bd52567f663b008796bc9'
default['nodejs']['make_threads'] = node['cpu'] ? node['cpu']['total'].to_i : 2

File diff suppressed because one or more lines are too long

View File

@ -20,7 +20,7 @@
Chef::Recipe.send(:include, NodeJs::Helper)
include_recipe 'build-essential'
build_essential 'install build tools'
case node['platform_family']
when 'rhel', 'fedora', 'amazon'

View File

@ -50,6 +50,46 @@ end
ruby_version = "2.6.0"
execute "systemctl daemon-reload" do
command "systemctl daemon-reload"
action :nothing
end
# mastodon-web service
#
template "/lib/systemd/system/mastodon-web.service" do
source "mastodon-web.systemd.service.erb"
variables user: user,
app_dir: mastodon_path,
port: node["kosmos-mastodon"]["puma_port"],
bundle_path: "/opt/ruby_build/builds/#{ruby_version}/bin/bundle"
notifies :run, "execute[systemctl daemon-reload]", :immediately
notifies :restart, "service[mastodon-web]", :delayed
end
# mastodon-sidekiq service
#
template "/lib/systemd/system/mastodon-sidekiq.service" do
source "mastodon-sidekiq.systemd.service.erb"
variables user: user,
app_dir: mastodon_path,
bundle_path: "/opt/ruby_build/builds/#{ruby_version}/bin/bundle",
sidekiq_threads: node["kosmos-mastodon"]["sidekiq_threads"]
notifies :run, "execute[systemctl daemon-reload]", :immediately
notifies :restart, "service[mastodon-sidekiq]", :delayed
end
# mastodon-streaming service
#
template "/lib/systemd/system/mastodon-streaming.service" do
source "mastodon-streaming.systemd.service.erb"
variables user: user,
app_dir: mastodon_path,
port: node["kosmos-mastodon"]["streaming_port"]
notifies :run, "execute[systemctl daemon-reload]", :immediately
notifies :restart, "service[mastodon-streaming]", :delayed
end
application mastodon_path do
owner "mastodon"
group "mastodon"
@ -61,6 +101,10 @@ application mastodon_path do
version ruby_version
end
ruby_gem 'bundler' do
version "1.17.3" # 2.0 needs Ruby 2.6 or RubyGems 3.0
end
git do
user "mastodon"
group "mastodon"
@ -107,7 +151,7 @@ application mastodon_path do
environment "HOME" => mastodon_path
user "mastodon"
cwd mastodon_path
command "yarn install --pure-lockfile"
command "PATH=\"/usr/local/nodejs-binary-#{node['nodejs']['version']}/bin:$PATH\" yarn install --pure-lockfile"
end
rails do
@ -124,57 +168,17 @@ application mastodon_path do
user "mastodon"
group "mastodon"
cwd mastodon_path
command "PATH=\"/opt/ruby_build/builds/#{ruby_version}/bin:$PATH\" /opt/ruby_build/builds/#{ruby_version}/bin/bundle exec rake assets:precompile"
end
execute "systemctl daemon-reload" do
command "systemctl daemon-reload"
action :nothing
end
# mastodon-web service
#
template "/lib/systemd/system/mastodon-web.service" do
source "mastodon-web.systemd.service.erb"
variables user: user,
app_dir: mastodon_path,
port: node["kosmos-mastodon"]["puma_port"],
bundle_path: "/opt/ruby_build/builds/#{ruby_version}/bin/bundle"
notifies :run, "execute[systemctl daemon-reload]", :delayed
notifies :restart, "service[mastodon-web]", :delayed
command "PATH=\"/usr/local/nodejs-binary-#{node['nodejs']['version']}/bin:/opt/ruby_build/builds/#{ruby_version}/bin:$PATH\" /opt/ruby_build/builds/#{ruby_version}/bin/bundle exec rake assets:precompile"
end
service "mastodon-web" do
action [:enable, :start]
end
# mastodon-sidekiq service
#
template "/lib/systemd/system/mastodon-sidekiq.service" do
source "mastodon-sidekiq.systemd.service.erb"
variables user: user,
app_dir: mastodon_path,
bundle_path: "/opt/ruby_build/builds/#{ruby_version}/bin/bundle",
sidekiq_threads: node["kosmos-mastodon"]["sidekiq_threads"]
notifies :run, "execute[systemctl daemon-reload]", :delayed
notifies :restart, "service[mastodon-sidekiq]", :delayed
end
service "mastodon-sidekiq" do
action [:enable, :start]
end
# mastodon-streaming service
#
template "/lib/systemd/system/mastodon-streaming.service" do
source "mastodon-streaming.systemd.service.erb"
variables user: user,
app_dir: mastodon_path,
port: node["kosmos-mastodon"]["streaming_port"]
notifies :run, "execute[systemctl daemon-reload]", :delayed
notifies :restart, "service[mastodon-streaming]", :delayed
end
service "mastodon-streaming" do
action [:enable, :start]
end

View File

@ -7,6 +7,9 @@
# All rights reserved - Do Not Redistribute
#
node.override['nodejs']['version'] = '10.15.0'
node.override['nodejs']['binary']['checksum']['linux_x64'] = 'f0b4ff9a74cbc0106bbf3ee7715f970101ac5b1bbe814404d7a0673d1da9f674'
# Get package for trusty when still using vivid
if node['lsb']['codename'] == "vivid"
node.override['nodejs']['install_repo'] = false
@ -18,4 +21,4 @@ if node['lsb']['codename'] == "vivid"
key node['nodejs']['key']
end
end
include_recipe 'nodejs'
include_recipe 'nodejs::nodejs_from_binary'