Hubs-Foundation / hubs-cloud

Resources for self hosted Hubs Cloud instances
Mozilla Public License 2.0
149 stars 88 forks source link

Create Dockerfile for render_hcce.sh #324

Closed Doginal closed 2 months ago

Doginal commented 6 months ago

This file allows for the bash scripts to be run without dependencies on the host machine.

Mitigates the issues with escaping the private key (PERMS_KEY)

Usage: docker build . -t hubs-ce-builder:latest then docker run --rm -it -v REPLACE_PATH:/app hubs-ce-builder:latest to build the yaml files

note: can be used for render_cbb.sh by changing render_hcce.sh to render_cbb.sh

mikemorran commented 6 months ago

@tanfarming I'm in favor of this solve for escaping issues you can run into on different platforms!

Doginal commented 6 months ago

@mikemorran would you like the render_cbb.sh version as well?

mikemorran commented 6 months ago

@Doginal, why not! Could you add this to the PR?

Doginal commented 6 months ago

@mikemorran done and updated the readme, hoping the changes to render_cbb.sh don't cause issues. i just noticed it has kubectl in there which probably isn't going to work

tanfarming commented 6 months ago

hmm i can't find render_cbb.sh file ... maybe i remembered it wrong but i thought i've always rendered the cbb.yaml out of cbb.yam on the fly inside cbb.sh?

also this will require docker to be available locally i think maybe we should note something like "if you have docker locally available you can render the chart with docker"?

also(2) hcce was made to not rely on any specific container runtime (ie. docker) so maybe another option for the escape/platform/bash version issues is to just base64 the perms_key

Doginal commented 6 months ago

@tanfarming

1) The issue is not with kubernetes, base64 would stop some of the quotes that are needed but bash/zsh or whatever terminal people are using is causing the issue. Agreed will add "if docker is installed locally" to the readme.

2) I got the file's name wrong, I think it was render_cbb.sh in the preview but I could be wrong. The original file would spit out the cbb.yaml file, which then was applied via kubectl. Now it's doing the kube commands inside the script.

tanfarming commented 5 months ago
  1. The issue is not with kubernetes, base64 would stop some of the quotes that are needed but bash/zsh or whatever terminal people are using is causing the issue. Agreed will add "if docker is installed locally" to the readme.

a bit confused here, sry, i never thought it was about k8s, but wouldn't base64 solve all the escaping issue by not having anything that need to be escaped? i guess it can help if you could elaborate on the "but bash/zsh or whatever terminal people are using is causing the issue" part, like an example of how a base64 string may be causing an escaping issue? this won't block this pr tho, no harm adding the docker option, it's actually how i run the whole script

  1. I got the file's name wrong, I think it was render_cbb.sh in the preview but I could be wrong. The original file would spit out the cbb.yaml file, which then was applied via kubectl. Now it's doing the kube commands inside the script.

hmm i don't see a render_cbb.sh file either, was it from a pre-released commit?

also there's a merge conflict

Doginal commented 5 months ago

@tanfarming

a bit confused here, sry, i never thought it was about k8s, but wouldn't base64 solve all the escaping issue by not having anything that need to be escaped? i guess it can help if you could elaborate on the "but bash/zsh or whatever terminal people are using is causing the issue" part, like an example of how a base64 string may be causing an escaping issue? this won't block this pr tho, no harm adding the docker option, it's actually how i run the whole script

It seems like when people are coping and pasting it is the biggest issue. I have tried base64 encoding it but ret doesn't like one of the two types of quotes (iirc it's double quotes that ret doesn't like)

The private key always causes issues when ret processes the env var. It goes from '"key\n"' to 'key\n' in the ret configs iirc.

  1. I got the file's name wrong, I think it was render_cbb.sh in the preview but I could be wrong. The original file would spit out the cbb.yaml file, which then was applied via kubectl. Now it's doing the kube commands inside the script.

hmm i don't see a render_cbb.sh file either, was it from a pre-released commit?

This was my memory being off. I think you are right, it's most likely always been cbb.sh no worries there.

I'll fix the merge issue and remove the render_cbb.sh references

mikemorran commented 5 months ago

@Doginal are the most recent edits from what you and @tanfarming discussed good to go? Sorry I pushed some edits to the read me last week that you might have to rebase

Doginal commented 2 months ago

@mikemorran rebased let's get this merged!

mikemorran commented 2 months ago

Done! Thanks @Doginal !