Adapt to run vroom under hypnotoad instead of a CGI script

Fix #83
master
Daniel Berteaud 10 years ago
parent bee623937b
commit 146d1b7881
  1. 16
      docs/systemd/vroom.service
  2. 6
      scripts/start_hypnotoad
  3. 2
      templates/default/header.html.ep
  4. 2
      templates/default/js_common.html.ep
  5. 2
      templates/default/js_room.html.ep
  6. 14
      vroom.pl

@ -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

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

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

@ -4,5 +4,5 @@
</script> </script>
<% foreach my $js (qw(jquery-1.11.1.min.js bootstrap.min.js notify-combined.min.js bootstrap-switch.min.js vroom.js)){ <% 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>
<% } %> <% } %>

@ -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)){ 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>
<% } %> <% } %>

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