How do you start the prod server using Docker and SQLite? #2171
-
I have a question on how people setup their AdonisJS apps with Docker in production. When running locally I just set volumes that point to my local folders so that I can develop without rebuilding and restarting the image and container. And copy over my .env file to the container. In production I'm a little confused on how to handle the .env file and then the DB migration step. I assume that I should setup a secret value in my workflow for the app key and send that to Docker using -e APP_KEY={{my_secret_ap_key}}.
When I run the container, it seems like it starts and migration runs successfully, but the application spits out an error when I try to access the DB:
Dockerfile
start.sh
Note, that in this case I have already run the invoke command for Lucid and checked in everything it generates and sets up. This was the only way I got the migration to run in the container.
What am I missing? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
I think I found the answer, I was setting up the tmp folder for the SQLite DB in the working dir (/app) in the container, not in the build folder from where I start the application after I have done a production build. The fix was to move the creation of the tmp folder, remove the line inte the Dockerfile and add it in the start script. start.sh
|
Beta Was this translation helpful? Give feedback.
I think I found the answer, I was setting up the tmp folder for the SQLite DB in the working dir (/app) in the container, not in the build folder from where I start the application after I have done a production build.
The fix was to move the creation of the tmp folder, remove the line inte the Dockerfile and add it in the start script.
start.sh