Localstorage & /app/data
-
I’m struggling with packaging an app (Flame).
It seems that what I prepare in the Dockerfile in /app/data gets wiped when the app starts.Is this because the local storage addon resets /app/data ? Or is there another reason ?
Met this with content placed in /app/data and also seems to be preventing creation of symlinks.
Any guidance ?
-
/app/datais being created by thelocalstorageaddon on runtime.That's why many times in the Dockerfile we move folders/files to
file_defaultand in the Dockerfile create a symlink to/app/dataand then in the start script we copy thedefaultto/app/data -
I’m struggling with packaging an app (Flame).
It seems that what I prepare in the Dockerfile in /app/data gets wiped when the app starts.Is this because the local storage addon resets /app/data ? Or is there another reason ?
Met this with content placed in /app/data and also seems to be preventing creation of symlinks.
Any guidance ?
@timconsidine said in Localstorage & /app/data:
It seems that what I prepare in the Dockerfile in /app/data gets wiped when the app starts.
Right, as @BrutalBirdie said, you should not prepare /app/data in the Dockerfile. Instead, prepare it at runtime, in your start.sh. In the Dockerfile, copy the files you need into /app/code or /app/pkg or something. Then, in start.sh copy over files from /app/pkg into /app/data.
-
Thank you @BrutalBirdie and @girish
And symlinks ? Better to create in the Dockerfile ?
-
Thank you @BrutalBirdie and @girish
And symlinks ? Better to create in the Dockerfile ?
-
@timconsidine I assume you mean symlinks from code to some writable data path? If so, yes, Dockerfile is the correct place.
@girish Thank you.
I seem to be stuck in a loop (although I am not 100% sure what's going on).
I create a symlink in the Dockerfile from a code directory to a writable data location.
In thestart.shI copy contents of code directory to the /app/data path.
But I'm using localstorage addon and I think it destroys the symlink when it creates /app/data.
But I can't create or recreate the symlink instart.sh(as /app/code is readonly).in dockerfile :
RUN mv /app/code/data /app/code/datasrc \ && mkdir -p /app/code/datasrc/uploads \ && ln -s /app/data/data /app/code/data \ && ln -s /app/data/public /app/code/publicin start.sh :
mkdir -p /app/data/public /app/data/data cp -r /app/code/client/* /app/data/public/ cp -r /app/code/datasrc/* /app/data/dataApp fails to launch because it tries to read (or write) to :
Error: EROFS: read-only file system, open '/app/code/public/flame.css'But flame.css should be symlinked to /app/data/public/flame.css.
I'm too close to this to see the problem.
Any thoughts ? -
@robi I don't think I am (now).
@timconsidine said in Localstorage & /app/data:
@robi I don't think I am (now).
so what is this in Dockerfile?
&& ln -s /app/data/data /app/code/data \
&& ln -s /app/data/public /app/code/public
-
@timconsidine said in Localstorage & /app/data:
@robi I don't think I am (now).
so what is this in Dockerfile?
&& ln -s /app/data/data /app/code/data \
&& ln -s /app/data/public /app/code/public
-
@robi that's from the
start.shfile which runs after Dockerfile has been built to an image.@timconsidine I updated my post, since it's about the
lncommands not thecpcommands -
I would double check if the app was built and updated properly to use your latest Dockerfile. You can do
cloudron debugand then you cancloudron execto inspect if all the symlinks are proper. You can then launch your start.sh manually in that shell also. -
Thank you
So app builds and launches, symlinks created in Dockerfile work
But there is weirdness in runningstart.sh
Some commands executed, some not.
Eg the firstmkdirworks but not #2 or #3
The firstcpfromtmpworks but not #2 or #3
Thechowndoesn't work but the script is running to the end and working because the app launches.
Any ideas ?
Here's thestart.sh:#!/bin/bash # set -eu mkdir -p /app/data/config || true mkdir -p /app/data/public || true mkdir -p /app/data/images || true cp -r /tmp/skeleton/* /app/data/config cp -r /tmp/public/* /app/data/public cp -r /tmp/images/* /app/data/images chown -R cloudron:cloudron /app/data export npm_config_cache=/app/data/.npm-cache exec /usr/local/bin/gosu cloudron:cloudron npm startCloudronmanifest.json has localstorage addon and proxyAuth addon.
-
Thank you
So app builds and launches, symlinks created in Dockerfile work
But there is weirdness in runningstart.sh
Some commands executed, some not.
Eg the firstmkdirworks but not #2 or #3
The firstcpfromtmpworks but not #2 or #3
Thechowndoesn't work but the script is running to the end and working because the app launches.
Any ideas ?
Here's thestart.sh:#!/bin/bash # set -eu mkdir -p /app/data/config || true mkdir -p /app/data/public || true mkdir -p /app/data/images || true cp -r /tmp/skeleton/* /app/data/config cp -r /tmp/public/* /app/data/public cp -r /tmp/images/* /app/data/images chown -R cloudron:cloudron /app/data export npm_config_cache=/app/data/.npm-cache exec /usr/local/bin/gosu cloudron:cloudron npm startCloudronmanifest.json has localstorage addon and proxyAuth addon.
@timconsidine not sure if this the main problem, but
mkdir -p ...does "no error if existing, make parent directories as needed" so should run it without the|| truealso if essential commands don't work instart.shthe app should not just continue anways in some unknown state. -
@timconsidine not sure if this the main problem, but
mkdir -p ...does "no error if existing, make parent directories as needed" so should run it without the|| truealso if essential commands don't work instart.shthe app should not just continue anways in some unknown state.@nebulon thank you
I stuck in the|| truebecause chatGPT told me to do so when I asked it why the script wasn't working !
Yep, it's weird behaviour, some lines working but some not.
I can execute the failed lines manually in Terminal, but not the right way to do it ! -
@nebulon thank you
I stuck in the|| truebecause chatGPT told me to do so when I asked it why the script wasn't working !
Yep, it's weird behaviour, some lines working but some not.
I can execute the failed lines manually in Terminal, but not the right way to do it !@timconsidine said in Localstorage & /app/data:
I stuck in the || true because chatGPT told me to do so when I asked it why the script wasn't working !

lol - That will just always make an exec return
true/ successful even when it fails.AI will replace developers
right. -
@timconsidine said in Localstorage & /app/data:
I stuck in the || true because chatGPT told me to do so when I asked it why the script wasn't working !

lol - That will just always make an exec return
true/ successful even when it fails.AI will replace developers
right.@BrutalBirdie said in Localstorage & /app/data:
AI will replace developers right.
Absolutely ... not !
I have seen some absolute shockers (hallucinations, wrong responses) but nevertheless I do find it useful.
Comes back to that old age truth : you can have the best sword/drill/hammer in the world, but it's only useful if you know how to use it.
AI is helpful ... except when it's not and you recognise it is not !