forked from AsydSolutions/ASYD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
unicorn.conf.rb
40 lines (32 loc) · 1.21 KB
/
unicorn.conf.rb
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
38
39
40
$UNICORN = 1
$ASYD_PID = Process.pid
$ASYD_VERSION = File.read('version').strip
$DBG = 0 #debug?
$PORT = 3000
FileUtils.mkdir("log") unless File.directory?("log")
listen $PORT
worker_processes 1
pid ".asyd.pid"
stderr_path "log/asyd.log"
stdout_path "log/asyd.log"
preload_app true
before_fork do |server, worker|
if File.exist?('data/.dmon.pid')
Dmon::stop('dmon')
end
DataObjects::Pooling.pools.each do |pool|
pool.dispose
end
end
after_fork do |server, worker|
$0 = 'ASYD Web Worker'
DataMapper.setup(:tasks_db, "sqlite3:data/db/tasks.db") #load the tasks database
DataMapper.setup(:notifications_db, "sqlite3:data/db/notifications.db") #load the notifications database
DataMapper.setup(:monitoring_db, "sqlite3:data/db/monitoring.db") #load the monitoring database
DataMapper.setup(:hosts_db, "sqlite3:data/db/hosts.db") #load the hosts database
DataMapper.setup(:users_db, "sqlite3:data/db/users.db") #load the users database
DataMapper.setup(:status_db, "sqlite3:data/db/status.db") #load the status database
DataMapper.setup(:config_db, "sqlite3:data/db/config.db") #load the config database
DataMapper.setup(:stats_db, "sqlite3:data/db/stats.db") #load the stats database
Dmon::init
end