From 56da9e2c41e5008fa5784dcae4882d609badec7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Kar=C3=A9kinian?= Date: Tue, 8 Jan 2019 16:44:10 +0100 Subject: [PATCH 1/5] Update the nodejs cookbook to 6.0.0 --- Berksfile | 2 +- Berksfile.lock | 6 +++--- cookbooks/nodejs/CHANGELOG.md | 5 +++++ cookbooks/nodejs/attributes/default.rb | 10 +++++----- cookbooks/nodejs/metadata.json | 2 +- cookbooks/nodejs/recipes/nodejs_from_source.rb | 2 +- 6 files changed, 16 insertions(+), 11 deletions(-) diff --git a/Berksfile b/Berksfile index f542d9e..d8d0ca2 100644 --- a/Berksfile +++ b/Berksfile @@ -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' diff --git a/Berksfile.lock b/Berksfile.lock index 9478720..bb1877e 100644 --- a/Berksfile.lock +++ b/Berksfile.lock @@ -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) diff --git a/cookbooks/nodejs/CHANGELOG.md b/cookbooks/nodejs/CHANGELOG.md index 752de3f..0b1c31e 100644 --- a/cookbooks/nodejs/CHANGELOG.md +++ b/cookbooks/nodejs/CHANGELOG.md @@ -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. diff --git a/cookbooks/nodejs/attributes/default.rb b/cookbooks/nodejs/attributes/default.rb index 2ab61bf..88357a6 100644 --- a/cookbooks/nodejs/attributes/default.rb +++ b/cookbooks/nodejs/attributes/default.rb @@ -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 diff --git a/cookbooks/nodejs/metadata.json b/cookbooks/nodejs/metadata.json index 0c1afd9..b24d20c 100644 --- a/cookbooks/nodejs/metadata.json +++ b/cookbooks/nodejs/metadata.json @@ -1 +1 @@ -{"name":"nodejs","version":"5.0.0","description":"Installs/Configures node.js","long_description":"# [nodejs-cookbook](https://github.com/redguide/nodejs)\n\n[![CK Version](http://img.shields.io/cookbook/v/nodejs.svg?branch=master)](https://supermarket.chef.io/cookbooks/nodejs) [![Build Status](https://img.shields.io/travis/redguide/nodejs.svg)](https://travis-ci.org/redguide/nodejs) [![Gitter chat](https://badges.gitter.im/redguide/nodejs.svg)](https://gitter.im/redguide/nodejs)\n\nInstalls node.js/npm and includes a resource for managing npm packages\n\n## Requirements\n\n### Platforms\n\n- Debian/Ubuntu\n- RHEL/CentOS/Scientific/Amazon/Oracle\n- openSUSE\n\nNote: Source installs require GCC 4.8+, which is not included on older distro releases\n\n### Chef\n\n- Chef 12.14+\n\n### Cookbooks\n\n- build-essential\n- ark\n\n## Usage\n\nInclude the nodejs recipe to install node on your system based on the default installation method:\n\n```chef\ninclude_recipe \"nodejs\"\n```\n\n### Install methods\n\n#### Package\n\nInstall node from packages:\n\n```chef\nnode['nodejs']['install_method'] = 'package' # Not necessary because it's the default\ninclude_recipe \"nodejs\"\n# Or\ninclude_recipe \"nodejs::nodejs_from_package\"\n```\n\nBy default this will setup deb/rpm repositories from nodesource.com, which include up to date NodeJS packages. If you prefer to use distro provided package you can disable this behavior by setting `node['nodejs']['install_repo']` to `false`.\n\n#### Binary\n\nInstall node from official prebuilt binaries:\n\n```chef\nnode['nodejs']['install_method'] = 'binary'\ninclude_recipe \"nodejs\"\n\n# Or\ninclude_recipe \"nodejs::nodejs_from_binary\"\n\n# Or set a specific version of nodejs to be installed\nnode.default['nodejs']['install_method'] = 'binary'\nnode.default['nodejs']['version'] = '5.9.0'\nnode.default['nodejs']['binary']['checksum'] = '99c4136cf61761fac5ac57f80544140a3793b63e00a65d4a0e528c9db328bf40'\n\n# Or fetch the binary from your own location\nnode.default['nodejs']['install_method'] = 'binary'\nnode.default['nodejs']['binary']['url'] = 'https://s3.amazonaws.com/my-bucket/node-v7.8.0-linux-x64.tar.gz'\nnode.default['nodejs']['binary']['checksum'] = '0bd86f2a39221b532172c7d1acb57f0b0cba88c7b82ea74ba9d1208b9f6f9697'\n```\n\n#### Source\n\nInstall node from sources:\n\n```chef\nnode['nodejs']['install_method'] = 'source'\ninclude_recipe \"nodejs\"\n# Or\ninclude_recipe \"nodejs::nodejs_from_source\"\n```\n\n## NPM\n\nNpm is included in nodejs installs by default. By default, we are using it and call it `embedded`. Adding recipe `nodejs::npm` assure you to have npm installed and let you choose install method with `node['nodejs']['npm']['install_method']`\n\n```chef\ninclude_recipe \"nodejs::npm\"\n```\n\n_Warning:_ This recipe will include the `nodejs` recipe, which by default includes `nodejs::nodejs_from_package` if you did not set `node['nodejs']['install_method']`.\n\n## Resources\n\n### npm_package\n\nnote: This resource was previously named nodejs_npm. Calls to that resource name will still function, but cookbooks should be updated for the new npm_package resource name.\n\n`npm_package` let you install npm packages from various sources:\n\n- npm registry:\n\n - name: `property :package`\n - version: `property :version` (optional)\n\n- url: `property :url`\n\n - for git use `git://{your_repo}`\n\n- from a json (package.json by default): `property :json`\n\n - use `true` for default\n - use a `String` to specify json file\n\nPackages can be installed globally (by default) or in a directory (by using `attribute :path`)\n\nYou can specify an `NPM_TOKEN` environment variable for accessing [NPM private modules](https://docs.npmjs.com/private-modules/intro) by using `attribute :npm_token`\n\nYou can append more specific options to npm command with `attribute :options` array :\n\n- use an array of options (w/ dash), they will be added to npm call.\n- ex: `['--production','--force']` or `['--force-latest']`\n\nThis LWRP attempts to use vanilla npm as much as possible (no custom wrapper).\n\n### Packages\n\n```ruby\nnpm_package 'express'\n\nnpm_package 'async' do\n version '0.6.2'\nend\n\nnpm_package 'request' do\n url 'github mikeal/request'\nend\n\nnpm_package 'grunt' do\n path '/home/random/grunt'\n json true\n user 'random'\nend\n\nnpm_package 'my_private_module' do\n path '/home/random/myproject' # The root path to your project, containing a package.json file\n json true\n npm_token '12345-abcde-e5d4c3b2a1'\n user 'random'\n options ['--production'] # Only install dependencies. Skip devDependencies\nend\n```\n\n[Working Examples](test/cookbooks/nodejs_test/recipes/npm.rb)\n\nOr add packages via attributes (which accept the same attributes as the LWRP above):\n\n```json\n\"nodejs\": {\n \"npm_packages\": [\n {\n \"name\": \"express\"\n },\n {\n \"name\": \"async\",\n \"version\": \"0.6.2\"\n },\n {\n \"name\": \"request\",\n \"url\": \"github mikeal/request\"\n }\n {\n \"name\": \"grunt\",\n \"path\": \"/home/random/grunt\",\n \"json\": true,\n \"user\": \"random\"\n }\n ]\n}\n```\n\n## License & Authors\n\n**Author:** Marius Ducea (marius@promethost.com) **Author:** Nathan L Smith (nlloyds@gmail.com) **Author:** Guilhem Lettron (guilhem@lettron.fr) **Author:** Barthelemy Vessemont (bvessemont@gmail.com)\n\n**Copyright:** 2008-2017, Chef Software, Inc.\n\n```\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","maintainer":"redguide","maintainer_email":"guilhem@lettron.fr","license":"Apache-2.0","platforms":{"debian":">= 0.0.0","ubuntu":">= 0.0.0","centos":">= 0.0.0","redhat":">= 0.0.0","scientific":">= 0.0.0","oracle":">= 0.0.0","amazon":">= 0.0.0","smartos":">= 0.0.0","mac_os_x":">= 0.0.0","opensuseleap":">= 0.0.0","suse":">= 0.0.0"},"dependencies":{"build-essential":">= 0.0.0","ark":">= 2.0.2"},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{},"source_url":"https://github.com/redguide/nodejs","issues_url":"https://github.com/redguide/nodejs/issues","chef_version":[[">= 12.14"]],"ohai_version":[]} \ No newline at end of file +{"name":"nodejs","version":"6.0.0","description":"Installs/Configures node.js","long_description":"# [nodejs-cookbook](https://github.com/redguide/nodejs)\n\n[![CK Version](http://img.shields.io/cookbook/v/nodejs.svg?branch=master)](https://supermarket.chef.io/cookbooks/nodejs) [![Build Status](https://img.shields.io/travis/redguide/nodejs.svg)](https://travis-ci.org/redguide/nodejs) [![Gitter chat](https://badges.gitter.im/redguide/nodejs.svg)](https://gitter.im/redguide/nodejs)\n\nInstalls node.js/npm and includes a resource for managing npm packages\n\n## Requirements\n\n### Platforms\n\n- Debian/Ubuntu\n- RHEL/CentOS/Scientific/Amazon/Oracle\n- openSUSE\n\nNote: Source installs require GCC 4.8+, which is not included on older distro releases\n\n### Chef\n\n- Chef 12.14+\n\n### Cookbooks\n\n- build-essential\n- ark\n\n## Usage\n\nInclude the nodejs recipe to install node on your system based on the default installation method:\n\n```chef\ninclude_recipe \"nodejs\"\n```\n\n### Install methods\n\n#### Package\n\nInstall node from packages:\n\n```chef\nnode['nodejs']['install_method'] = 'package' # Not necessary because it's the default\ninclude_recipe \"nodejs\"\n# Or\ninclude_recipe \"nodejs::nodejs_from_package\"\n```\n\nBy default this will setup deb/rpm repositories from nodesource.com, which include up to date NodeJS packages. If you prefer to use distro provided package you can disable this behavior by setting `node['nodejs']['install_repo']` to `false`.\n\n#### Binary\n\nInstall node from official prebuilt binaries:\n\n```chef\nnode['nodejs']['install_method'] = 'binary'\ninclude_recipe \"nodejs\"\n\n# Or\ninclude_recipe \"nodejs::nodejs_from_binary\"\n\n# Or set a specific version of nodejs to be installed\nnode.default['nodejs']['install_method'] = 'binary'\nnode.default['nodejs']['version'] = '5.9.0'\nnode.default['nodejs']['binary']['checksum'] = '99c4136cf61761fac5ac57f80544140a3793b63e00a65d4a0e528c9db328bf40'\n\n# Or fetch the binary from your own location\nnode.default['nodejs']['install_method'] = 'binary'\nnode.default['nodejs']['binary']['url'] = 'https://s3.amazonaws.com/my-bucket/node-v7.8.0-linux-x64.tar.gz'\nnode.default['nodejs']['binary']['checksum'] = '0bd86f2a39221b532172c7d1acb57f0b0cba88c7b82ea74ba9d1208b9f6f9697'\n```\n\n#### Source\n\nInstall node from sources:\n\n```chef\nnode['nodejs']['install_method'] = 'source'\ninclude_recipe \"nodejs\"\n# Or\ninclude_recipe \"nodejs::nodejs_from_source\"\n```\n\n## NPM\n\nNpm is included in nodejs installs by default. By default, we are using it and call it `embedded`. Adding recipe `nodejs::npm` assure you to have npm installed and let you choose install method with `node['nodejs']['npm']['install_method']`\n\n```chef\ninclude_recipe \"nodejs::npm\"\n```\n\n_Warning:_ This recipe will include the `nodejs` recipe, which by default includes `nodejs::nodejs_from_package` if you did not set `node['nodejs']['install_method']`.\n\n## Resources\n\n### npm_package\n\nnote: This resource was previously named nodejs_npm. Calls to that resource name will still function, but cookbooks should be updated for the new npm_package resource name.\n\n`npm_package` let you install npm packages from various sources:\n\n- npm registry:\n\n - name: `property :package`\n - version: `property :version` (optional)\n\n- url: `property :url`\n\n - for git use `git://{your_repo}`\n\n- from a json (package.json by default): `property :json`\n\n - use `true` for default\n - use a `String` to specify json file\n\nPackages can be installed globally (by default) or in a directory (by using `attribute :path`)\n\nYou can specify an `NPM_TOKEN` environment variable for accessing [NPM private modules](https://docs.npmjs.com/private-modules/intro) by using `attribute :npm_token`\n\nYou can append more specific options to npm command with `attribute :options` array :\n\n- use an array of options (w/ dash), they will be added to npm call.\n- ex: `['--production','--force']` or `['--force-latest']`\n\nThis LWRP attempts to use vanilla npm as much as possible (no custom wrapper).\n\n### Packages\n\n```ruby\nnpm_package 'express'\n\nnpm_package 'async' do\n version '0.6.2'\nend\n\nnpm_package 'request' do\n url 'github mikeal/request'\nend\n\nnpm_package 'grunt' do\n path '/home/random/grunt'\n json true\n user 'random'\nend\n\nnpm_package 'my_private_module' do\n path '/home/random/myproject' # The root path to your project, containing a package.json file\n json true\n npm_token '12345-abcde-e5d4c3b2a1'\n user 'random'\n options ['--production'] # Only install dependencies. Skip devDependencies\nend\n```\n\n[Working Examples](test/cookbooks/nodejs_test/recipes/npm.rb)\n\nOr add packages via attributes (which accept the same attributes as the LWRP above):\n\n```json\n\"nodejs\": {\n \"npm_packages\": [\n {\n \"name\": \"express\"\n },\n {\n \"name\": \"async\",\n \"version\": \"0.6.2\"\n },\n {\n \"name\": \"request\",\n \"url\": \"github mikeal/request\"\n }\n {\n \"name\": \"grunt\",\n \"path\": \"/home/random/grunt\",\n \"json\": true,\n \"user\": \"random\"\n }\n ]\n}\n```\n\n## License & Authors\n\n**Author:** Marius Ducea (marius@promethost.com) **Author:** Nathan L Smith (nlloyds@gmail.com) **Author:** Guilhem Lettron (guilhem@lettron.fr) **Author:** Barthelemy Vessemont (bvessemont@gmail.com)\n\n**Copyright:** 2008-2017, Chef Software, Inc.\n\n```\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","maintainer":"redguide","maintainer_email":"guilhem@lettron.fr","license":"Apache-2.0","platforms":{"debian":">= 0.0.0","ubuntu":">= 0.0.0","centos":">= 0.0.0","redhat":">= 0.0.0","scientific":">= 0.0.0","oracle":">= 0.0.0","amazon":">= 0.0.0","smartos":">= 0.0.0","mac_os_x":">= 0.0.0","opensuseleap":">= 0.0.0","suse":">= 0.0.0"},"dependencies":{"build-essential":">= 5.0","ark":">= 2.0.2"},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{},"source_url":"https://github.com/redguide/nodejs","issues_url":"https://github.com/redguide/nodejs/issues","chef_version":[[">= 12.14"]],"ohai_version":[]} \ No newline at end of file diff --git a/cookbooks/nodejs/recipes/nodejs_from_source.rb b/cookbooks/nodejs/recipes/nodejs_from_source.rb index ace91e1..5771912 100644 --- a/cookbooks/nodejs/recipes/nodejs_from_source.rb +++ b/cookbooks/nodejs/recipes/nodejs_from_source.rb @@ -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' -- 2.25.1 From 973c65631d63140031cca1db1e567ebfbde3a3ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Kar=C3=A9kinian?= Date: Tue, 8 Jan 2019 16:44:37 +0100 Subject: [PATCH 2/5] Update nodejs to 10.15.0 (LTS) using new upstream nodejs cookbook --- site-cookbooks/kosmos-nodejs/recipes/default.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/site-cookbooks/kosmos-nodejs/recipes/default.rb b/site-cookbooks/kosmos-nodejs/recipes/default.rb index 996bf4a..320402b 100644 --- a/site-cookbooks/kosmos-nodejs/recipes/default.rb +++ b/site-cookbooks/kosmos-nodejs/recipes/default.rb @@ -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' -- 2.25.1 From 1bc589ffc668252035920451f81fb2be390e821a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Kar=C3=A9kinian?= Date: Tue, 8 Jan 2019 16:55:58 +0100 Subject: [PATCH 3/5] Move the creation of the SystemD service files outside of the application This prevents a crash on the initial Chef run due to the service files not being there yet before the services gets notified to restart --- .../kosmos-mastodon/recipes/default.rb | 80 +++++++++---------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/site-cookbooks/kosmos-mastodon/recipes/default.rb b/site-cookbooks/kosmos-mastodon/recipes/default.rb index 2e14300..58df06f 100644 --- a/site-cookbooks/kosmos-mastodon/recipes/default.rb +++ b/site-cookbooks/kosmos-mastodon/recipes/default.rb @@ -50,6 +50,46 @@ end ruby_version = "2.5.3" +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" @@ -127,54 +167,14 @@ application mastodon_path do 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 - 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 -- 2.25.1 From 82fdd8c6fda9d1fab11fcaf93648d6612a275c14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Kar=C3=A9kinian?= Date: Tue, 8 Jan 2019 17:00:10 +0100 Subject: [PATCH 4/5] Install bundler 1.17.3 since we're still on Ruby 2.5 for now Bundler 2.0 needs Ruby 2.6 or RubyGems 3.0 --- site-cookbooks/kosmos-mastodon/recipes/default.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/site-cookbooks/kosmos-mastodon/recipes/default.rb b/site-cookbooks/kosmos-mastodon/recipes/default.rb index 58df06f..28c48f8 100644 --- a/site-cookbooks/kosmos-mastodon/recipes/default.rb +++ b/site-cookbooks/kosmos-mastodon/recipes/default.rb @@ -101,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" -- 2.25.1 From 2bd8bf14e6771a9702f8fbe8a5cbb6edb8aa61a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Kar=C3=A9kinian?= Date: Tue, 8 Jan 2019 17:01:00 +0100 Subject: [PATCH 5/5] Add the PATH to the current nodejs version in order to run yarn --- site-cookbooks/kosmos-mastodon/recipes/default.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/site-cookbooks/kosmos-mastodon/recipes/default.rb b/site-cookbooks/kosmos-mastodon/recipes/default.rb index 28c48f8..9a0273a 100644 --- a/site-cookbooks/kosmos-mastodon/recipes/default.rb +++ b/site-cookbooks/kosmos-mastodon/recipes/default.rb @@ -151,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 @@ -168,7 +168,7 @@ 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" + 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 -- 2.25.1