5

Background: I want to deploy a small JRuby-On-Rails-Application using warblers executable war, so I can just drop the .war-file and everyone can run it with java -jar app.war.

The application uses sqlite3 to store some data, and the production-db-file is located at WEB-INF/db inside the war.

Every time the app is started, winstone unpacks the war to a temp-directory, and all actions performed during this session are lost if the application is started the second time (because the production-db is unpacked again from the war-file).

So how can I use the same db-file every time the app ist started?

Jan
  • 1,445
  • 1
  • 16
  • 20

1 Answers1

6

You could either hard-code an absolute path in the database.yml, or add some logic to either pick a path outside of the webapp from an environment variable or a system property. For example:

production:
  db: <%= java.lang.System.getProperty('db') %>

Launch with:

java -Ddb=/path/to/db -jar app.war
Nick Sieger
  • 3,315
  • 20
  • 14