-
Notifications
You must be signed in to change notification settings - Fork 1
Adding Eureka Service Discovery to Keyserver #264
Conversation
Removed java eureka
Conflicts: lega/keyserver.py
asyncio.TimeoutError) as e: | ||
LOG.debug(f"Eureka connection error: {e!r}") | ||
LOG.debug(f"Retrying in {backoff} seconds") | ||
asyncio.sleep(backoff) |
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.
Should not this be awaited? (which could be also updated in db.py#L61)
LOG.error("Could not connect to the Eureka.") | ||
pass | ||
# We don't fail right away as we expect the keysever to continue | ||
# Under "normal deployment" this should exit ? |
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 don't think so.
Probably, it should try again later.
lega/utils/eureka.py
Outdated
async with aiohttp.ClientSession(headers=self._headers) as session: | ||
async with session.put(url) as resp: | ||
LOG.debug('Eureka out_of_service status response %s' % resp.status) | ||
await session.close() |
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.
The session is closed already by the context manager (ie, at the end of the with
statement)
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 commented them out and tried. It seem to be ok.
Moreover, we add [cega-users]/pgp/{username} on the fake cega-users server, to retrieve the PGP public key of a given user, as if we read the public key from file.
There are now 2 more temporary endpoints:
|
Adding Eureka Service Discovery to Keyserver
The keyserver needs to play an extended role, thus we made it register with Eureka Service Discovery.
We don't use a library we instead follow the specification from https://github.com/Netflix/eureka/wiki/Eureka-REST-operations
The keyserver does not fail it there is no connection to Eureka Service discovery.
We provided a fake eureka server just to test that the Keyserver can indeed make the required requests for registration and renewing of lease.
This PR also integrates the RSA key encryption, as we don't want to keep the RSA key unprotected.