Giter Club home page Giter Club logo

Comments (14)

francescou avatar francescou commented on July 17, 2024

Hi
right now you can define variables and then use an env_file, in most cases that is good enough.

Do you need to set variable values on each docker-compose up?

from docker-compose-ui.

WTFKr0 avatar WTFKr0 commented on July 17, 2024

Yh i want to have a compose template, and then allow my users via the ui to param this compose file and run a set of containers

from docker-compose-ui.

WTFKr0 avatar WTFKr0 commented on July 17, 2024

The env_file only set env variables into container.
I want to allow user to param some of others fields in the docker-compose.yml file, for ex :

web:
image: webimage/${version}

In command line, we can :
version=1.2.3 docker-compose up -d
cause compose substitute variable

I would like to do that via a UI

Thanx for reading

from docker-compose-ui.

francescou avatar francescou commented on July 17, 2024

you can use an env_file for the docker-compose-ui service to perform variable substitution like this:

docker-compose.yml

docker_compose_ui:
    image: francescou/docker-compose-ui:0.17
    env_file: .env

.env

VERSION=8-jdk

java/docker-compose.yml

java:
  image: "java:${VERSION}"
  command: java -version

but, as you can see, this way you'll set an env shared between all the containers you manage from docker-compose-ui.

I'm not sure if this will be enough to you but I can't think of a "clean" way to implement variable substitution without using global variables. Feel free to suggest other solutions if you want, thanks.

from docker-compose-ui.

WTFKr0 avatar WTFKr0 commented on July 17, 2024

Thanx for the trick
But yh i think i want more than that :D
Ideally, i want a template project, with some variables, and allow my users to create a new project from that template, all that in a UI
If you know rancher, I want the same as the questions mechanism, but without the massive rancher infrastructure

from docker-compose-ui.

francescou avatar francescou commented on July 17, 2024

so if I've understood correctly, this feature should be integrated with "Create new project" and not the docker-compose up, right?

from docker-compose-ui.

WTFKr0 avatar WTFKr0 commented on July 17, 2024

Yeah right

from docker-compose-ui.

francescou avatar francescou commented on July 17, 2024

to achieve this I think it could be useful to have an advanced yaml editor (something like this: https://github.com/CenturyLinkLabs/lorry-ui ?) and a repository of docker-compose.yml template files.

I'll have to think about it since this feature does not play well with the new git based docker-compose.yml files management

what do you think about it?

from docker-compose-ui.

WTFKr0 avatar WTFKr0 commented on July 17, 2024

I think about that last couple of days, and this is how i see that :

A repository of templates, each project contain 2 files :

  • The template (ex) :
version: "2"
services:
  php:
    image: "mysql:{{MYSQL_TAG}}"
    environment:
      MYSQL_ROOT_PASSWORD: {{MYSQL_PASS}}
  • The param file (i choose json but can be other :D ):
{
        "MYSQL_TAG": {
                "type":"select",
                "options": {
                        "url": "http://api.myorg.org/tags/mysql"
                }
        },
        "MYSQL_PASS": {
                "type":"password",
                "placeholder":"Password of the root user"
        }
}

A process take these two files and generate html form to fill the 2 fields

The submit button of the form replace the fileds in the template and display response
This is not limited to docker-compose files

Do you know something like that on github ?

from docker-compose-ui.

francescou avatar francescou commented on July 17, 2024

I guess you'll need something like http://www.alpacajs.org to generate the HTML form and maybe lodash template to process the docker-compose.yml file.

from docker-compose-ui.

allamand avatar allamand commented on July 17, 2024

Hi Guys,

I'm looking to a similar feature, and I was thinking on something simpler, what about simple Env var ?

I've got a compose file :

  wordpress:
    restart: always
    image: wordpress
    expose:
      - "80"
    environment:
      - "WORDPRESS_DB_PASSWORD=${MYSQL_PWD}"
      - "affinity:container!=*traefik*"
      - reschedule:on-node-failure
    depends_on:
      - mysql
    volumes:
      - wordpress_www:/var/www/html
    labels:
      - "traefik.frontend.rule=Host:wordpress.${PROXY_DNS}"
      - "traefik.docker.network=traefik_net"
    logging:
      driver: gelf
      options:
        gelf-address: udp://${LOGSTASH_IP}:12201
    networks:
      - traefik_net
      - back

I used it to set mysql password, the Traefik rule for routing my request on my domain name, and ip for ELK logging.

In my case, just adding a text editor in the Settings section to set env variables like:

MYSQL_PWD=supersecret
PROXY_DNS=mydomain.com
LOGSTASH_IP=10.258.132.15

Then, just before calling docker-compose we just need to make an eval of this store file.

What do you think ?

from docker-compose-ui.

allamand avatar allamand commented on July 17, 2024

I try an implementation for this : https://github.com/allamand/docker-compose-ui Pull REquest #66 if you can try and let me know

from docker-compose-ui.

francescou avatar francescou commented on July 17, 2024

Hello @WTFKr0
docker compose env files are supported in francescou/docker-compose-ui:1.1.0

from docker-compose-ui.

MichaelMackus avatar MichaelMackus commented on July 17, 2024

@francescou has this issue been solved? From what I can tell, there's nowhere to enter environment variables (from a .env file) in the latest docker-compose-ui:1.4.1

Even a simple YML editor (alongside the existing "Create new project" form) would suffice for my use case. Personally, I'd like this to be implemented in the "up" action (as a modal of some sort), but I understand this introduces further complexities (where to list these containers, how to stop them, etc.).

from docker-compose-ui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.