Adapt to run vroom under hypnotoad instead of a CGI script

Fix #83
This commit is contained in:
Daniel Berteaud 2014-10-12 18:22:02 +02:00
parent bee623937b
commit 146d1b7881
6 changed files with 36 additions and 6 deletions

View File

@ -0,0 +1,16 @@
[Unit]
Description=VROOM daemon
After=mariadb.service
[Service]
Type=simple
ExecStart=/opt/vroom/scripts/start_hypnotoad
PIDFile=/tmp/vroom.pid
PrivateTmp=yes
User=apache
Group=apache
[Install]
WantedBy=multi-user.target
Wants=mariadb.service httpd.service

6
scripts/start_hypnotoad Executable file
View File

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

View File

@ -7,7 +7,7 @@
<%
foreach my $css (qw(bootstrap.min.css bootstrap-switch.min.css vroom.css)){
%>
<link href="<%= $self->get_url('/') %><%= $self->get_mtime("css/$css") %>/css/<%= $css %>" rel="stylesheet" type="text/css">
<link href="<%= $self->get_url('/') %><%= $self->get_mtime("public/css/$css") %>/css/<%= $css %>" rel="stylesheet" type="text/css">
<% } %>
<link rel="icon" type="image/png" href="<%= $self->get_url('/') %>img/favicon.png" />
</head>

View File

@ -4,5 +4,5 @@
</script>
<% foreach my $js (qw(jquery-1.11.1.min.js bootstrap.min.js notify-combined.min.js bootstrap-switch.min.js vroom.js)){
%>
<script type="text/javascript" src="<%= $self->get_url('/') %><%= $self->get_mtime("js/$js") %>/js/<%= $js %>"></script>
<script type="text/javascript" src="<%= $self->get_url('/') %><%= $self->get_mtime("public/js/$js") %>/js/<%= $js %>"></script>
<% } %>

View File

@ -1,5 +1,5 @@
<%
foreach my $js (qw(simplewebrtc.bundle.js jquery.browser.min.js sprintf.js FileSaver.js jquery.tinytimer.min.js etherpad.js)){
%>
<script type="text/javascript" src="<%= $self->get_url('/') %><%= $self->get_mtime("js/$js") %>/js/<%= $js %>"></script>
<script type="text/javascript" src="<%= $self->get_url('/') %><%= $self->get_mtime("public/js/$js") %>/js/<%= $js %>"></script>
<% } %>

View File

@ -105,7 +105,7 @@ our $musics = {
app->log->level('info');
# Read conf file, and set default values
our $config = plugin Config => {
file => '../conf/vroom.conf',
file => 'conf/vroom.conf',
default => {
dbi => 'DBI:mysql:database=vroom;host=localhost',
dbUser => 'vroom',
@ -708,7 +708,7 @@ helper ask_for_name => sub {
# Randomly choose a music on hold
helper choose_moh => sub {
my $self = shift;
my @files = (<snd/moh/*.*>);
my @files = (<public/snd/moh/*.*>);
return basename($files[rand @files]);
};
@ -1579,7 +1579,7 @@ post '/*action' => [action => [qw/action admin\/action/]] => sub {
};
# use the templates defined in the config
push @{app->renderer->paths}, '../templates/'.$config->{template};
push @{app->renderer->paths}, 'templates/'.$config->{template};
# Set the secret used to sign cookies
app->secret($config->{secret});
app->sessions->secure(1);
@ -1591,6 +1591,14 @@ app->hook(before_dispatch => sub {
$self->languages($self->session('language'));
}
});
# Are we running in hypnotoad ?
app->config(
hypnotoad => {
listen => ['http://127.0.0.1:8090'],
pid_file => '/tmp/vroom.pid',
proxy => 1
}
);
# And start, lets VROOM !!
app->start;