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

New environmental variable LETSENCRYPT_RESTART_CONTAINER #442

Merged
merged 4 commits into from
Dec 21, 2018
Merged

New environmental variable LETSENCRYPT_RESTART_CONTAINER #442

merged 4 commits into from
Dec 21, 2018

Conversation

Greek64
Copy link
Contributor

@Greek64 Greek64 commented Sep 24, 2018

This PR adds an additional functionality via an additional environmental variable.

Containers with the LETSENCRYPT_RESTART_CONTAINER variable set to true will be restarted when their respective certificates are updated/modified.

Fixes #434

@buchdag
Copy link
Member

buchdag commented Oct 5, 2018

Hi. I haven't forgotten about this PR but I'm still unsure about merging it (because of the project scope issue).

By the way if this is to be merged it'll require a corresponding test unit.

@Greek64
Copy link
Contributor Author

Greek64 commented Oct 5, 2018

Yeah, don't worry.
As said, I will try to keep the fork updated for the guys that want this functionality as long as this isn't merged (which may be never).

I didn't think of the test unit.
I will look into that when I have time.

@buchdag
Copy link
Member

buchdag commented Oct 5, 2018

No hurry for the test unit, at least until we've reached a decision about merging the feature or not.

@Greek64
Copy link
Contributor Author

Greek64 commented Dec 3, 2018

I have integrated the functionality into the existing test units (namely certs_single, certs_san, force_renew).

I currently have to versions:

  • One for the stable (tag v1.9.1)
  • One for master (f936be7)

The thing is, that the test units on master fail on my system (even without me changing anything), and so I am reluctant to push them on these PR branch, until they run on my system.
The stable test units work as expected (but are before you trapped the cleanup routine on exit, i.e. outdated).
So I could force push these PR around the v1.9.1 tag if you would like.

The other thing is, that the actual functionality for which the environmental variable was added (auto-renewal), is currently not even tested (see #477 ).

@Greek64
Copy link
Contributor Author

Greek64 commented Dec 3, 2018

Another thing that I noticed in the test units:
Shouldn't the loop in line 34 in the default_certs test unit contain a break?

@buchdag
Copy link
Member

buchdag commented Dec 14, 2018

Another thing that I noticed in the test units:
Shouldn't the loop in line 34 in the default_certs test unit contain a break?

Yes it should, thanks for spotting that.

I've been lacking spare time for the last few weeks, I'll come back to this PR as soon as I can. Got a few thinks I want to clear first.

@Greek64
Copy link
Contributor Author

Greek64 commented Dec 19, 2018

The thing is, that the test units on master fail on my system (even without me changing anything), and so I am reluctant to push them on these PR branch, until they run on my system.

I found the reason why the test units fail locally.
See #482

	Containers with this variable set to true will be restarted
      	when their respective certificates are updated/modified.
@Greek64
Copy link
Contributor Author

Greek64 commented Dec 19, 2018

I updated the PR to the newest master commit and pushed the new test units.
Now everything passes.

@buchdag
Copy link
Member

buchdag commented Dec 20, 2018

Okay, I've just reviewed your PR, thanks for your work.

I think a separate test unit for this feature would be more fitting, rather than adding more logic to three existing tests. You could just take the basic cert_single test, remove all the cert verification code and just check that the container is restarted correctly.

Also if your test generate extra files (docker_event_out.txt), don't forget to add them to .gitignore, just in case (even if it has a trapped removal).

@buchdag
Copy link
Member

buchdag commented Dec 20, 2018

BTW if this wasn't clear this PR will be merged as soon as the last details are ironed out 👍

@Greek64
Copy link
Contributor Author

Greek64 commented Dec 21, 2018

Added a separate "container_restart" test unit, and added temp file to .gitignore.

@@ -126,9 +126,10 @@ function update_certs {
unset LETSENCRYPT_CONTAINERS
# shellcheck source=/dev/null
source /app/letsencrypt_service_data

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whitespace issues ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably a side effect of "automatic indentation" of my Editor.

@@ -150,7 +151,7 @@ function update_certs {
if [[ "$cert_keysize" == "<no value>" ]]; then
cert_keysize=$DEFAULT_KEY_SIZE
fi

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

@buchdag
Copy link
Member

buchdag commented Dec 21, 2018

If you can cleanup the two remaining whitespace typos and write a line of doc explaining this feature I think we're good to go.

@Greek64
Copy link
Contributor Author

Greek64 commented Dec 21, 2018

If you can cleanup the two remaining whitespace typos and write a line of doc explaining this feature I think we're good to go.

Done

@buchdag buchdag merged commit 6c73fc2 into nginx-proxy:master Dec 21, 2018
@buchdag buchdag added the lgtm label Dec 21, 2018
@Greek64 Greek64 deleted the PR branch December 21, 2018 22:48
@buchdag buchdag added kind/feature-request Issue requesting a new feature kind/bug Issue reporting a bug and removed kind/bug Issue reporting a bug labels Oct 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature-request Issue requesting a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Restart Containers on Cert Renewal
2 participants