./launcher rebuild command fails when app.yml contains a long env variable

I’m trying to add a private key to env via the app.yml.

After I add it, it all stops working. If I remove it, it seems to all go back to normal.

The value i’m trying to add looks like this and is a line with 1755 chars

PRIVATE_KEY: “-----BEGIN PRIVATE KEY-----\n…\n…\n-----END PRIVATE KEY-----\n”

How can I fix this?

> Ensuring launcher is up to date
> 
> Fetching origin
> 
> remote: Enumerating objects: 7, done.
> 
> remote: Counting objects: 100% (7/7), done.
> 
> remote: Compressing objects: 100% (4/4), done.
> 
> remote: Total 4 (delta 2), reused 0 (delta 0), pack-reused 0
> 
> Unpacking objects: 100% (4/4), done.
> 
> From gitlab.com: REPO
> 
> 6075498..d46af48 master -> origin/master
> 
> Updating Launcher
> 
> Updating 6075498..d46af48
> 
> Fast-forward
> 
> containers/app.yml | 6 ++----
> 
> 1 file changed, 2 insertions(+), 4 deletions(-)
> 
> Ensuring launcher is up to date
> 
> Fetching origin
> 
> Launcher is up-to-date
> 
> Stopping old container
> 
> + /usr/bin/docker stop -t 60 app
> 
> app
> 
> cd /pups && git pull && /pups/bin/pups --stdin
> 
> /usr/bin/docker: invalid reference format: repository name must be lowercase.
> 
> See '/usr/bin/docker run --help'.
> 
> cat: cids/app_bootstrap.cid: No such file or directory
> 
> "docker rm" requires at least 1 argument.
> 
> See 'docker rm --help'.
> 
> Usage: docker rm [OPTIONS] CONTAINER [CONTAINER...]
> 
> Remove one or more containers
> 
> rm: cannot remove 'cids/app_bootstrap.cid': No such file or directory
> 
> ** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
> 
> ./discourse-doctor may help diagnose the problem.
2 Likes

Did you remove the line breaks? Can they be substituted with \n ?

Store the private key in a separate file and pass it in.

4 Likes

@Stephen an you help me that?

If I would have the file.json in the same directory as app.yml, how would the line look in app.yml?

I made 27 variables … ending in newlines… apparently if doesnt like 2 newlines in a variable, but I cannot use it like this. I need it in a specific name env variable.

2 Likes

Have you tried using multiline YAML instead?

https://yaml-multiline.info/

4 Likes

I’ve tried the | format, because i need the newlines. It gave me another error, something about a comment. I’ve resorted to using the —env-file docker_args parameter when calling the ./launcher command. It assigned something to the env variable, but i have to check if its correct.

The cert.env file created contained only one env variable, the cert.

I will come back later with news, after i check.

1 Like

Yup seems to work. I will do more testing but for now i think its a good solution

2 Likes