Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

[WIP] Handle registry events in the background #1353

Closed
wants to merge 2 commits into from

Conversation

mssola
Copy link
Collaborator

@mssola mssola commented Jul 28, 2017

As some issues have pointed out (#940 and #1235), Portus can freeze if it doesn't have enough Puma workers. The solution is to either increase the value of available Puma workers, or setup an HA setup with multiple Portus instances.

Sometimes this is not possible, so this WIP PR handles events differently:

  • Events are not handled directly, but pushed into the DB.
  • Another process will pick up events not handled and do the rest.

This way, Portus should not freeze even if there are no workers. This is configurable and disabled by default, since it makes the deployment of Portus more complex, and it's riskier imho than what we currently have.

Signed-off-by: Miquel Sabaté Solà <[email protected]>
Signed-off-by: Miquel Sabaté Solà <[email protected]>
mssola added a commit to mssola/Portus that referenced this pull request Aug 1, 2017
This has been extracted both from
https://github.com/openSUSE/docker-containers and SUSE#1353, since it will
be useful for SUSE#1357 as well.

Signed-off-by: Miquel Sabaté Solà <[email protected]>
@mssola
Copy link
Collaborator Author

mssola commented Aug 1, 2017

It will be need a rebase after #1358.

mssola added a commit to mssola/Portus that referenced this pull request Dec 1, 2017
Unless you provided enough Puma workers, there was a problem with HTTP
requests getting blocked. This is a similar issue as pointed out in SUSE#1353
with registry events.

The solution has been to move security scanning in the background, in a
different process. This is similar to SUSE#1353, but more polished (and if
this proves to really work we might move SUSE#1353 to this background runner
as well). Now the Tag model has two more columns: `vulnerabilities` and
`scanned`. The former contains the cached result of the latest security
check. The latter is an integer that can have three different values: 0
(scanning not performed), 1 (working on it) and 2 (scanning done). This
has also been exposed on the API, so the client side can be updated.

Signed-off-by: Miquel Sabaté Solà <[email protected]>
mssola added a commit to mssola/Portus that referenced this pull request Dec 4, 2017
Unless you provided enough Puma workers, there was a problem with HTTP
requests getting blocked. This is a similar issue as pointed out in SUSE#1353
with registry events.

The solution has been to move security scanning in the background, in a
different process. This is similar to SUSE#1353, but more polished (and if
this proves to really work we might move SUSE#1353 to this background runner
as well). Now the Tag model has two more columns: `vulnerabilities` and
`scanned`. The former contains the cached result of the latest security
check. The latter is an integer that can have three different values: 0
(scanning not performed), 1 (working on it) and 2 (scanning done). This
has also been exposed on the API, so the client side can be updated.

Signed-off-by: Miquel Sabaté Solà <[email protected]>
mssola added a commit to mssola/Portus that referenced this pull request Dec 4, 2017
Unless you provided enough Puma workers, there was a problem with HTTP
requests getting blocked. This is a similar issue as pointed out in SUSE#1353
with registry events.

The solution has been to move security scanning in the background, in a
different process. This is similar to SUSE#1353, but more polished (and if
this proves to really work we might move SUSE#1353 to this background runner
as well). Now the Tag model has two more columns: `vulnerabilities` and
`scanned`. The former contains the cached result of the latest security
check. The latter is an integer that can have three different values: 0
(scanning not performed), 1 (working on it) and 2 (scanning done). This
has also been exposed on the API, so the client side can be updated.

Signed-off-by: Miquel Sabaté Solà <[email protected]>
mssola added a commit to mssola/Portus that referenced this pull request Dec 14, 2017
From now on, registry notifications (image got pushed, image deleted)
will be handled entirely in the background. Portus itself will only
create the event on the DB, and it will expect for it to be handled
automatically by the background process.

Fixes SUSE#940
See SUSE#1353 and SUSE#1526

Signed-off-by: Miquel Sabaté Solà <[email protected]>
@mssola
Copy link
Collaborator Author

mssola commented Dec 14, 2017

Closing in favor of #1537

@mssola mssola closed this Dec 14, 2017
@mssola mssola deleted the background branch December 14, 2017 09:09
mssola added a commit to mssola/Portus that referenced this pull request Dec 14, 2017
From now on, registry notifications (image got pushed, image deleted)
will be handled entirely in the background. Portus itself will only
create the event on the DB, and it will expect for it to be handled
automatically by the background process.

Fixes SUSE#940
See SUSE#1353 and SUSE#1526

Signed-off-by: Miquel Sabaté Solà <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant