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

Feature req. Environment variable for serving HTTPS without reverse proxy #1461

Open
beppe9000 opened this issue Jan 28, 2020 · 4 comments
Open

Comments

@beppe9000
Copy link

I saw this: https://github.com/errbit/errbit/blob/master/docs/deployment.md

Since the server already hosts cpanel I want to provide its own subdomain cert &key and let errbit serve itself over HTTPS on some non-conventional port. I didn't find a way to specify that in environment config, tough.

I propose to add an entrypoint script that checks for a SERVE_HTTPS=1 and runs the appropriate command passing SSL_CERTIFICATE_PATH and SSL_CERTIFICATE_KEY_PATH to it.


by the way I also saw saw that the dockerfile does not use the /health/liveness endpoint described in the above file

HEALTHCHECK CMD curl --fail "http://$(/bin/hostname -i | /usr/bin/awk '{ print $1 }'):${PORT:-8080}/users/sign_in" || exit 1

@stevecrozz
Copy link
Member

Are you saying that you find it inconvenient to configure puma with its configuration file and you'd prefer a way to do it using environment variables?

@beppe9000
Copy link
Author

correct. i don't have experience with ruby/rails/puma so i'd rather pass cert+key with environment variables 😅

@stevecrozz
Copy link
Member

I could see adding some more environment variable friendly config for puma. Maybe you could play with adding something like:

bind(ENV['PUMA_BIND'], "tcp://0.0.0.0:#{ENV['PORT'] || 8080}")

to https://github.com/errbit/errbit/blob/master/config/puma.default.rb

This way you could pass a PUMA_BIND variable to accomplish your TLS configuration and many other things that puma supports in https://github.com/puma/puma/blob/v3.12.2/lib/puma/dsl.rb#L123-L142

You could pass something like this as in the puma example:
PUMA_BIND='ssl://127.0.0.1:9292?key=key.key&cert=cert.pem'

@beppe9000
Copy link
Author

thanks for the support, i'll try that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants