Alter startup script to be able to choose between morbo and hypnotoad

master
root 10 years ago
parent 7370977481
commit 918065abd2
  1. 3
      conf/settings.ini.dist
  2. 3
      docs/systemd/vroom.service
  3. 6
      scripts/start_hypnotoad
  4. 26
      scripts/start_server.pl

@ -64,3 +64,6 @@
;listen_ip = '127.0.0.1' ;listen_ip = '127.0.0.1'
; Port used by the hypnotoad daemon ; Port used by the hypnotoad daemon
;listen_port = '8090' ;listen_port = '8090'
; server backend. Can be either morbo (DEV) or hypnotoad (PROD)
; default is hypnotoad
;backend = 'hypnotoad'

@ -4,8 +4,7 @@ After=mariadb.service
[Service] [Service]
Type=simple Type=simple
ExecStart=/opt/vroom/scripts/start_hypnotoad ExecStart=/opt/vroom/scripts/start_server.pl
PIDFile=/tmp/vroom.pid
PrivateTmp=yes PrivateTmp=yes
User=apache User=apache
Group=apache Group=apache

@ -1,6 +0,0 @@
#!/bin/sh
DIR=$(dirname $0)
export PERL5LIB="$DIR/../lib/"
cd $DIR/..
hypnotoad -f vroom.pl "$*"

@ -0,0 +1,26 @@
#!/usr/bin/env perl
use strict;
use warnings;
use Config::Simple;
use File::Basename;
my $dir=dirname($0);
chdir $dir . '/..';
my $cfg = new Config::Simple();
$cfg->read('conf/settings.ini');
our $config = $cfg->vars();
$config->{'daemon.listen_ip'} ||= '127.0.0.1';
$config->{'daemon.listen_port'} ||= '8090';
$config->{'daemon.backend'} ||= 'hypnotoad';
$ENV{'PERL5LIB'} = 'lib';
if ($config->{'daemon.backend'} eq 'morbo'){
exec ('/usr/bin/morbo', '-l', 'http://' . $config->{'daemon.listen_ip'} . ':' . $config->{'daemon.listen_port'}, '-v', 'vroom.pl');
}
else{
exec ('/usr/bin/hypnotoad', '-f', 'vroom.pl');
}
Loading…
Cancel
Save