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. Correct mongodb connection parameters?

Correct mongodb connection parameters?

Scheduled Pinned Locked Moved Solved App Packaging & Development
6 Posts 2 Posters 879 Views 2 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.
  • timconsidineT Offline
    timconsidineT Offline
    timconsidine
    App Dev
    wrote on last edited by
    #1

    I am trying to package the CodexDocs app, and am struggling to express the required connection string in Cloudron format.

    The 'native' command is an environment variable :
    APP_CONFIG_database_mongodb_uri=mongodb://mongo:fe7cb9063db50ab63c87@codexdocs_codex-db:27017

    I ham trying to express this in Cloudron syntax in start.sh for mongodb addon as :
    export APP_CONFIG_database_mongodb_uri=mongodb://${CLOUDRON_MONGODB_USERNAME}:${CLOUDRON_MONGODB_PASSWORD}@${CLOUDRON_MONGODB_DATABASE}:${CLOUDRON_MONGODB_PORT}

    But I am getting AuthenticationFailed
    And I can't see what is wrong. 😊
    Just checking with y'all if my statement looks ok.

    Then I will try to check if the app is trying to connect with mongo username instead of ${CLOUDRON_MONGODB_USERNAME}

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

      This kinda looks fine, there is also CLOUDRON_MONGODB_URL which has the connect URL string already prebuilt.

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

        Oh interesting, so it could be just mongodb://${CLOUDRON_MONGODB_URL}, or it would still need user/password ?

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

          Blundering about with trial&error, I managed to get it working by appending the database parameter.

          export APP_CONFIG_database_mongodb_uri=mongodb://${CLOUDRON_MONGODB_USERNAME}:${CLOUDRON_MONGODB_PASSWORD}@${CLOUDRON_MONGODB_HOST}:${CLOUDRON_MONGODB_PORT}/${CLOUDRON_MONGODB_DATABASE}

          Sadly there is another problem with the app also experienced when I was using local storage that pages are not actually created. I thought it might be a folders/permissions issue so tried to side-step it with a database.
          Thank you @nebulon for helping resolve that.
          But <sigh> behaviour persists.
          Oh well, I shall continuing investigating.

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

            The CLOUDRON_MONGODB_URL variable already has the schema (mongod://) in it as well as the database identifier, so you should be able to just use that directly.

            1 Reply Last reply
            1
            • nebulonN nebulon marked this topic as a question on
            • nebulonN nebulon has marked this topic as solved on
            • timconsidineT Offline
              timconsidineT Offline
              timconsidine
              App Dev
              wrote on last edited by
              #6

              Cool, that makes it more concise and less open to mis-use (by me 😄 )

              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