-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Always run container with single Uvicorn process (#503)
Previously, we'd run our application container with uvicorn in development, but gunicorn with multiple workers in production. This made the app a little more complex when it came to metrics collection, and we have k8s to manage scaling. So, with this commit, we remove gunicorn and now always run the application with a single process. With removing Gunicorn, we also had to do some tweaking to our logging and application settings.
- Loading branch information
1 parent
f710b07
commit aeb42dc
Showing
13 changed files
with
64 additions
and
277 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import uvicorn | ||
|
||
from ctms.app import get_settings | ||
from ctms.log import configure_logging | ||
|
||
settings = get_settings() | ||
|
||
|
||
if __name__ == "__main__": | ||
logging_config = configure_logging( | ||
settings.use_mozlog, settings.logging_level.name, settings.log_sqlalchemy | ||
) | ||
|
||
server = uvicorn.Server( | ||
uvicorn.Config( | ||
"ctms.app:app", | ||
host=settings.host, | ||
port=settings.port, | ||
log_config=logging_config, | ||
) | ||
) | ||
server.run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.