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", "hostname": "akkounts-1",
"ipaddress": "192.168.122.160", "ipaddress": "192.168.122.160",
"roles": [ "roles": [
"postgresql_client", "akkounts",
"akkounts" "postgresql_client"
], ],
"recipes": [ "recipes": [
"kosmos-base", "kosmos-base",
@ -39,6 +39,11 @@
"kosmos-nodejs::default", "kosmos-nodejs::default",
"nodejs::nodejs_from_package", "nodejs::nodejs_from_package",
"nodejs::repo", "nodejs::repo",
"kosmos-redis::default",
"redis::server",
"redis::default",
"backup::default",
"logrotate::default",
"nodejs::npm", "nodejs::npm",
"nodejs::install", "nodejs::install",
"kosmos-nginx::default", "kosmos-nginx::default",
@ -73,4 +78,4 @@
"recipe[kosmos-base]", "recipe[kosmos-base]",
"role[akkounts]" "role[akkounts]"
] ]
} }

View File

@ -9,6 +9,7 @@ chef_version '>= 14.0'
depends 'kosmos-nginx' depends 'kosmos-nginx'
depends "kosmos-nodejs" depends "kosmos-nodejs"
depends "kosmos-redis"
depends "poise-ruby-build" depends "poise-ruby-build"
depends "application" depends "application"
depends 'application_git' depends 'application_git'

View File

@ -2,27 +2,6 @@
# Cookbook:: kosmos-akkounts # Cookbook:: kosmos-akkounts
# Recipe:: default # 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' require 'ipaddr'
app_name = "akkounts" app_name = "akkounts"
@ -42,6 +21,7 @@ end
package "libpq-dev" package "libpq-dev"
include_recipe 'kosmos-nodejs' include_recipe 'kosmos-nodejs'
include_recipe "kosmos-redis"
npm_package "yarn" do npm_package "yarn" do
version "1.22.4" version "1.22.4"
@ -54,7 +34,7 @@ rails_env = node.chef_environment == "development" ? "development" : "production
systemd_unit "akkounts.service" do systemd_unit "akkounts.service" do
content({ content({
Unit: { Unit: {
Description: "Kosmos account management", Description: "Kosmos Accounts",
Documentation: ["https://gitea.kosmos.org/kosmos/akkounts"], Documentation: ["https://gitea.kosmos.org/kosmos/akkounts"],
After: "network.target" After: "network.target"
}, },
@ -79,6 +59,36 @@ systemd_unit "akkounts.service" do
action [:create, :enable] action [:create, :enable]
end 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 application deploy_path do
owner deploy_user owner deploy_user
group deploy_group group deploy_group
@ -143,6 +153,10 @@ application deploy_path do
service "akkounts" do service "akkounts" do
action [:enable, :start] action [:enable, :start]
end end
service "akkounts-sidekiq" do
action [:enable, :start]
end
end end
ejabberd_private_ip_addresses = [] ejabberd_private_ip_addresses = []