dogeorg / dogeboxd

Dogebox system manager service
MIT License
1 stars 0 forks source link

Inject relevant container environment variables #39

Closed SomeoneWeird closed 1 month ago

SomeoneWeird commented 1 month ago

This will inject a bunch of environment variables that can be read by pups.

This is mainly needed for pups that want to talk TCP to each other. With HTTP you would just hit the dbx router at /pup/${interfaceName} but that's not possible with TCP connections.

With this, we inject an environment variable named DBX_IFACE_${IFACE_NAME}_HOST and DBX_IFACE_${IFACE_NAME}_PORT that the process can read and use to understand where to connect to.

A list of things injected:

# Always
DBX_HOST=10.69.0.1               # Address of dogeboxd
DBX_PORT=80                      # Port for dogeboxd pup router
DBX_PUP_IP=10.69.0.4             # The IP address assigned to this pup
DBX_PUP_ID=1234snip              # The ID of this pup

# Per-interface (where $ is replaced with the interface name)
DBX_IFACE_$_NAME=count-server          # The name of the pup assigned as the provider for this interface
DBX_IFACE_$_HOST=10.69.0.2             # The IP address of the pup assigned as the provider for this interface
DBX_IFACE_$_PORT=9999                  # The port that this interface is available on.
SomeoneWeird commented 1 month ago

Yeah I was planning on high level basic docs next week 👍