-
Notifications
You must be signed in to change notification settings - Fork 1
/
config.ru
executable file
·37 lines (29 loc) · 1012 Bytes
/
config.ru
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# SPDX-License-Identifier: BSD-2-Clause
#
# config.ru
# Part of NetDEF CI System
#
# Copyright (c) 2023 by
# Network Device Education Foundation, Inc. ("NetDEF")
#
# frozen_string_literal: true
require 'rack'
require 'rackup'
require 'rack/handler/puma'
require 'rack/session/cookie'
require 'securerandom'
require_relative 'app/github_app'
require_relative 'config/delayed_job'
File.write('.session.key', SecureRandom.hex(32))
pids = []
pids << spawn("RACK_ENV=#{ENV.fetch('RACK_ENV', 'development')} rake jobs:work QUEUES=0,1,2,3")
pids << spawn("RACK_ENV=#{ENV.fetch('RACK_ENV', 'development')} rake jobs:work QUEUES=4,5,6")
pids << spawn("RACK_ENV=#{ENV.fetch('RACK_ENV', 'development')} rake jobs:work QUEUES=7,8,9")
use Rack::Session::Cookie, secret: File.read('.session.key'), same_site: true, max_age: 86_400
Rackup::Handler::Puma.run Rack::URLMap.new('/' => GithubApp)
pids.each do |pid|
Process.kill('TERM', pid.to_i)
rescue Errno::ESRCH
puts "Process #{pid} already dead"
end
exit 0