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
fix(relay): Fix failed to write credentials #450
Conversation
install.sh
Outdated
# We need the ugly hack below as `relay generate credentials` tries to read the config and the credentials | ||
# even with the `--stdout` and `--overwrite` flags and then errors out when the credentials file exists but | ||
# not valid JSON. | ||
$dcr --no-deps --entrypoint /bin/bash relay -c "mkdir /work/.relay && cp /etc/relay/config.yml /work/.relay/config.yml && /bin/relay credentials generate > /dev/null && cat /work/.relay/config.yml" > "$RELAY_CREDENTIALS_JSON" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will probably also need credential.json
to work.
I wonder if you could just use /bin/relay credentials generate --stdout
instead of generate && cat
? There will be some additional output on stderr
in either case, btw.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if you could just use /bin/relay credentials generate --stdout instead of generate && cat? There will be some additional output on stderr in either case, btw.
See my comment here please: I tried using stdout
first but it fails if there's already a credentials.json
file that is not valid. In our case I'd do relay credentials generate > relay/credentials.json
which causes the credentials.json
to be created as an empty file before relay
runs and then relay
complains about invalid config files as it cannot read an empty file as JSON.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha, must be a misunderstanding on my end. I thought that it doesn't matter whether you run with or without --stdout
as to whether the config is loaded beforehand. I'll follow up in Relay and make sure this works as expected.
- fix some issues - echo success messages on key generation
Fixes the issue reported on #421 (comment) and https://forum.sentry.io/t/could-not-write-etc-relay-credentials-json/9558?u=byk
Follow up to #421.