1
0
mirror of https://github.com/quay/quay.git synced 2025-07-28 20:22:05 +03:00

local-dev: implement local development environment (#610)

* local-dev: implement local development environment

this commit copies the files in /init into /local-dev, edits those files
to support hot-reload features for local development, and introduces
docker-compose/makefile targets in order to support local dev.

Signed-off-by: ldelossa <ldelossa@redhat.com>

* local-dev: hop quay workers to gunicorn

this commit adds a uwsgi worker application delegate and a factory
function allowing each worker to be ran by gunicorn.

each worker now supports hot-reload and will reload itself when it's
code is updated.

this changes only affects the local dev env.

Signed-off-by: ldelossa <ldelossa@redhat.com>

* local-dev: add docs

Signed-off-by: ldelossa <ldelossa@redhat.com>
This commit is contained in:
Louis DeLosSantos
2020-12-15 12:37:21 -05:00
committed by GitHub
parent c9ac4aac1f
commit 113ccebbbf
69 changed files with 2938 additions and 16 deletions

View File

@ -9,6 +9,7 @@ from workers.blobuploadcleanupworker.models_pre_oci import pre_oci_model as mode
from workers.worker import Worker
from util.log import logfile_path
from util.locking import GlobalLock, LockNotAcquiredException
from workers.gunicorn_worker import GunicornWorker
logger = logging.getLogger(__name__)
@ -70,6 +71,19 @@ class BlobUploadCleanupWorker(Worker):
logger.debug("Removed stale blob upload %s", stale_upload.uuid)
def create_gunicorn_worker():
"""
follows the gunicorn application factory pattern, enabling
a quay worker to run as a gunicorn worker thread.
this is useful when utilizing gunicorn's hot reload in local dev.
utilizing this method will enforce a 1:1 quay worker to gunicorn worker ratio.
"""
worker = GunicornWorker(__name__, app, BlobUploadCleanupWorker(), True)
return worker
if __name__ == "__main__":
logging.config.fileConfig(logfile_path(debug=False), disable_existing_loggers=False)
worker = BlobUploadCleanupWorker()