Where to put the sqlite3-database when deploying a JRuby-On-Rails App as a war?
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?
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
精彩评论