From 1adf3281bfa1f878523a621f4c94c96bb458893c Mon Sep 17 00:00:00 2001 From: Sebastian Kippe Date: Wed, 3 Feb 2021 19:53:13 +0100 Subject: [PATCH] Configure/run Sidekiq for Akkounts --- nodes/akkounts-1.json | 11 +++- site-cookbooks/kosmos-akkounts/metadata.rb | 1 + .../kosmos-akkounts/recipes/default.rb | 58 ++++++++++++------- 3 files changed, 45 insertions(+), 25 deletions(-) diff --git a/nodes/akkounts-1.json b/nodes/akkounts-1.json index 1f606a0..411d304 100644 --- a/nodes/akkounts-1.json +++ b/nodes/akkounts-1.json @@ -12,8 +12,8 @@ "hostname": "akkounts-1", "ipaddress": "192.168.122.160", "roles": [ - "postgresql_client", - "akkounts" + "akkounts", + "postgresql_client" ], "recipes": [ "kosmos-base", @@ -39,6 +39,11 @@ "kosmos-nodejs::default", "nodejs::nodejs_from_package", "nodejs::repo", + "kosmos-redis::default", + "redis::server", + "redis::default", + "backup::default", + "logrotate::default", "nodejs::npm", "nodejs::install", "kosmos-nginx::default", @@ -73,4 +78,4 @@ "recipe[kosmos-base]", "role[akkounts]" ] -} +} \ No newline at end of file diff --git a/site-cookbooks/kosmos-akkounts/metadata.rb b/site-cookbooks/kosmos-akkounts/metadata.rb index 04b9892..695ce6b 100644 --- a/site-cookbooks/kosmos-akkounts/metadata.rb +++ b/site-cookbooks/kosmos-akkounts/metadata.rb @@ -9,6 +9,7 @@ chef_version '>= 14.0' depends 'kosmos-nginx' depends "kosmos-nodejs" +depends "kosmos-redis" depends "poise-ruby-build" depends "application" depends 'application_git' diff --git a/site-cookbooks/kosmos-akkounts/recipes/default.rb b/site-cookbooks/kosmos-akkounts/recipes/default.rb index 88ef6b2..9b736aa 100644 --- a/site-cookbooks/kosmos-akkounts/recipes/default.rb +++ b/site-cookbooks/kosmos-akkounts/recipes/default.rb @@ -2,27 +2,6 @@ # Cookbook:: kosmos-akkounts # Recipe:: default # -# The MIT License (MIT) -# Copyright:: 2020, Kosmos Developers -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# require 'ipaddr' app_name = "akkounts" @@ -42,6 +21,7 @@ end package "libpq-dev" include_recipe 'kosmos-nodejs' +include_recipe "kosmos-redis" npm_package "yarn" do version "1.22.4" @@ -54,7 +34,7 @@ rails_env = node.chef_environment == "development" ? "development" : "production systemd_unit "akkounts.service" do content({ Unit: { - Description: "Kosmos account management", + Description: "Kosmos Accounts", Documentation: ["https://gitea.kosmos.org/kosmos/akkounts"], After: "network.target" }, @@ -79,6 +59,36 @@ systemd_unit "akkounts.service" do action [:create, :enable] end +systemd_unit "akkounts-sidekiq.service" do + content({ + Unit: { + Description: "Kosmos Accounts async/background jobs", + Documentation: ["https://gitea.kosmos.org/kosmos/akkounts"], + Requires: "redis-server.service", + After: "syslog.target network.target redis-server.service" + }, + Service: { + Type: "notify", + User: deploy_user, + WorkingDirectory: deploy_path, + Environment: "MALLOC_ARENA_MAX=2", + ExecStart: "#{bundle_path} exec sidekiq -C #{deploy_path}/config/sidekiq.yml -e production", + WatchdogSec: "10", + Restart: "on-failure", + RestartSec: "1", + StandardOutput: "syslog", + StandardError: "syslog", + SyslogIdentifier: "sidekiq" + }, + Install: { + WantedBy: "multi-user.target" + } + }) + verify false + triggers_reload true + action [:create, :enable] +end + application deploy_path do owner deploy_user group deploy_group @@ -143,6 +153,10 @@ application deploy_path do service "akkounts" do action [:enable, :start] end + + service "akkounts-sidekiq" do + action [:enable, :start] + end end ejabberd_private_ip_addresses = []