Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. App Packaging & Development
  3. Localstorage & /app/data

Localstorage & /app/data

Scheduled Pinned Locked Moved App Packaging & Development
20 Posts 5 Posters 3.8k Views 5 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • nebulonN Offline
    nebulonN Offline
    nebulon
    Staff
    wrote on last edited by
    #10

    /tmp is writeable and also created in runtime, however as the name suggests, the app should not rely on content to persist there. Traditionally it may be used as temporary storage for file uploads, of other caching files.

    1 Reply Last reply
    1
    • timconsidineT timconsidine

      @robi I don't think I am (now).

      robiR Offline
      robiR Offline
      robi
      wrote on last edited by robi
      #11

      @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

      Conscious tech

      timconsidineT 1 Reply Last reply
      0
      • robiR robi

        @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

        timconsidineT Offline
        timconsidineT Offline
        timconsidine
        App Dev
        wrote on last edited by
        #12

        @robi that's from the start.sh file which runs after Dockerfile has been built to an image.

        robiR 1 Reply Last reply
        0
        • timconsidineT timconsidine

          @robi that's from the start.sh file which runs after Dockerfile has been built to an image.

          robiR Offline
          robiR Offline
          robi
          wrote on last edited by
          #13

          @timconsidine I updated my post, since it's about the ln commands not the cp commands

          Conscious tech

          1 Reply Last reply
          0
          • girishG Offline
            girishG Offline
            girish
            Staff
            wrote on last edited by
            #14

            I would double check if the app was built and updated properly to use your latest Dockerfile. You can do cloudron debug and then you can cloudron exec to inspect if all the symlinks are proper. You can then launch your start.sh manually in that shell also.

            1 Reply Last reply
            1
            • timconsidineT Offline
              timconsidineT Offline
              timconsidine
              App Dev
              wrote on last edited by
              #15

              Thank you
              So app builds and launches, symlinks created in Dockerfile work
              But there is weirdness in running start.sh
              Some commands executed, some not.
              Eg the first mkdir works but not #2 or #3
              The first cp from tmp works but not #2 or #3
              The chown doesn't work but the script is running to the end and working because the app launches.
              Any ideas ?
              Here's the start.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 start
              

              Cloudronmanifest.json has localstorage addon and proxyAuth addon.

              nebulonN 1 Reply Last reply
              0
              • timconsidineT timconsidine

                Thank you
                So app builds and launches, symlinks created in Dockerfile work
                But there is weirdness in running start.sh
                Some commands executed, some not.
                Eg the first mkdir works but not #2 or #3
                The first cp from tmp works but not #2 or #3
                The chown doesn't work but the script is running to the end and working because the app launches.
                Any ideas ?
                Here's the start.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 start
                

                Cloudronmanifest.json has localstorage addon and proxyAuth addon.

                nebulonN Offline
                nebulonN Offline
                nebulon
                Staff
                wrote on last edited by
                #16

                @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 || true also if essential commands don't work in start.sh the app should not just continue anways in some unknown state.

                timconsidineT 1 Reply Last reply
                0
                • nebulonN nebulon

                  @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 || true also if essential commands don't work in start.sh the app should not just continue anways in some unknown state.

                  timconsidineT Offline
                  timconsidineT Offline
                  timconsidine
                  App Dev
                  wrote on last edited by
                  #17

                  @nebulon thank you
                  I stuck in the || true because 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 !

                  BrutalBirdieB 1 Reply Last reply
                  0
                  • timconsidineT timconsidine

                    @nebulon thank you
                    I stuck in the || true because 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 !

                    BrutalBirdieB Offline
                    BrutalBirdieB Offline
                    BrutalBirdie
                    Partner
                    wrote on last edited by
                    #18

                    @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.

                    Like my work? Consider donating a drink. Cheers!

                    timconsidineT 1 Reply Last reply
                    0
                    • BrutalBirdieB BrutalBirdie

                      @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.

                      timconsidineT Offline
                      timconsidineT Offline
                      timconsidine
                      App Dev
                      wrote on last edited by timconsidine
                      #19

                      @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 !

                      1 Reply Last reply
                      0
                      • robiR Offline
                        robiR Offline
                        robi
                        wrote on last edited by
                        #20

                        If you stop calling it AI, it will begin to make sense as a tool.

                        Conscious tech

                        1 Reply Last reply
                        1
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Bookmarks
                        • Search