Configure/run Sidekiq for Akkounts

This commit is contained in:
Basti 2021-02-03 19:53:13 +01:00
parent 241f0807b3
commit 1adf3281bf
Signed by untrusted user: basti
GPG Key ID: 9F88009D31D99C72
3 changed files with 45 additions and 25 deletions

View File

@ -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]"
]
}
}

View File

@ -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'

View File

@ -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 = []