Skip to content
Snippets Groups Projects
Commit 57b0a011 authored by Israel Barreto Sant'Anna's avatar Israel Barreto Sant'Anna
Browse files

Added Sidekiq 6 new service and config files. Updated dalli store config for new version

parent 2d042293
No related branches found
No related tags found
No related merge requests found
......@@ -95,7 +95,10 @@ Rails.application.configure do
# Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false
config.cache_store = :dalli_store, nil, { :namespace => 'portalmec', :expires_in => 1.day, :compress => true, :pool_size => 5 }
cache_store_servers = nil
cache_store_options = { :namespace => 'portalmec', :expires_in => 1.day, :compress => true, :pool_size => 5 }
cache_store_args = [cache_store_servers, cache_store_options].compact
config.cache_store = :mem_cache_store, *cache_store_args
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
......
#!/bin/bash
# Copyright (C) 2015 Centro de Computacao Cientifica e Software Livre
# Departamento de Informatica - Universidade Federal do Parana
#
# This file is part of portalmec.
#
# portalmec is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# portalmec is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with portalmec. If not, see <http://www.gnu.org/licenses/>.
ENV_VARS_PATH=/home/portalmec/portalmec/config/env_vars.sh
EXPORT_PATH=/home/portalmec/portalmec/env_vars.txt
grep -o '^[^#]*' $ENV_VARS_PATH | cut -d ' ' -f1 --complement > $EXPORT_PATH
#
# This file tells systemd how to run Sidekiq as a 24/7 long-running daemon.
#
# Customize this file based on your bundler location, app directory, etc.
# Customize and copy this into /usr/lib/systemd/system (CentOS) or /lib/systemd/system or /etc/systemd/system (Debian).
# Then run:
# - systemctl enable sidekiq
# - systemctl {start,stop,restart} sidekiq
#
# This file corresponds to a single Sidekiq process. Add multiple copies
# to run multiple processes (sidekiq-1, sidekiq-2, etc).
#
# Use `journalctl -u sidekiq -rn 100` to view the last 100 lines of log output.
#
[Unit]
Description=Control sidekiq for portalmec
# start us only once the network and logging subsystems are available,
# consider adding redis-server.service if Redis is local and systemd-managed.
After=syslog.target network.target
# See these pages for lots of options:
#
# https://www.freedesktop.org/software/systemd/man/systemd.service.html
# https://www.freedesktop.org/software/systemd/man/systemd.exec.html
#
# THOSE PAGES ARE CRITICAL FOR ANY LINUX DEVOPS WORK; read them multiple
# times! systemd is a critical tool for all developers to know and understand.
#
[Service]
ExecStart=/portalmec/sidekiq.sh start
ExecStop=/portalmec/sidekiq.sh stop
#
# !!!! !!!! !!!!
#
# As of v6.0.6, Sidekiq automatically supports systemd's `Type=notify` and watchdog service
# monitoring. If you are using an earlier version of Sidekiq, change this to `Type=simple`
# and remove the `WatchdogSec` line.
#
# !!!! !!!! !!!!
#
Type=notify
NotifyAccess=all
# If your Sidekiq process locks up, systemd's watchdog will restart it within seconds.
WatchdogSec=10
WorkingDirectory=/home/portalmec/portalmec
# Export the environment variables in a readable format for systemd
ExecStartPre=/home/portalmec/portalmec/export_env_vars.sh
# If you use rbenv:
# ExecStart=/bin/bash -lc 'exec /home/deploy/.rbenv/shims/bundle exec sidekiq -e production'
# If you use the system's ruby:
# ExecStart=/usr/local/bin/bundle exec sidekiq -e production
# If you use rvm:
ExecStart=/home/portalmec/.rvm/gems/default/wrappers/bundle exec sidekiq -e production
# Use `systemctl kill -s TSTP sidekiq` to quiet the Sidekiq process
ExecStop=/bin/kill -s TSTP $MAINPID
# Greatly reduce Ruby memory fragmentation and heap usage
# https://www.mikeperham.com/2018/04/25/taming-rails-memory-bloat/
Environment=MALLOC_ARENA_MAX=2
# Load the envinroment variables exported in the ExecStartPre script
EnvironmentFile=/home/portalmec/portalmec/env_vars.txt
# if we crash, restart
RestartSec=10
Restart=on-failure
# output goes to /var/log/syslog (Debian) or /var/log/messages (CentOS)
StandardOutput=syslog
StandardError=syslog
# This will default to "bundler" if we don't specify it
SyslogIdentifier=sidekiq
[Install]
WantedBy=multi-user.target
WantedBy=multi-user.target
\ No newline at end of file
# Redirects sidekiq's service log from syslog to the sidekiq.log file
# Copy this file to /etc/rsyslog.d/sidekiq_log.conf
:programname, isequal, "sidekiq" /home/portalmec/portalmec/shared/logs/sidekiq.log
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment