aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpacien2021-07-29 23:09:30 +0200
committerpacien2021-07-29 23:09:30 +0200
commit07a5b7d436d9be68a3c04e3584777e8ab6eac016 (patch)
treeb22a2be2e386c69dd9c28ac7f76d85a6df7fc2ed
parentd8ebf148dda8d5e7fae5906568aa01e98aa4cc23 (diff)
downloaduge_l2_rdbms_python_proto-07a5b7d436d9be68a3c04e3584777e8ab6eac016.tar.gz
flake: add app server package output
-rw-r--r--.gitignore1
-rw-r--r--flake.nix10
-rw-r--r--readme.md14
3 files changed, 25 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index aa78700..304a908 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
1__pycache__ 1__pycache__
2development_database 2development_database
3result
3*~ 4*~
4*.swp 5*.swp
5*.swo 6*.swo
diff --git a/flake.nix b/flake.nix
index 4e10a12..b8616f8 100644
--- a/flake.nix
+++ b/flake.nix
@@ -92,6 +92,16 @@
92 92
93 in { 93 in {
94 94
95 packages = {
96 # Minimal production server.
97 # This includes only application files tracked by git.
98 # Using `gunicorn` on top of `uvicorn` is recommended for bigger loads.
99 server = writeShellScript "server" ''
100 cd ${./.}
101 ${pythonWithDependencies}/bin/uvicorn --app-dir app app:main "$@"
102 '';
103 };
104
95 devShell = mkShell rec { 105 devShell = mkShell rec {
96 buildInputs = [ pythonWithDependencies ] ++ develPackagesAndScripts; 106 buildInputs = [ pythonWithDependencies ] ++ develPackagesAndScripts;
97 107
diff --git a/readme.md b/readme.md
index 8e18082..569b173 100644
--- a/readme.md
+++ b/readme.md
@@ -342,6 +342,20 @@ This server will listen to incoming requests to a locally bound port. It will
342automatically reload itself when its files are edited, and display logs about 342automatically reload itself when its files are edited, and display logs about
343type checking and runtime errors. 343type checking and runtime errors.
344 344
345### Production deployment
346
347While the deployment phase is way out of the scope of a database introductory
348course, asking students to deploy their application on the Internet could be a
349motivational factor. It would also facilitate evaluating and grading projects,
350avoiding deployment and testing hassles to the teaching staff.
351
352The Nix Flake provides a Nix package which can be used to run the web
353application in a production context as a [daemon], managed by a standard [init]
354system.
355
356[daemon]: https://en.wikipedia.org/wiki/Daemon_(computing)
357[init]: https://en.wikipedia.org/wiki/Init
358
345 359
346## Copyright and licensing 360## Copyright and licensing
347 361