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

cli: reload RPC-server TLS config on SIGHUP #1945

Merged
merged 2 commits into from
May 5, 2021
Merged

Conversation

AnnaShaleva
Copy link
Member

Close #1892.

@AnnaShaleva
Copy link
Member Author

I've tested it locally with the help of kill -1 PID, do we need a unit-test for that?

@roman-khimov roman-khimov changed the title cli: reload RPC-server TLS config on SIGHUB cli: reload RPC-server TLS config on SIGHUP Apr 30, 2021
@codecov
Copy link

codecov bot commented Apr 30, 2021

Codecov Report

Merging #1945 (b5dc598) into master (5924123) will decrease coverage by 0.03%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1945      +/-   ##
==========================================
- Coverage   82.92%   82.88%   -0.04%     
==========================================
  Files         289      289              
  Lines       22883    22896      +13     
==========================================
+ Hits        18975    18977       +2     
- Misses       2713     2725      +12     
+ Partials     1195     1194       -1     
Impacted Files Coverage Δ
cli/server/server.go 64.09% <0.00%> (-3.39%) ⬇️
pkg/services/notary/notary.go 92.46% <0.00%> (+1.00%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5924123...b5dc598. Read the comment docs.

Copy link
Member

@roman-khimov roman-khimov left a comment

Choose a reason for hiding this comment

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

Let's

  • always set SIGHUP handler
  • restart RPC even if TLS is not configured

In future we might also reread whole config, allow some service configuration changes and restart all services.

cli/server/server.go Outdated Show resolved Hide resolved
Copy link
Member

@roman-khimov roman-khimov left a comment

Choose a reason for hiding this comment

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

As for the test, we do run node IIRC in our tests, so it should be possible to add a test also.

cli/server/server.go Outdated Show resolved Hide resolved
@AnnaShaleva
Copy link
Member Author

As for the test, we do run node IIRC in our tests, so it should be possible to add a test also.

We do it via newTestChain, but the new piece of code is in the CLI package (not in the rpc/network server). I'm not sure how we can test it via unit-test.

@roman-khimov
Copy link
Member

Then we can probably leave these tests for #1576.

@@ -337,7 +351,17 @@ Main:
shutdownErr = fmt.Errorf("server error: %w", err)
cancel()

case <-rpcServerRestartChan:
Copy link
Member

Choose a reason for hiding this comment

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

Why can't you listen sighupCh here directly?

Copy link
Member Author

Choose a reason for hiding this comment

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

The original design required a separate channel, but it's OK now to use sighupCh, so fixed.

@roman-khimov
Copy link
Member

One thing that probably can be improved is documentation, how will anyone find out anything about this feature?

@roman-khimov roman-khimov merged commit 4fb4217 into master May 5, 2021
@roman-khimov roman-khimov deleted the network/tls branch May 5, 2021 12:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request]:Reread configs and TLS certificates on SIGHUP
3 participants