Use ruby-build for Mastodon, update cookbooks
This uses the ruby_build provider for Mastodon, installing Ruby 2.4.1 currently. It also updates some other cookbooks and the runlists.
This commit is contained in:
@@ -17,9 +17,6 @@ package 'mailutils'
|
||||
node.override['unattended-upgrades']['admin_email'] = 'ops@5apps.com'
|
||||
include_recipe 'unattended-upgrades'
|
||||
|
||||
package 'ruby2.1'
|
||||
package 'ruby2.1-dev'
|
||||
|
||||
package 'mosh'
|
||||
|
||||
# Searches data bag "users" for groups attribute "sysadmin".
|
||||
|
||||
@@ -8,7 +8,8 @@ version '0.1.0'
|
||||
|
||||
depends "kosmos-nginx"
|
||||
depends "kosmos-nodejs"
|
||||
depends "kosmos-ruby"
|
||||
depends "kosmos-redis"
|
||||
depends "poise-ruby-build"
|
||||
depends "application_ruby"
|
||||
depends "application_javascript"
|
||||
depends "postgresql"
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#
|
||||
|
||||
include_recipe "kosmos-nodejs"
|
||||
include_recipe "kosmos-ruby"
|
||||
# include_recipe "kosmos-ruby"
|
||||
node.override['postgresql']['enable_pgdg_apt'] = false
|
||||
include_recipe "postgresql::server"
|
||||
include_recipe "postgresql::ruby"
|
||||
@@ -52,7 +52,7 @@ application mastodon_path do
|
||||
user "mastodon"
|
||||
group "mastodon"
|
||||
repository "https://github.com/67P/mastodon.git"
|
||||
revision "kosmos"
|
||||
revision "staging"
|
||||
end
|
||||
|
||||
mastodon_credentials = Chef::EncryptedDataBagItem.load('credentials', 'mastodon')
|
||||
@@ -83,6 +83,11 @@ application mastodon_path do
|
||||
recursive true
|
||||
end
|
||||
|
||||
ruby_runtime do
|
||||
provider :ruby_build
|
||||
version '2.4.1'
|
||||
end
|
||||
|
||||
bundle_install do
|
||||
user "mastodon"
|
||||
deployment true
|
||||
@@ -109,9 +114,10 @@ application mastodon_path do
|
||||
source "mastodon-web.systemd.service.erb"
|
||||
variables user: user,
|
||||
app_dir: mastodon_path,
|
||||
port: node["kosmos-mastodon"]["puma_port"]
|
||||
port: node["kosmos-mastodon"]["puma_port"],
|
||||
bundle_path: '/opt/ruby_build/builds/opt/mastodon/bin/bundle'
|
||||
notifies :run, "execute[systemctl daemon-reload]", :delayed
|
||||
notifies :restart, "service[mastodon-web]", :delayed
|
||||
# notifies :restart, "service[mastodon-web]", :delayed
|
||||
end
|
||||
|
||||
service "mastodon-web" do
|
||||
@@ -123,9 +129,10 @@ application mastodon_path do
|
||||
template "/lib/systemd/system/mastodon-sidekiq.service" do
|
||||
source "mastodon-sidekiq.systemd.service.erb"
|
||||
variables user: user,
|
||||
app_dir: mastodon_path
|
||||
app_dir: mastodon_path,
|
||||
bundle_path: '/opt/ruby_build/builds/opt/mastodon/bin/bundle'
|
||||
notifies :run, "execute[systemctl daemon-reload]", :delayed
|
||||
notifies :restart, "service[mastodon-sidekiq]", :delayed
|
||||
# notifies :restart, "service[mastodon-sidekiq]", :delayed
|
||||
end
|
||||
|
||||
service "mastodon-sidekiq" do
|
||||
@@ -140,7 +147,7 @@ application mastodon_path do
|
||||
app_dir: mastodon_path,
|
||||
port: node["kosmos-mastodon"]["streaming_port"]
|
||||
notifies :run, "execute[systemctl daemon-reload]", :delayed
|
||||
notifies :restart, "service[mastodon-streaming]", :delayed
|
||||
# notifies :restart, "service[mastodon-streaming]", :delayed
|
||||
end
|
||||
|
||||
service "mastodon-streaming" do
|
||||
@@ -148,10 +155,10 @@ application mastodon_path do
|
||||
end
|
||||
end
|
||||
|
||||
unless node.chef_environment == "development"
|
||||
# Backup the database to S3
|
||||
node.override["backup"]["postgresql"]["host"] = "localhost"
|
||||
node.override["backup"]["postgresql"]["username"] = "postgres"
|
||||
node.override["backup"]["postgresql"]["password"] = node['postgresql']['password']['postgres']
|
||||
include_recipe "backup"
|
||||
end
|
||||
# unless node.chef_environment == "development"
|
||||
# # Backup the database to S3
|
||||
# node.override["backup"]["postgresql"]["host"] = "localhost"
|
||||
# node.override["backup"]["postgresql"]["username"] = "postgres"
|
||||
# node.override["backup"]["postgresql"]["password"] = node['postgresql']['password']['postgres']
|
||||
# include_recipe "backup"
|
||||
# end
|
||||
|
||||
@@ -9,7 +9,7 @@ User=<%= @user %>
|
||||
WorkingDirectory=<%= @app_dir %>
|
||||
Environment="RAILS_ENV=production"
|
||||
Environment="DB_POOL=5"
|
||||
ExecStart=/usr/local/bin/bundle exec sidekiq -c 5 -q default -q mailers -q pull -q push
|
||||
ExecStart=<%= @bundle_path %> exec sidekiq -c 5 -q default -q mailers -q pull -q push
|
||||
TimeoutSec=15
|
||||
Restart=always
|
||||
|
||||
|
||||
@@ -12,10 +12,10 @@ PIDFile=<%= @app_dir %>/tmp/puma.pid
|
||||
WorkingDirectory=<%= @app_dir %>
|
||||
Environment="RAILS_ENV=production"
|
||||
Environment="PORT=3000"
|
||||
ExecStart=/usr/local/bin/bundle exec puma -C config/puma.rb --pidfile <%= @app_dir %>/tmp/puma.pid
|
||||
ExecStop=/usr/local/bin/bundle exec puma -C config/puma.rb --pidfile <%= @app_dir %>/tmp/puma.pid stop
|
||||
ExecReload=/usr/local/bin/bundle exec pumactl -F config/puma.rb --pidfile <%= @app_dir %>/tmp/puma.pid phased-restart
|
||||
ExecRestart=/usr/local/bin/bundle exec pumactl -F config/puma.rb --pidfile <%= @app_dir %>/tmp/puma.pid restart
|
||||
ExecStart=<%= @bundle_path %> exec puma -C config/puma.rb --pidfile <%= @app_dir %>/tmp/puma.pid
|
||||
ExecStop=<%= @bundle_path %> exec puma -C config/puma.rb --pidfile <%= @app_dir %>/tmp/puma.pid stop
|
||||
ExecReload=<%= @bundle_path %> exec pumactl -F config/puma.rb --pidfile <%= @app_dir %>/tmp/puma.pid phased-restart
|
||||
ExecRestart=<%= @bundle_path %> exec pumactl -F config/puma.rb --pidfile <%= @app_dir %>/tmp/puma.pid restart
|
||||
TimeoutSec=15
|
||||
Restart=always
|
||||
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
# kosmos-ruby CHANGELOG
|
||||
|
||||
This file is used to list changes made in each version of the kosmos-ruby cookbook.
|
||||
|
||||
## 0.1.0
|
||||
- [your_name] - Initial release of kosmos-ruby
|
||||
|
||||
- - -
|
||||
Check the [Markdown Syntax Guide](http://daringfireball.net/projects/markdown/syntax) for help with Markdown.
|
||||
|
||||
The [Github Flavored Markdown page](http://github.github.com/github-flavored-markdown/) describes the differences between markdown on github and standard markdown.
|
||||
@@ -1,80 +0,0 @@
|
||||
# kosmos-ruby Cookbook
|
||||
|
||||
TODO: Enter the cookbook description here.
|
||||
|
||||
e.g.
|
||||
This cookbook makes your favorite breakfast sandwich.
|
||||
|
||||
## Requirements
|
||||
|
||||
TODO: List your cookbook requirements. Be sure to include any requirements this cookbook has on platforms, libraries, other cookbooks, packages, operating systems, etc.
|
||||
|
||||
e.g.
|
||||
### Platforms
|
||||
|
||||
- SandwichOS
|
||||
|
||||
### Chef
|
||||
|
||||
- Chef 12.0 or later
|
||||
|
||||
### Cookbooks
|
||||
|
||||
- `toaster` - kosmos-ruby needs toaster to brown your bagel.
|
||||
|
||||
## Attributes
|
||||
|
||||
TODO: List your cookbook attributes here.
|
||||
|
||||
e.g.
|
||||
### kosmos-ruby::default
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Key</th>
|
||||
<th>Type</th>
|
||||
<th>Description</th>
|
||||
<th>Default</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><tt>['kosmos-ruby']['bacon']</tt></td>
|
||||
<td>Boolean</td>
|
||||
<td>whether to include bacon</td>
|
||||
<td><tt>true</tt></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
## Usage
|
||||
|
||||
### kosmos-ruby::default
|
||||
|
||||
TODO: Write usage instructions for each cookbook.
|
||||
|
||||
e.g.
|
||||
Just include `kosmos-ruby` in your node's `run_list`:
|
||||
|
||||
```json
|
||||
{
|
||||
"name":"my_node",
|
||||
"run_list": [
|
||||
"recipe[kosmos-ruby]"
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
TODO: (optional) If this is a public cookbook, detail the process for contributing. If this is a private cookbook, remove this section.
|
||||
|
||||
e.g.
|
||||
1. Fork the repository on Github
|
||||
2. Create a named feature branch (like `add_component_x`)
|
||||
3. Write your change
|
||||
4. Write tests for your change (if applicable)
|
||||
5. Run the tests, ensuring they all pass
|
||||
6. Submit a Pull Request using Github
|
||||
|
||||
## License and Authors
|
||||
|
||||
Authors: TODO: List authors
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
default['kosmos-ruby']['version'] = '2.3'
|
||||
@@ -1,7 +0,0 @@
|
||||
name 'kosmos-ruby'
|
||||
maintainer 'Kosmos'
|
||||
maintainer_email 'mail@kosmos.org'
|
||||
license 'All rights reserved'
|
||||
description 'Installs/Configures kosmos-ruby'
|
||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||
version '0.1.0'
|
||||
@@ -1,54 +0,0 @@
|
||||
#
|
||||
# Cookbook Name:: kosmos-ruby
|
||||
# Recipe:: default
|
||||
#
|
||||
# Copyright 2017, Kosmos
|
||||
#
|
||||
# All rights reserved - Do Not Redistribute
|
||||
#
|
||||
|
||||
package_name = "ruby#{node['kosmos-ruby']['version']}"
|
||||
|
||||
apt_repository 'brightbox_ruby' do
|
||||
uri 'http://ppa.launchpad.net/brightbox/ruby-ng/ubuntu'
|
||||
distribution node['lsb']['codename']
|
||||
components ['main']
|
||||
keyserver 'keyserver.ubuntu.com'
|
||||
key '80F70E11F0F0D5F10CB20E62F5DA5F09C3173AA6'
|
||||
end
|
||||
|
||||
packages = [
|
||||
"ruby#{node['kosmos-ruby']['version']}",
|
||||
"ruby#{node['kosmos-ruby']['version']}-dev",
|
||||
"build-essential",
|
||||
"libssl-dev",
|
||||
"zlib1g-dev"
|
||||
]
|
||||
|
||||
apt_package packages do
|
||||
action :install
|
||||
end
|
||||
|
||||
apt_package 'ruby-switch' do
|
||||
action :install
|
||||
notifies :run, 'execute[set default ruby]', :immediately
|
||||
end
|
||||
|
||||
execute 'set default ruby' do
|
||||
command "ruby-switch --set #{package_name}"
|
||||
action :nothing
|
||||
notifies :reload, 'ohai[reload]', :immediately
|
||||
end
|
||||
|
||||
ohai 'reload' do
|
||||
action :nothing
|
||||
end
|
||||
|
||||
execute 'update rubygems' do
|
||||
command 'gem update --system 2.6.8'
|
||||
not_if "gem --version | grep ^2.6.8$"
|
||||
end
|
||||
|
||||
gem_package "bundler" do
|
||||
version "1.13.2"
|
||||
end
|
||||
Reference in New Issue
Block a user