I tried to package my first Cloudron app but I am failing.
The application Tandoor Recipes is an already pre-built Docker image. It depends on a Postgres DB and from it's overall architecture I think it is a perfect candidate for Cloudron.
I think all that needs to be done is to pass the Postgres ENV variables Cloudron provides into the container. The Tandoor documentation states to simply start the image, one should pass theses parameters to docker run
:
docker run -d \
-v ./staticfiles:/opt/recipes/staticfiles \
-v ./mediafiles:/opt/recipes/mediafiles \
-p 80:8080 \
-e SECRET_KEY=YOUR_SECRET_KEY \
-e DB_ENGINE=django.db.backends.postgresql \
-e POSTGRES_HOST=db_recipes \
-e POSTGRES_PORT=5432 \
-e POSTGRES_USER=djangodb \
-e POSTGRES_PASSWORD=YOUR_POSTGRES_SECRET_KEY \
-e POSTGRES_DB=djangodb \
--name recipes_1 \
vabene1111/recipes
So my idea was to simply skip the Dockerfile
building part of the image and directly install the app with my CloudronManifest.JSON
, maybe like this
{
"title": "Tandoor Recipes",
"version": "0.1.0",
"healthCheckPath": "/",
"httpPort": 8080,
"addons": {
"postgresql": {},
"localstorage": {}
},
"manifestVersion": 2,
"website": "https://docs.tandoor.dev/",
}
If I install this with cloudron install --image vabene1111/recipes --no-wait
it installs but the logs show an error that the DB file is not found (excerpt below).
I tried to also build from this image and use the Dockerfile to run a start.sh
(idea from this post. But I have difficulties understanding how this build-time script is run every time I start the app. But maybe this is my lack of Docker knowledge.
So my question is, is it not possible to use external non-Cloudron-style build images and pass variables into those images without building it myself?
Any help is highly appreciated.
Thanks.
Regards
Christopher
Dec 21 17:56:13 box:taskworker Task took 0.76 seconds
Dec 21 17:56:13 box:tasks setCompleted - 3356: {"result":null,"error":null}
Dec 21 17:56:13 box:tasks update 3356: {"percent":100,"result":null,"error":null}
Dec 21 18:10:22 File "/opt/recipes/venv/lib/python3.9/site-packages/django/db/backends/base/base.py", line 200, in connect
Dec 21 18:10:22 self.connection = self.get_new_connection(conn_params)
Dec 21 18:10:22 File "/opt/recipes/venv/lib/python3.9/site-packages/django/utils/asyncio.py", line 33, in inner
Dec 21 18:10:22 return func(*args, **kwargs)
Dec 21 18:10:22 File "/opt/recipes/venv/lib/python3.9/site-packages/django/db/backends/sqlite3/base.py", line 209, in get_new_connection
Dec 21 18:10:22 conn = Database.connect(**conn_params)
Dec 21 18:10:22 django.db.utils.OperationalError: unable to open database file
Dec 21 18:10:22 Done
Dec 21 18:10:22 chmod: /opt/recipes/mediafiles: No such file or directory
Dec 21 18:10:23 [2021-12-21 17:10:23 +0000] [1] [INFO] Starting gunicorn 20.1.0
Dec 21 18:10:23 [2021-12-21 17:10:23 +0000] [1] [INFO] Listening at: http://0.0.0.0:8080 (1)
Dec 21 18:10:23 [2021-12-21 17:10:23 +0000] [1] [INFO] Using worker: sync
Dec 21 18:10:23 [2021-12-21 17:10:23 +0000] [12] [INFO] Booting worker with pid: 12
Dec 21 18:10:23 [2021-12-21 18:10:23 +0100] [12] [ERROR] Exception in worker process
Dec 21 18:10:23 Traceback (most recent call last):
Dec 21 18:10:23 File "/opt/recipes/venv/lib/python3.9/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection
Dec 21 18:10:23 self.connect()
Dec 21 18:10:23 File "/opt/recipes/venv/lib/python3.9/site-packages/django/utils/asyncio.py", line 33, in inner
Dec 21 18:10:23 return func(*args, **kwargs)
Dec 21 18:10:23 File "/opt/recipes/venv/lib/python3.9/site-packages/django/db/backends/base/base.py", line 200, in connect
Dec 21 18:10:23 self.connection = self.get_new_connection(conn_params)
Dec 21 18:10:23 File "/opt/recipes/venv/lib/python3.9/site-packages/django/utils/asyncio.py", line 33, in inner
Dec 21 18:10:23 return func(*args, **kwargs)
Dec 21 18:10:23 File "/opt/recipes/venv/lib/python3.9/site-packages/django/db/backends/sqlite3/base.py", line 209, in get_new_connection
Dec 21 18:10:23 conn = Database.connect(**conn_params)
Dec 21 18:10:23 sqlite3.OperationalError: unable to open database file
Dec 21 18:10:23