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 - Status | Demo | Docs | Install
  1. Cloudron Forum
  2. Support
  3. App terminal errors when calling Postgres from interactive shell

App terminal errors when calling Postgres from interactive shell

Scheduled Pinned Locked Moved Solved Support
web terminal
6 Posts 3 Posters 76 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 last edited by joseph
    #1

    I am working in Elixir, and it uses bin/app_name remote in the terminal on cloudron to enter an interactive debugging shell (that concept exists similarly in other languages).

    If I then click the postgres button, it adds this to the shell:

    PGPASSWORD=${CLOUDRON_POSTGRESQL_PASSWORD} psql -h ${CLOUDRON_POSTGRESQL_HOST} -p ${CLOUDRON_POSTGRESQL_PORT} -U ${CLOUDRON_POSTGRESQL_USERNAME} -d ${CLOUDRON_POSTGRESQL_DATABASE}
    

    However, this command can't be run in the interactive shell, it errors out with a syntax error.

    It's clear why this happens, but I think my user expectation would be to open a separate, overlay postgres shell at this point, do what I have to do in the database, and when quitting it, return to my previously opened shell.

    Alternatively, there could be a cleaner error, e.g. "This command can't be run inside an interactive shell."

    1 Reply Last reply
    1
    • nebulonN Away
      nebulonN Away
      nebulon
      Staff
      wrote last edited by
      #2

      not exactly sure what "interactive shell" here means in your case, but this command line for postgres is really just a regular linux shell commandline. If elixir runs some other "shell" like repl, than this wil likely not work at all. Though why cant you just open a second terminal into the app in a new browser tab to run postgres cli?

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

        To clarify: bin/app_name remote doesn't open a Linux shell at all. It attaches to the running Erlang VM and drops you into IEx, Elixir's interactive REPL (read-eval-print loop). At that prompt, you're not typing bash commands - you're typing Elixir expressions that get evaluated live against the running application (this is roughly equivalent to Rails' rails console, Django's manage.py shell, or Node's REPL).
        So when the Postgres button injects a bash command like PGPASSWORD=... psql -h ..., IEx tries to parse it as Elixir syntax and understandably chokes.
        Opening a second terminal tab works as a workaround, but from a UX perspective I'd expect one of two things instead:

        1. The Postgres button detects that the current session is a language REPL (not a plain shell) and opens the psql command in a fresh terminal/tab automatically, or
        2. At minimum, a clearer error such as "This command requires a shell prompt, not an interactive REPL" instead of a raw syntax error.

        I don't mind particularly if you choose not to act on this, I just keep running into the same issue, because my expectation as a user is different, so I felt like pointing this out.

        1 Reply Last reply
        0
        • nebulonN Away
          nebulonN Away
          nebulon
          Staff
          wrote last edited by
          #4

          that makes sense that it fails then. Issue here is that the webview has no real clue of what kind of process is running in the webterminal itself. So all that menu option really does is blindly pasting the hardcoded string into the tty. No clue on how to maybe fix this on some other level....

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

            I think you would need to let the database button open a separate terminal window instead of pasting the variables. Not sure if that's worth the effort, I just wanted to point out something that repeatedly gets me.

            1 Reply Last reply
            1
            • J Offline
              J Offline
              joseph
              Staff
              wrote last edited by
              #6

              This is tracked at https://forum.cloudron.io/topic/15683/add-database-terminal-shortcut . Thanks for opening that @ekevu123

              1 Reply Last reply
              1
              • J joseph has marked this topic as solved

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              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