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


  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
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

Cloudron Forum

Apps | Demo | Docs | Install

Custom app container startup arguments

Scheduled Pinned Locked Moved App Packaging & Development
17 Posts 7 Posters 695 Views
    • 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.
  • svalloryS Offline
    svalloryS Offline
    svallory
    wrote on last edited by
    #1

    Hi!

    I created a custom app for Outline (https://github.com/tokilabs/outline) and had some issues getting it to run.

    The app uses an environment variables config file .env that should live outside the image and be passed to the container at start via --env-file argument like this:

    docker run --env-file=.env outlinewiki/outline

    I found no way of configuring Cloudron to do that. Is it possible or should I open a feature request?

    Btw, if anyone wants to try it, the app is working and published here. Instructions to complete the install are provided via POSTINSTALL.

    I found another way to make it work by manually setting each variable using the cloudron cli and automated the process via an sh script. But it was a big hassle and duplicated variable management 😕

    ? timconsidineT 2 Replies Last reply
    0
  • ? Offline
    ? Offline
    A Former User
    replied to svallory on last edited by A Former User
    #2

    @svallory Couldn't you just export the variables in start.sh?
    04edae65-1607-45a5-8efb-466a2cb6f6f3-image.png

    svalloryS 1 Reply Last reply
    0
  • timconsidineT Offline
    timconsidineT Offline
    timconsidine App Dev
    replied to svallory on last edited by
    #3

    @svallory It looks very interesting so wish you well to solve the problem, although sorry i don't know the anser.

    1 Reply Last reply
    0
  • svalloryS Offline
    svalloryS Offline
    svallory
    replied to A Former User on last edited by
    #4

    @atrilahiji I could, but I want to create an image anyone can use, so the values cannot be inside the image

    ? 1 Reply Last reply
    0
  • LonkleL Offline
    LonkleL Offline
    Lonkle
    wrote on last edited by
    #5

    I ran into a similar issue before (Cloudron not supporting docker run variables). but the best place to put them is in the DOCKERFILE and tell the people you share it with to change it in the DOCKERFILE. I'm pretty sure that's the best you can do rn.

    1 Reply Last reply
    0
  • ? Offline
    ? Offline
    A Former User
    replied to svallory on last edited by
    #6

    @svallory Seems like most of those should be set in start.sh (SMTP, domain, DB, etc since those need to be updated on restarts in case someone changes their cloudron app config.

    Any options people need to be able to manually change can use something like this to load a .env from start.sh: https://gist.github.com/mihow/9c7f559807069a03e302605691f85572

    svalloryS 2 Replies Last reply
    0
  • svalloryS Offline
    svalloryS Offline
    svallory
    replied to A Former User on last edited by svallory
    #7

    @atrilahiji

    But how do you distribute an App via Cloudron app store (or a similar easy process) using that approach?

    won't the user have to get the code, modify start.sh, rebuild, upload, etc...?

    ? 1 Reply Last reply
    0
  • svalloryS Offline
    svalloryS Offline
    svallory
    replied to A Former User on last edited by
    #8

    @atrilahiji I was planning to submit to the App store, it would be an awesome addition (not my piece of software, btw)

    ? 1 Reply Last reply
    0
  • ? Offline
    ? Offline
    A Former User
    replied to svallory on last edited by A Former User
    #9

    @svallory no so the start.sh can use environment variables that cloudron gives you for SMTP, domain, and DB settings. So if that info ever changes they should be updated on startup.

    Here: https://docs.cloudron.io/custom-apps/addons/

    1 Reply Last reply
    0
  • mehdiM Offline
    mehdiM Offline
    mehdi App Dev
    wrote on last edited by mehdi
    #10

    Taking a quick look at a repo, I am not sure which precise values you expect the user to tweak.

    Cloudron's philosophy in these sorts of cases is to automatically configure what can be auto-configured (SMTP, domains, DB ...), chose reasonable defaults for the rest, and possibly allow advanced users to tweak the configuration by editing a file in /app/data manually. The start.sh of your app can check if a custom config file exists in a pre-defined location, merge it with the defaults, write the result in a temp file, and use this temp file for the actual app.

    ? 1 Reply Last reply
    1
  • ? Offline
    ? Offline
    A Former User
    replied to mehdi on last edited by
    #11

    @mehdi only thing I can see is the S3 stuff I guess.

    1 Reply Last reply
    0
  • ? Offline
    ? Offline
    A Former User
    replied to svallory on last edited by
    #12

    @svallory check out the environment vars i am using in start.sh here to automate the setup and config changes: https://git.atridad.dev/alt-ron/cloudron-humhub-app/-/blob/master/start.sh

    1 Reply Last reply
    0
  • svalloryS Offline
    svalloryS Offline
    svallory
    wrote on last edited by
    #13

    @atrilahiji and @mehdi thanks for the suggestions. In my custom version there's S3, SITE_NAME and SITE_DESCRIPTION (that I remember) other things can be either generated or got from cloudron I think, but more variables can come along down the road.

    I think the combination of a smart start.sh and a file in /app/data may be a solution though. I'll try that.

    I would still like to leave the suggestion of either having an input for docker run extra arguments or allowing via the CloudronManifest to set variables that would then be filled in the app settings. The latter would be incredibly awesome and make things a lot easier!

    Again: thank you so much for the help!

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

    @svallory If I understanding correctly, you want to specify the setting names like S3/SITE_NAME/SITE_DESCRIPTION etc and then these variables can then be configured by UI ? Also, I guess you are expecting these variables to become exposed as environment variables to the app?

    svalloryS fbartelsF 2 Replies Last reply
    1
  • svalloryS Offline
    svalloryS Offline
    svallory
    replied to girish on last edited by
    #15

    @girish exactly! Like the docker UI does for export environment variables

    mehdiM 1 Reply Last reply
    2
  • mehdiM Offline
    mehdiM Offline
    mehdi App Dev
    replied to svallory on last edited by
    #16

    Honestly, there have been a few times where I could have used something like this too.

    1 Reply Last reply
    1
  • fbartelsF Offline
    fbartelsF Offline
    fbartels App Dev
    replied to girish on last edited by
    #17

    @girish said in Custom app container startup arguments:

    these variables can then be configured by UI ? Also, I guess you are expecting these variables to become exposed as environment variables to the app?

    I like the way this is implemented in the univention app center. The format of the settings (there they use the ini format) is explained in https://docs.software-univention.de/app-provider-5.0.html#app-settings:reference. It defines different types of settings and allows to template default values (even custom drop downs). The values are then stored in a file in the container and scripts can be triggered inside and outside of the container to react on changes. Outside is probably not necessary here.

    1 Reply Last reply
    1
  • C cloudron_hacky referenced this topic on

  • Login

  • Don't have an account? Register

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

  • Don't have an account? Register

  • Login or register to search.