Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sage 1382 docker compose vm #23

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

iperezx
Copy link
Contributor

@iperezx iperezx commented Jun 21, 2022

I think this is a good pattern for adding different integrations to beekeeper and all the different test environments we have.

jswantek and others added 2 commits June 1, 2022 13:19
Adds override values for virtual node repo and instructions in README.
@seanshahkarami
Copy link
Member

The multiple docker-compose file pattern seems fine and would be easy to extend. (I used something similar for virtual waggle in the past.)

Not sure how soon you'd want this, but if you want to support multiple nodes, you could write a tiny generator which takes a list like:

V001 0000000000000001
V002 0000000000000002
V003 0000000000000003

and emits a docker-compose.nodes.yaml file like:

version: '3.7'
services:
  node-V001:
    image: waggle/node-platforms:latest
    build: 
      context: node-platforms/vm
      dockerfile: Dockerfile
      args:
        - "V001"
        - "0000000000000001"
  node-V002:
    image: waggle/node-platforms:latest
    build: 
      context: node-platforms/vm
      dockerfile: Dockerfile
      args:
        - "V002"
        - "0000000000000002"
  node-V003:
    image: waggle/node-platforms:latest
    build: 
      context: node-platforms/vm
      dockerfile: Dockerfile
      args:
        - "V003"
        - "0000000000000003"

build:
context: node-platforms/vm
dockerfile: Dockerfile
args:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you probably want to use ${VSN} and ${NODE_ID} instead?

You were trying to use the default env vars defined in the .env file, right?

(This will still work, but just use VSN and NODE_ID as the VSN and node ID. 😀)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, just use the .env var at build time.

This is seperate from having multiple nodes. This was more about using this pattern for integration steps. For example when we want to test with beehive.

I did not want to go that route since I am only going to test at most two locally. If I want to go more than 2, I will start testing in kubernetes.

The way I demoed it when you were gone was to use the scale option in docker-compose. This will be done after I adjust the values in the .env file (VSN and NODE_ID).

docker-compose -f docker-compose.yml -f docker-compose.vm.yml up --build --scale node1=2 -d

This will generate node1_1 and node1_2

It does overwrite the values from node1_1 but since it already registered with beekeeper the db has the previous node id before I modified it.

SAGE-1382 aims to figure out the ssh keys so that it works for multiple nodes so that's why I did not add the scale stuff to this PR. I might have to add something similar to what you are proposing in docker-compose.nodes.yaml if the nodeid is being checked.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright the PR is ready. Fix all the problems and now works. Added your suggestions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to add another workflow to run the unit-test for the docker-compose overlay.

Change iperezx/node-platforms to waggle-sensor/node-platforms in README.
- Change build args for VSN and NODE_ID to values in the overlay file
- Add node2
fix the name of the image so it doesnt overwrite the image for the other
vm node
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants