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

Add SITE_HOST envvar to ocs-agent-cli #354

Merged
merged 2 commits into from
Nov 13, 2023
Merged

Conversation

mhasself
Copy link
Member

Description

See above.

Motivation and Context

Primary motivation is to make it easier to configure a single HostManager to control all agents on a physical host, including ones managed through docker and a docker-compose.yaml file.

In our new docker service definition scheme, environment variables are used to set basic agent configuration. This adds SITE_HOST to INSTANCE_ID, SITE_HUB, SITE_HTTP. The SITE_* ones can be defined in an anchor, and used throughout the docker-compose file; e.g.:

x-basic-env:
    &basic-env
    SITE_HOST: host1
    LOGLEVEL: debug

services:
  ocs-faker1:
    image: ocs:latest
    hostname: host1-docker
    environment:
      <<: *basic-env
      INSTANCE_ID: faker1
    network_mode: host
    volumes:
      - ./:/config:ro

Use of anchors in this way does require treating environment as a dict rather than a list.

How Has This Been Tested?

Directly by manipulating the configuration of the docker-compose.yaml. The argument remains optional, and has the correct default behaviors.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@mhasself mhasself mentioned this pull request Sep 20, 2023
6 tasks
Base automatically changed from mhasse/hostman-overhaul to main September 20, 2023 14:30
This makes it easier to have docker-based agents grab their instance
config from a specific host block.
Copy link
Member

@BrianJKoopman BrianJKoopman left a comment

Choose a reason for hiding this comment

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

Looks good! Tested it out locally on my system.

@BrianJKoopman BrianJKoopman merged commit da25bd8 into main Nov 13, 2023
5 checks passed
@BrianJKoopman BrianJKoopman deleted the mhasse/host-envvar branch November 13, 2023 18:40
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.

None yet

2 participants