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
  • 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. LiveView Elixir doesn't work in Cloudron but does locally

LiveView Elixir doesn't work in Cloudron but does locally

Scheduled Pinned Locked Moved App Packaging & Development
10 Posts 3 Posters 1.4k Views 3 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.
  • E Offline
    E Offline
    ekevu123
    wrote on last edited by ekevu123
    #1

    I have this function in my elixir code:

      def handle_info(%{document_id: document_id}, socket) do
        {:noreply, push_patch(socket, to: ~p"/fact_check/result/?document_id=#{document_id}")}
      end
    

    What it does: The user uploads a file using fact_check and gets forwarded to a waiting screen on /result. The document_id comes from Firestore and it should get appended to the link. Later, when the result has been processed, the page refreshes and shows the result.

    This works on localhost and in a local docker container, but it doesn't work on Cloudron. There, the link doesn't get the ID, it stays the same, so the page would never update.

    I have checked database connection and environment variables, everything works.

    Any ideas what might be causing the issue? This must be a difference between a local docker container and cloudron.

    1 Reply Last reply
    1
    • girishG girish moved this topic from Support on
    • girishG Offline
      girishG Offline
      girish
      Staff
      wrote on last edited by
      #2

      @ekevu123 Could it be that the upload is not working properly ? Maybe it's relying on writing to some part in the file system and in Cloudron you cannot write there?

      An idea: cloudron debug --app xx and then start the app manually. Does it work in debug mode? If so, it's most likely an issue with the app writing somewhere in the readonly filesystem.

      1 Reply Last reply
      0
      • E Offline
        E Offline
        ekevu123
        wrote on last edited by
        #3

        Actually, I have changed the code. I am using Phoenix Elixir and LiveView to render the results. I am polling every six seconds for a result from Firestore and once it becomes available, I am showing it. The data is stored in the memory only in socket assigns.
        But if I got empty data, I would get an empty reaction. So, I need to assume that I am not receiving the trigger event.
        The link change is not a trigger anymore.

        1 Reply Last reply
        0
        • E Offline
          E Offline
          ekevu123
          wrote on last edited by
          #4

          Now, this seems to be not working in my Elixir code:
          Process.send_after(self(), :poll, 6_000)
          The function is supposed to execute itself regularly every six seconds, which it does in a local docker container, but it doesn't on Cloudron, there it runs only ones initially. That's why my app doesn't catch any result on Cloudron.

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

            I see. So, a basic poll timer does not work. Don't know much about elixir but maybe it needs some extra library or something ? Are you able to reproduce this with a simple example and Cloudron Dockerfile?

            1 Reply Last reply
            0
            • E Offline
              E Offline
              ekevu123
              wrote on last edited by
              #6

              I could try, of course, but since it works in a docker container locally, and not on Cloudron, I wonder what direction can I take in general to solve this? I got it working locally, so I think I have matched all dependencies etc.

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

                Given Cloudron is simply using docker, there is not much difference between running the container locally vs running on Cloudron. Maybe an idea is to run the container directly on the server like you are doing locally (i.e not as Cloudron app) and see if that works.

                1 Reply Last reply
                0
                • E Offline
                  E Offline
                  ekevu123
                  wrote on last edited by
                  #8

                  Yes, it doesn't work on a plain Ubuntu server either.
                  But why? What's the difference between localhost on my computer and a Ubuntu server online? I am even running Ubuntu.

                  1 Reply Last reply
                  0
                  • nebulonN Offline
                    nebulonN Offline
                    nebulon
                    Staff
                    wrote on last edited by
                    #9

                    I guess you have to dig deeper on this on your own here. We don't have much knowledge from Cloudron side what elixir does or expects. Maybe other forum users know more about this though.

                    1 Reply Last reply
                    0
                    • E Offline
                      E Offline
                      ekevu123
                      wrote on last edited by
                      #10

                      Yes, makes sense, I am asking in the elixir forum. Thank you still for being here!

                      1 Reply Last reply
                      0
                      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