Use a separate dir for tmp

This commit is contained in:
Daniel Berteaud 2015-07-22 22:01:24 +02:00
parent 6c48c77047
commit 426fa04522
7 changed files with 18 additions and 11 deletions

6
.gitignore vendored
View File

@ -1,3 +1,5 @@
conf/settings.ini conf/settings.ini
cache/* data/cache/*
!cache/README !data/cache/README
data/tmp/*
!data/tmp/README

View File

@ -75,7 +75,9 @@ credentials = 'rest'
[directories] [directories]
; Where to store cache data. Defaults to the cache subdirectory ; Where to store cache data. Defaults to the cache subdirectory
; User running VROOM daemon must have write access ; User running VROOM daemon must have write access
;cache = 'cache' ;cache = 'data/cache'
; Where to store temporary files
;tmp = 'data/tmp'
[daemon] [daemon]
; IP the hypnotoad daemon will listen on. You can use * to bind on every IP/Interface ; IP the hypnotoad daemon will listen on. You can use * to bind on every IP/Interface

View File

1
data/tmp/README Normal file
View File

@ -0,0 +1 @@
This is where temp data are stored

View File

@ -39,7 +39,8 @@ sub get_conf(){
$config->{'etherpad.uri'} ||= ''; $config->{'etherpad.uri'} ||= '';
$config->{'etherpad.api_key'} ||= ''; $config->{'etherpad.api_key'} ||= '';
$config->{'etherpad.base_domain'} ||= ''; $config->{'etherpad.base_domain'} ||= '';
$config->{'directories.cache'} ||= 'cache'; $config->{'directories.cache'} ||= 'data/cache';
$config->{'directories.cache'} ||= 'data/tmp';
$config->{'daemon.listen_ip'} ||= '127.0.0.1'; $config->{'daemon.listen_ip'} ||= '127.0.0.1';
$config->{'daemon.listen_port'} ||= '8090'; $config->{'daemon.listen_port'} ||= '8090';
$config->{'daemon.backend'} ||= 'hypnotoad'; $config->{'daemon.backend'} ||= 'hypnotoad';

View File

@ -285,14 +285,14 @@ echo "LoadModule proxy_wstunnel_module modules/mod_proxy_wstunnel.so" \\
> /etc/httpd/conf.modules.d/00-proxy_wstunnel.conf</pre> > /etc/httpd/conf.modules.d/00-proxy_wstunnel.conf</pre>
</p> </p>
<h3 id="c7_cache_dir_perm"> <h3 id="c7_dir_perm">
Set permissions on the cache directory Set permissions on the cache and tmp directories
</h3> </h3>
<p> <p>
The <strong>cache</strong> directory must be writeable for the user running the VROOM daemon, which is <strong>vroom</strong> in the provided systemd unit The <strong>cache</strong> and <strong>tmp</strong> directories must be writeable for the user running the VROOM daemon, which is <strong>vroom</strong> in the provided systemd unit
<pre> <pre>
chown -R vroom ./cache chown -R vroom ./data/{tmp,cache}
chmod 700 ./cache</pre> chmod 700 ./data/{cache,tmp}</pre>
</p> </p>
<h3 id="c7_systemd_unit"> <h3 id="c7_systemd_unit">
@ -447,6 +447,7 @@ cp /opt/vroom/conf/settings.ini.dist /opt/vroom/conf/settings.ini</pre>
Controls where to find some specific directories Controls where to find some specific directories
<ul> <ul>
<li><strong>cache</strong>: This is where VROOM will store its cache (including auto generated and compressed assets like JS and CSS bundles)</li> <li><strong>cache</strong>: This is where VROOM will store its cache (including auto generated and compressed assets like JS and CSS bundles)</li>
<li><strong>tmp</strong>: This is where VROOM will store temp data like XLSX files when exporting events</li>
</ul> </ul>
</p> </p>

View File

@ -30,7 +30,7 @@ app->log->level('info');
our $config = Vroom::Conf::get_conf(); our $config = Vroom::Conf::get_conf();
# Try to create the cache dir if they doesn't exist # Try to create the directories we need
foreach my $dir (qw/assets/){ foreach my $dir (qw/assets/){
if (!-d $config->{'directories.cache'} . '/' . $dir){ if (!-d $config->{'directories.cache'} . '/' . $dir){
make_path($config->{'directories.cache'} . '/' . $dir, { mode => 0770 }); make_path($config->{'directories.cache'} . '/' . $dir, { mode => 0770 });
@ -1175,7 +1175,7 @@ helper get_room_conf => sub {
helper export_events_xlsx => sub { helper export_events_xlsx => sub {
my $self = shift; my $self = shift;
my ($from,$to) = @_; my ($from,$to) = @_;
my $tmp = File::Temp->new( DIR => $config->{'directories.cache'}, SUFFIX => '.xlsx' )->filename; my $tmp = File::Temp->new( DIR => $config->{'directories.tmp'}, SUFFIX => '.xlsx' )->filename;
my $events = $self->get_event_list($from, $to); my $events = $self->get_event_list($from, $to);
if (!$events){ if (!$events){
return 0; return 0;