diff options
author | pacien | 2021-07-30 01:13:20 +0200 |
---|---|---|
committer | pacien | 2021-07-30 01:13:20 +0200 |
commit | 927329de79257d272947e3f883ad574261ff8060 (patch) | |
tree | 350602facd2abbddcb60fe252fdcf8e8784e7e7b /flake.nix | |
parent | 23fd3609294f6e8a16b6351f1b27f5b6dd2dcc89 (diff) | |
download | uge_l2_rdbms_python_proto-927329de79257d272947e3f883ad574261ff8060.tar.gz |
docs: add container-based cloud deployment to Heroku
Diffstat (limited to 'flake.nix')
-rw-r--r-- | flake.nix | 15 |
1 files changed, 14 insertions, 1 deletions
@@ -31,6 +31,9 @@ | |||
31 | develPackagesAndScripts = [ | 31 | develPackagesAndScripts = [ |
32 | postgresql_13 # PostgreSQL server with the standard admin tools. | 32 | postgresql_13 # PostgreSQL server with the standard admin tools. |
33 | python.pkgs.ipython # Interactive Python REPL for experimenting. | 33 | python.pkgs.ipython # Interactive Python REPL for experimenting. |
34 | heroku # CLI for the Heroku hosting platform. | ||
35 | skopeo # Docker container upload utility. | ||
36 | pwgen # Simple random token generator. | ||
34 | 37 | ||
35 | # More pleasant alternative to psql, with colours and auto-completion. | 38 | # More pleasant alternative to psql, with colours and auto-completion. |
36 | # Custom configuration to suppress irrelevant warnings and messages. | 39 | # Custom configuration to suppress irrelevant warnings and messages. |
@@ -92,7 +95,7 @@ | |||
92 | 95 | ||
93 | in { | 96 | in { |
94 | 97 | ||
95 | packages = { | 98 | packages = rec { |
96 | # Minimal production server. | 99 | # Minimal production server. |
97 | # This includes only application files tracked by git. | 100 | # This includes only application files tracked by git. |
98 | # Using `gunicorn` on top of `uvicorn` is recommended for bigger loads. | 101 | # Using `gunicorn` on top of `uvicorn` is recommended for bigger loads. |
@@ -100,6 +103,16 @@ | |||
100 | cd ${./.} | 103 | cd ${./.} |
101 | ${pythonWithDependencies}/bin/uvicorn --app-dir app app:main "$@" | 104 | ${pythonWithDependencies}/bin/uvicorn --app-dir app app:main "$@" |
102 | ''; | 105 | ''; |
106 | |||
107 | # Minimal docker image. | ||
108 | # The Heroku hosting service assigns the `$PORT` dynamically. | ||
109 | docker = dockerTools.streamLayeredImage { | ||
110 | maxLayers = 2; | ||
111 | name = "app-docker"; | ||
112 | config.EntryPoint = writeShellScript "run.sh" '' | ||
113 | ${server} --host 0.0.0.0 --port $PORT | ||
114 | ''; | ||
115 | }; | ||
103 | }; | 116 | }; |
104 | 117 | ||
105 | devShell = mkShell rec { | 118 | devShell = mkShell rec { |