GithubHelp home page GithubHelp logo

Comments (5)

antejavor avatar antejavor commented on August 16, 2024 1

FLAGS + CONFIG FILE UPDATE -> This is reasonable to me because you are changing one or two flags based on the startup-config.

PASSING NEW CONFIG FILE -> I think this can be achieved like this:

docker create --name memgraph_container -p 7687:7687 memgraph/memgraph --flag-file=/etc/memgraph/my.conf 

docker cp my.conf memgraph_container:/etc/memgraph/my.conf

docker start memgraph_container

The key is to first create a container pointing to non-existent file, paste a file and then start.

Obviously, it's not critical, but it's useful for deployment if a company uses a lot of custom flags, and want to version the config files, very relevant for HA and replicaiton due to increased number of flags. .

from documentation.

antejavor avatar antejavor commented on August 16, 2024

Please add docker version for env flags: https://github.com/memgraph/documentation/pull/691/files#diff-3d9eed09cb1145f8eca058ea41ee667ced86663f6d04c5a291f19f278cbc7474R367

from documentation.

katarinasupe avatar katarinasupe commented on August 16, 2024

FLAGS + CONFIG FILE UPDATE

  1. Started Memgraph with log level and telemetry set
    docker run -p 7687:7687 -p 7444:7444 memgraph/memgraph-mage --telemetry-enabled=false --log-level=TRACE
    All is applied well (check with SHOW CONFIG)
  2. Enter the container and install vim
    docker ps (get container id)
    docker exec -it <container_id> bash
    apt-get update && apt-get install -y vim
  3. Edit config file
    vim /etc/memgraph/memgraph.conf
  4. Change log level to DEBUG and save memgraph.conf
  5. Restart the container
    docker restart <container_id>
  6. Run SHOW CONFIG - log level is set to TRACE because of the flags left in the docker run command

-> My conclusion: Flags from docker run command overwrite anything defined in the config file. It's easier to set config via flags in Docker.

PASSING NEW CONFIG FILE
When passing file to MEMGRAPH_CONFIG env var, I am facing similar issues as with init file - new conf file has to be inside the Docker container and Memgraph has to be started with the correctly set MEMGRAPH_CONFIG env var. Conclusion:

  1. Create Dockerfile
FROM memgraph/memgraph-mage:latest
COPY ./new.conf /etc/memgraph/new.conf
ENV MEMGRAPH_CONFIG=/etc/memgraph/new.conf
  1. Build Docker image
    docker build -t my-image .
  2. Run the image
    docker run -p 7687:7687 -p 7444:7444 my-image

Another idea was to set env var to future path in advance, c/p new conf to a running Docker container and restart the db. That does not work:

Assertion failed in file  at line 38.
	Expression: 'fs::exists(path)'
	Message: 'MEMGRAPH_CONFIG environment variable set to nonexisting path: /etc/memgraph/new.conf'

NEW CONFIG FILE + FLAGS
Flags override new config file set via env var.


Based on the above, I would recommend Docker users to change config using the flags, if possible. This would be recommended for sensitive information such as username/password, but other than that, it's easier. I can document the above, but best practice is surfacing here somehow.

from documentation.

katarinasupe avatar katarinasupe commented on August 16, 2024

What you suggested works well and seems like a better approach than with Dockerfile. I like it.
I checked, and it works with MEMGRAPH_CONFIG env var as well.

from documentation.

katarinasupe avatar katarinasupe commented on August 16, 2024

FLAGS + CONFIG FILE UPDATE -> This is reasonable to me because you are changing one or two flags based on the startup-config.

PASSING NEW CONFIG FILE -> I think this can be achieved like this:

docker create --name memgraph_container -p 7687:7687 memgraph/memgraph --flag-file=/etc/memgraph/my.conf 

docker cp my.conf memgraph_container:/etc/memgraph/my.conf

docker start memgraph_container

The key is to first create a container pointing to non-existent file, paste a file and then start.

Obviously, it's not critical, but it's useful for deployment if a company uses a lot of custom flags, and want to version the config files, very relevant for HA and replicaiton due to increased number of flags. .

I will then add this as a possibility on config page. On a separate Docker page for deployment, I will recommend setting config with flags as a best practice/easiest approach. Wdyt?

from documentation.

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.