<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Pass Cloudron ENV variables to pre-built Docker image]]></title><description><![CDATA[<p dir="auto">I tried to package my first Cloudron app but I am failing.</p>
<p dir="auto">The application <a href="https://docs.tandoor.dev/" target="_blank" rel="noopener noreferrer nofollow ugc">Tandoor Recipes</a> 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.</p>
<p dir="auto">I think all that needs to be done is to pass the Postgres ENV variables Cloudron provides into the container. The <a href="https://docs.tandoor.dev/install/docker/" target="_blank" rel="noopener noreferrer nofollow ugc">Tandoor documentation</a> states to simply start the image, one should pass theses parameters to <code>docker run</code>:</p>
<pre><code>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
</code></pre>
<p dir="auto">So my idea was to simply skip the <code>Dockerfile</code> building part of the image and directly install the app with my <code>CloudronManifest.JSON</code>, maybe like this</p>
<pre><code>{
  "title": "Tandoor Recipes",
  "version": "0.1.0",
  "healthCheckPath": "/",
  "httpPort": 8080,
  "addons": {
    "postgresql": {},
    "localstorage": {}
  },
  "manifestVersion": 2,
  "website": "https://docs.tandoor.dev/",
}
</code></pre>
<p dir="auto">If I install this with <code>cloudron install --image vabene1111/recipes --no-wait</code> it installs but the logs show an error that the DB file is not found (excerpt below).</p>
<p dir="auto">I tried to also build from this image and use the Dockerfile to run a <code>start.sh</code> (idea from <a href="https://forum.cloudron.io/topic/5240/custom-app-container-startup-arguments">this post</a>. 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.</p>
<p dir="auto">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?<br />
Any help is highly appreciated.<br />
Thanks.</p>
<p dir="auto">Regards<br />
Christopher</p>
<pre><code>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 
</code></pre>
]]></description><link>https://forum.cloudron.io/topic/6205/pass-cloudron-env-variables-to-pre-built-docker-image</link><generator>RSS for Node</generator><lastBuildDate>Fri, 10 Jul 2026 11:49:29 GMT</lastBuildDate><atom:link href="https://forum.cloudron.io/topic/6205.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 21 Dec 2021 17:17:47 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Pass Cloudron ENV variables to pre-built Docker image on Thu, 23 Dec 2021 16:02:40 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/klawitterb" aria-label="Profile: klawitterb">@<bdi>klawitterb</bdi></a> Oh I see, good point, that part escaped my notice. Mediafiles are directly served by nginx and only the rest is forwarded to Gunicorn.</p>
<pre><code>    #serve media files
    location /media/ {
      alias /app/data/mediafiles/;
    }
    
    # pass requests for dynamic content to gunicorn
    location / {
      proxy_set_header Host $http_host;
      proxy_pass http://localhost:8080; # -&gt; this gos to Gunicorn
    }
</code></pre>
<p dir="auto">So with the Cloudron Nginx, static files would still be served from Gunicorn. SO I guess, it is worth the effort <img src="https://forum.cloudron.io/assets/plugins/nodebb-plugin-emoji/emoji/android/1f609.png?v=95dae3ecbe4" class="not-responsive emoji emoji-android emoji--wink" style="height:23px;width:auto;vertical-align:middle" title=";-)" alt="😉" /><br />
Thanks for that.</p>
]]></description><link>https://forum.cloudron.io/post/40864</link><guid isPermaLink="true">https://forum.cloudron.io/post/40864</guid><dc:creator><![CDATA[cloudron_hacky]]></dc:creator><pubDate>Thu, 23 Dec 2021 16:02:40 GMT</pubDate></item><item><title><![CDATA[Reply to Pass Cloudron ENV variables to pre-built Docker image on Thu, 23 Dec 2021 15:38:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/cloudron_hacky" aria-label="Profile: cloudron_hacky">@<bdi>cloudron_hacky</bdi></a> they stated in their env file that its recommended to not serve the images through gunicorn so I kind of did that without thinking too much about it <img src="https://forum.cloudron.io/assets/plugins/nodebb-plugin-emoji/emoji/android/1f602.png?v=95dae3ecbe4" class="not-responsive emoji emoji-android emoji--joy" style="height:23px;width:auto;vertical-align:middle" title=":joy:" alt="😂" /></p>
]]></description><link>https://forum.cloudron.io/post/40861</link><guid isPermaLink="true">https://forum.cloudron.io/post/40861</guid><dc:creator><![CDATA[klawitterb]]></dc:creator><pubDate>Thu, 23 Dec 2021 15:38:45 GMT</pubDate></item><item><title><![CDATA[Reply to Pass Cloudron ENV variables to pre-built Docker image on Thu, 23 Dec 2021 14:31:17 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/klawitterb" aria-label="Profile: klawitterb">@<bdi>klawitterb</bdi></a> Very cool indeed, thanks for the link. Works like a charm.</p>
<p dir="auto">I myself got passed the SQL ENV variables and had Tandoor up and running but I was then running into the problem of the static file generation at boot time <code>start.sh</code>. I did not manage to get it out of <code>start.sh</code> and into the <code>Dockerfile</code>, like you did here:</p>
<pre><code>RUN venv/bin/python3 manage.py collectstatic_js_reverse
RUN venv/bin/python3 manage.py collectstatic --noinput
</code></pre>
<p dir="auto">Anyway, dunno if it makes sens to continue this thread on discussing building Tandoor Recipes but I have one question. In your setup you still use nginx in the image. I think you followed the <a href="https://docs.tandoor.dev/install/manual/" target="_blank" rel="noopener noreferrer nofollow ugc">manual installation</a> description where everything including Postgres and Nginx is put on the same host.<br />
But we do have an reverse proxy in Cloudron already. So I <code>.dockerignored</code>d your <code>nginx.conf</code>files and had port 8080 (gunicorn) instead of 8000 (nginx) directly exposed.</p>
<p dir="auto">Do you see a special reason for having another nginx in the image?</p>
]]></description><link>https://forum.cloudron.io/post/40857</link><guid isPermaLink="true">https://forum.cloudron.io/post/40857</guid><dc:creator><![CDATA[cloudron_hacky]]></dc:creator><pubDate>Thu, 23 Dec 2021 14:31:17 GMT</pubDate></item><item><title><![CDATA[Reply to Pass Cloudron ENV variables to pre-built Docker image on Wed, 22 Dec 2021 19:55:31 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/cloudron_hacky" aria-label="Profile: cloudron_hacky">@<bdi>cloudron_hacky</bdi></a> I packed up tandoor recipies myself. Although there are still some open issues feel free to have a look at my repo: <a href="https://git.apehost.de/cloudron-apps/cloudron-tandoor-recipies/" target="_blank" rel="noopener noreferrer nofollow ugc">https://git.apehost.de/cloudron-apps/cloudron-tandoor-recipies/</a></p>
]]></description><link>https://forum.cloudron.io/post/40832</link><guid isPermaLink="true">https://forum.cloudron.io/post/40832</guid><dc:creator><![CDATA[klawitterb]]></dc:creator><pubDate>Wed, 22 Dec 2021 19:55:31 GMT</pubDate></item><item><title><![CDATA[Reply to Pass Cloudron ENV variables to pre-built Docker image on Wed, 22 Dec 2021 12:55:07 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/nebulon" aria-label="Profile: nebulon">@<bdi>nebulon</bdi></a>, yes, I did go through all the documentation I could find and I tried a lot of different stuff to get the upstream image to work. Doing so, it dawned on me, that it might not be as easy as I thought <img src="https://forum.cloudron.io/assets/plugins/nodebb-plugin-emoji/emoji/android/1f609.png?v=95dae3ecbe4" class="not-responsive emoji emoji-android emoji--wink" style="height:23px;width:auto;vertical-align:middle" title=";-)" alt="😉" /></p>
<p dir="auto">Anyway, this image exposes an HTTP port and looking at their docker compose file, it only depends on a Postgres DB. The Postgres configuration is passed as environment variables into the image.</p>
<p dir="auto">The Cloudron Postgres addon creates and fills environment variables. Is it possible to rename them to reflect the names required by the image? Maybe as part of the CloudronManifest?</p>
<p dir="auto">But I guess you are right, when it comes to stuff like local storage etc, I might end up having to go the manual installation path anyway. Still I think, an image that is completely self-contained, only exposing an HTTP port, why would I want to re-build that image for Cloudron?</p>
<p dir="auto">Could you maybe elaborate a bit on e.g, what does <code>cloudron build</code>do on top of <code>docker build</code>, if that makes sense?</p>
<p dir="auto">Anyway, I will have a look into the manual installation path and see where I can get.</p>
]]></description><link>https://forum.cloudron.io/post/40815</link><guid isPermaLink="true">https://forum.cloudron.io/post/40815</guid><dc:creator><![CDATA[cloudron_hacky]]></dc:creator><pubDate>Wed, 22 Dec 2021 12:55:07 GMT</pubDate></item><item><title><![CDATA[Reply to Pass Cloudron ENV variables to pre-built Docker image on Wed, 22 Dec 2021 10:49:46 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/cloudron_hacky" aria-label="Profile: cloudron_hacky">@<bdi>cloudron_hacky</bdi></a> usually the upstream docker images are not really suitable for Cloudron packages, however they may act as a great reference on how to deploy and app. Not sure if you have seen the resources about app packaging at <a href="https://docs.cloudron.io/packaging/tutorial/" target="_blank" rel="noopener noreferrer nofollow ugc">https://docs.cloudron.io/packaging/tutorial/</a> yet?</p>
<p dir="auto">Basically all apps on Cloudron would start from a common base image, where the latest is now</p>
<pre><code>FROM cloudron/base:3.2.0@sha256:ba1d566164a67c266782545ea9809dc611c4152e27686fd14060332dd88263ea
</code></pre>
<p dir="auto">The env variables which are set within the app's container can be found in the addon documentation. For example for postgres <a href="https://docs.cloudron.io/packaging/addons/#postgresql" target="_blank" rel="noopener noreferrer nofollow ugc">https://docs.cloudron.io/packaging/addons/#postgresql</a></p>
]]></description><link>https://forum.cloudron.io/post/40809</link><guid isPermaLink="true">https://forum.cloudron.io/post/40809</guid><dc:creator><![CDATA[nebulon]]></dc:creator><pubDate>Wed, 22 Dec 2021 10:49:46 GMT</pubDate></item></channel></rss>