Hi Gert, On Fri, 30 May 2014 10:26:46 +0200 Gert van Oss <gertvanoss@me.com> wrote:
I’m trying to use Dancer::Plugin::Database. The database is a sqlite-file that only serves as datafile so I’m not writing to the database in my app. If I run my app on the server with the command ‘perl bin/app.pl’ everything works just fine. All data is shown on the pages as expected.
If, however I startup the app while making use of Starman (I took guidance of the article on the perlmaven site) I get the message that the app is unable to open the database. [...] The error log gives two lines
DBI connect('dbname=all.sqlite','',...) failed: unable to open database file at /home/gertmt/perl5/perlbrew/perls/perl-5.20.0/lib/site_perl/5.20.0/Dancer/Plugin/Database/Core.pm line 259. [...]
Either the file isn't readable by the user that Starman is running your app as, or the current working dir isn't your app's dir, so you'll need to provide the full path to the DB file in your app config (e.g. /home/gertmt/myapp/all.sqlite or similar). FWIW, I start my Dancer apps using: https://github.com/bigpresh/misc-scripts/blob/master/dancer-init.d/dancer ... and part of the config for each app tells it the app dir, and it passes --chdir $DIR to the start-stop-daemon call it uses to run the app under Starman, which would solve this problem for you I believe. It may be worth me looking at D::P::D to make filenames be relative to the appdir rather than the current working dir, but that could unexpectedly change behaviour for existing users... hmm. -- David Precious ("bigpresh") <davidp@preshweb.co.uk> http://www.preshweb.co.uk/ www.preshweb.co.uk/twitter www.preshweb.co.uk/linkedin www.preshweb.co.uk/facebook www.preshweb.co.uk/cpan www.preshweb.co.uk/github