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
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,35 @@ communication keys used by the nodes (i.e. services running on them)

## start beekeeper

The docker-compose file has override values for different local dev environments.

Here is a list of files:
1. `docker-compose.vm.yml`: overrides node1 service with a vm cloned repo (manually by the user).

Setup for each override docker-compose `.yml` file (same enumeration as above):
1. Setup
```
git clone [email protected]:waggle-sensor/node-platforms.git
```

Generate keys:
```bash
./create-keys.sh init --nopassword
./create-keys.sh cert untilforever forever
docker-compose up --build
```
Note: Options above like `--nopassword` and `forever` should not be used in production.

Start beekeeper with no overriden values:
```
docker-compose up --build
```

Start beekeeper with overriden values depending on the use-case:
1. Setup
```
docker-compose -f docker-compose.yml -f docker-compose.vm.yml up --build
```

# Register a beehive with beekeeper (example)

1) The first step creates a beehive but credentials will be missing.
Expand Down
26 changes: 26 additions & 0 deletions docker-compose.vm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: '3.7'
services:
node1:
image: waggle/node-platforms:node1
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.

VSN: vsn1
NODE_ID: "0000000000000001"

node2:
image: waggle/node-platforms:node2
build:
context: node-platforms/vm
dockerfile: Dockerfile
args:
VSN: vsn2
NODE_ID: "0000000000000002"
volumes:
- ${PWD}/beekeeper-keys/registration_certs/untilforever/registration:/etc/waggle/sage_registration_readonly:ro
- ${PWD}/beekeeper-keys/registration_certs/untilforever/registration-cert.pub:/etc/waggle/sage_registration-cert.pub_readonly:ro
# for /etc/ssh/ssh_known_hosts:
- ${PWD}/beekeeper-keys/certca/beekeeper_ca_key.pub:/etc/waggle/beekeeper_ca_key.pub:ro
# so beekeeper can ssh into it:
- ${PWD}/beekeeper-keys/nodes-key/nodes.pem.pub:/root/.ssh/authorized_keys:ro