Upgrade Mastodon to 3.4.4 #368

Merged
greg merged 2 commits from chore/upgrade_mastodon into master 2021-12-09 13:32:22 +00:00
4 changed files with 41 additions and 6 deletions

View File

@ -8,7 +8,7 @@
"automatic": { "automatic": {
"fqdn": "mastodon-1", "fqdn": "mastodon-1",
"os": "linux", "os": "linux",
"os_version": "5.4.0-1031-kvm", "os_version": "5.4.0-1050-kvm",
"hostname": "mastodon-1", "hostname": "mastodon-1",
"ipaddress": "192.168.122.197", "ipaddress": "192.168.122.197",
"roles": [ "roles": [
@ -18,7 +18,7 @@
"recipes": [ "recipes": [
"kosmos-base", "kosmos-base",
"kosmos-base::default", "kosmos-base::default",
"kosmos-postgresql::hostsfile", "kosmos_postgresql::hostsfile",
"kosmos-mastodon", "kosmos-mastodon",
"kosmos-mastodon::default", "kosmos-mastodon::default",
"kosmos-mastodon::nginx", "kosmos-mastodon::nginx",

View File

@ -1,3 +1,5 @@
node.default["kosmos-mastodon"]["repo"] = "https://gitea.kosmos.org/kosmos/mastodon.git"
node.default["kosmos-mastodon"]["revision"] = "kosmos-production"
node.default["kosmos-mastodon"]["directory"] = "/opt/mastodon" node.default["kosmos-mastodon"]["directory"] = "/opt/mastodon"
node.default["kosmos-mastodon"]["puma_port"] = 3000 node.default["kosmos-mastodon"]["puma_port"] = 3000
node.default["kosmos-mastodon"]["streaming_port"] = 4000 node.default["kosmos-mastodon"]["streaming_port"] = 4000

View File

@ -46,7 +46,7 @@ npm_package "yarn" do
version "1.22.4" version "1.22.4"
end end
ruby_version = "2.6.6" ruby_version = "2.7.2"
execute "systemctl daemon-reload" do execute "systemctl daemon-reload" do
command "systemctl daemon-reload" command "systemctl daemon-reload"
@ -77,6 +77,18 @@ template "/lib/systemd/system/mastodon-sidekiq.service" do
notifies :restart, "service[mastodon-sidekiq]", :delayed notifies :restart, "service[mastodon-sidekiq]", :delayed
end end
# mastodon-sidekiq-scheduler service
#
template "/lib/systemd/system/mastodon-sidekiq-scheduler.service" do
source "mastodon-sidekiq-scheduler.systemd.service.erb"
variables user: mastodon_user,
app_dir: mastodon_path,
bundle_path: "/opt/ruby_build/builds/#{ruby_version}/bin/bundle",
sidekiq_threads: 1
notifies :run, "execute[systemctl daemon-reload]", :immediately
notifies :restart, "service[mastodon-sidekiq-scheduler]", :delayed
end
# mastodon-streaming service # mastodon-streaming service
# #
template "/lib/systemd/system/mastodon-streaming.service" do template "/lib/systemd/system/mastodon-streaming.service" do
@ -106,8 +118,8 @@ application mastodon_path do
git do git do
user mastodon_user user mastodon_user
group mastodon_user group mastodon_user
repository "https://gitea.kosmos.org/kosmos/mastodon.git" repository node["kosmos-mastodon"]["repo"]
revision "production" revision node["kosmos-mastodon"]["revision"]
# Restart services on deployments # Restart services on deployments
notifies :restart, "application[#{mastodon_path}]", :delayed notifies :restart, "application[#{mastodon_path}]", :delayed
end end
@ -153,7 +165,7 @@ application mastodon_path do
end end
execute 'rake db:migrate' do execute 'rake db:migrate' do
environment "RAILS_ENV" => "production", "HOME" => mastodon_path environment "RAILS_ENV" => "production", "HOME" => mastodon_path#, "SKIP_POST_DEPLOYMENT_MIGRATIONS" => "true"
user mastodon_user user mastodon_user
group mastodon_user group mastodon_user
cwd mastodon_path cwd mastodon_path
@ -176,6 +188,10 @@ application mastodon_path do
action [:enable, :start] action [:enable, :start]
end end
service "mastodon-sidekiq-scheduler" do
action [:enable, :start]
end
service "mastodon-streaming" do service "mastodon-streaming" do
action [:enable, :start] action [:enable, :start]
end end

View File

@ -0,0 +1,17 @@
[Unit]
Description=mastodon-sidekiq-scheduler
Requires=redis-server.service
After=redis-server.service
[Service]
Type=simple
User=<%= @user %>
WorkingDirectory=<%= @app_dir %>
Environment="RAILS_ENV=production"
Environment="LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.1"
ExecStart=<%= @bundle_path %> exec sidekiq -c <%= @sidekiq_threads %> -q scheduler
TimeoutSec=15
Restart=always
[Install]
WantedBy=multi-user.target