I just deployed a rails app, and I’m wanting to use an sqlite3 database. I have added the database to a disk, and now I’m just trying to figure out how to access it.
I tried specifying the location of the database file:
/var/data/db/production.sqlite3
But upon deploy, I get this error:
Errno::ENOENT: No such file or directory @ dir_s_mkdir - /var/data/db
That directory definitely exists.
So I tried adding a symlink command to the build command: ln -s /var/data/db/production.sqlite3 db/production.sqlite3
Now it can find the file, but gives me the error that the file cannot be opened. Permissions all seem correct.
How do I access the sqlite3 database on my disk from my Rails app?
I tried to create a new database as part of the build command. This is what I received:
Jun 18 06:08:51 AM Database not found
Jun 18 06:08:51 AM Couldn't create '/var/data/db/production.sqlite3' database. Please check your configuration.
Jun 18 06:08:53 AM Caused by:
Jun 18 06:08:53 AM Errno::ENOENT: No such file or directory @ dir_s_mkdir - /var/data/db
Could it be that the drive has not yet been mounted at that point in the deploy?