-
Notifications
You must be signed in to change notification settings - Fork 472
Make containerized deployment more configurable #1880
Make containerized deployment more configurable #1880
Conversation
I think this should be backported also to the 2.3 branch |
docker/init
Outdated
@@ -82,7 +82,6 @@ done | |||
update-ca-certificates | |||
|
|||
# Further settings | |||
export PORTUS_PUMA_HOST="0.0.0.0:3000" |
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 wouldn't delete this, since it will break the deployment for most users. I propose to export this env. variable to this default value if none has been provided.
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 isn't going to help with my use-case: have puma bind to unix socket even when running Portus using the official container, see:
Lines 19 to 31 in 7358f3a
if ENV["PORTUS_PUMA_HOST"] | |
if ENV["PORTUS_PUMA_TLS_KEY"] | |
host, port = ENV["PORTUS_PUMA_HOST"].split(":") | |
port ||= "3000" | |
ssl_bind host, port, | |
key: ENV["PORTUS_PUMA_TLS_KEY"], | |
cert: ENV["PORTUS_PUMA_TLS_CERT"] | |
else | |
bind "tcp://#{ENV["PORTUS_PUMA_HOST"]}" | |
end | |
else | |
bind "unix://#{File.join(Dir.pwd, "tmp/sockets/puma.sock")}" | |
end |
Another way would be to rework the code I pasted above to something like:
if ENV["PORTUS_PUMA_HOST"] && !ENV["PORTUS_PUMA_USE_UNIX_SOCKET"]
...
else
# bind to socket
end
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'd prefer the code you just pasted instead of the old one because I believe that telling people to always set this env. variable to "0.0.0.0:3000" for the most common use case is confusing. Instead, if you really know what you are doing, you can provide this extra env. variable.
So a 👍 from my side.
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.
Oh, and instead of !ENV["PORTUS_PUMA_USE_UNIX_SOCKET"]
, I think it's safer (and more elegant 🤓) ENV["PORTUS_PUMA_USE_UNIX_SOCKET"].blank?
9dd48dc
to
23af4bf
Compare
@mssola I've updated the code but I haven't tested it. AFAIK |
Also, which branch holds the documentation? |
I've tested it and nothing broke 😄 That's because we are calling puma from within the context of a Rails application (notice, for example, that we later call
It's on the |
As for the failing integration tests, maybe a rebase does the trick, otherwise we'll have to check what's broken. |
23af4bf
to
256430a
Compare
Rebased |
@mssola, the patch is not working. I tested it with a containerized image and I got:
I would change the patch to if ENV["PORTUS_PUMA_HOST"] && ENV["PORTUS_PUMA_USE_UNIX_SOCKET"] != "true" this works fine. |
@flavio tomorrow we want to release |
Introduce the `PORTUS_PUMA_USE_UNIX_SOCKET`. Setting this environment variable will cause puma to use a unix socket instead of binding to a network port. Signed-off-by: Flavio Castelli <[email protected]>
Allow to instantiate a connection with a database listening over a unix socket. Signed-off-by: Flavio Castelli <[email protected]>
256430a
to
ce2f63f
Compare
@mssola done! |
ce2f63f
to
4b57ad6
Compare
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.
Thanks 👏
Cherry-picked and pushed into |
The pull request #1880 introduced two new environment variables. This commit updates the documentation explaining both of them. Signed-off-by: Miquel Sabaté Solà <[email protected]>
The pull request #1880 introduced two new environment variables. This commit updates the documentation explaining both of them. Signed-off-by: Miquel Sabaté Solà <[email protected]>
docs: updated the documentation for #1880
A bunch of changes required to be more flexible when deploying Portus into a containerized environment.
TODO