SemkoDev / field.cli

WE HAVE MOVED TO A NEW REPOSITORY
https://gitlab.com/semkodev/field.cli
ISC License
34 stars 7 forks source link

machine id problem with docker image #10

Closed MatthiasLohr closed 6 years ago

MatthiasLohr commented 6 years ago

Similar to #3, docker images tend to have the same machine id. As a result, the docker variant cannot really be used productively. It would be nice if this could be fixed, e.g. not relying on a machine id but a custom generated uuid at first startup.

Best regards Matthias

0xDEADBEEF-td commented 6 years ago

+1 I moved away from the docker image and built my own node.js package as a result of this. For platform portability, agree with Matthias that simple uuid gen at startup and a flag set that uuid already gen'd should be implemented if possible.

antonionardella commented 6 years ago

Hello, sorry to open this issue again.

With the latest update it is possible to assign a custom machine id through the config.ini:

customFieldId = true

Now since the correct procedure to upgrade a docker image is the following:

we have the issue that the Public ID changes after a docker field.cli image update: For example, my ID now: d253f921ba96bb62 my ID after stopping, removing the image and restarting: 19d1c6d3979c0b41.

What would now happen to specific node statistics, since the ID has changed?

Could something like this be a solution? The Public ID should derive from a specific parameter in the config.ini. At that point it would not be possible to copy it for malicious purposes and it would still be unique, unless someone uses the same parameter key in the config.

All the best, Antonio

MatthiasLohr commented 6 years ago

Or maybe you could change the meaning of customFieldId.

Introduce a new parameter useCustomFieldId. This name fits more to a boolean value than customFieldId.

If useCustomFieldId is set, field.cli checks, if customFieldId is set. If not, it will generate a new one and store the value in a seperate file - or by modifying the config.ini and adding customFieldId with the respective value there. If customFieldId is set, it should use this value.

antonionardella commented 6 years ago

Solved in my repo by adding a volume to /root, now the .carriota-field.id file is saved externally

joshirio commented 6 years ago

@ioiobzit did you bind /root like this (I'd like to keep my field id too)?:

docker run -d --net host -p 21310:21310 --name field -v $(pwd)/field/root:/root romansemko/field.cli --pow --address my_donation_address --name my_name --customFieldId

And, by the way, is it be possible to add an example docker command to the readme like most other projects, maybe similar to the command above?

antonionardella commented 6 years ago

Hi @joshirio I'm using docker compose in my project and attached the volumes like this:

  field.cli:
    image: romansemko/field.cli:latest
    container_name: iota_field.cli
    hostname: field.cli
    restart: unless-stopped
    volumes:
      - ./volumes/field/config.ini:/usr/src/field/config.ini:ro
      - ./volumes/field/root:/root
      - /etc/localtime:/etc/localtime:ro
    command: "--config /usr/src/field/config.ini"
    ports:
- "21310:21310"

Cheers!