Skip to content

Commit 910b57f

Browse files
committed
Add docs for static_disk spec
1 parent 7c46f2b commit 910b57f

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ This project uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
1010
### Added
1111

1212
- Added the app code setting `container.separate_stage_prod_images` for specs that need distinct staging and production container images.
13+
- Added the `static_disk` app spec for serving static files directly from a local source directory without storing the static file contents in the metadata database.
1314

1415
### Changed
1516

docs/content/docs/Container/AppSpecs.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@ will create an app at `https://localhost:25223/streamlit_app`. On the first API
2828

2929
The `container` spec is a generic spec which can be used when there is a `Dockerfile` defined in tha app source code.
3030

31+
The `static` specs serve files from the app source. The `static` and `static_single` specs load source files into the metadata database like other non-dev disk apps. The `static_disk` spec is for local-disk sources only: OpenRun stores the spec metadata, but static files are served directly from the source directory on disk and are not copied into the metadata database. Updating a served file on disk takes effect on the next request. App reload is still required when app metadata or app definition behavior changes, such as changing the selected spec, `app.star`, `params.star`, `index`, or `single_file`.
32+
33+
```shell
34+
openrun app create --spec static_disk --approve \
35+
--param index=index.html /srv/sites/my-static-site /site
36+
```
37+
38+
On Kubernetes, a network mounted disk path should be used for the `static_disk` source path so that files are visible from all pods.
39+
3140
By default, staging and production apps generated from the same source share the same generated container image when the build inputs match. App specs should keep app path and domain values out of image builds when possible, and read runtime values such as `CL_APP_PATH` and `CL_APP_URL` from the container environment instead. If a spec must embed staging or production URL information into the image during build, set `container.separate_stage_prod_images` in the spec's `app.star`:
3241

3342
```python {filename="app.star"}
@@ -48,6 +57,9 @@ The specs defined currently are:
4857
| container | | <ul><li><b>port</b> : The port number within container, optional if EXPOSE directive is present</li></ul> | Depends on app | Requires app code to have a Containerfile/Dockerfile |
4958
| image | <ul><li><b>image</b>: The image to use for the container</li> <li><b>port</b> : The port number within container</li></ul> | | Depends on app | No source url required when creating app, use - as url | `openrun app create --spec image --approve --param image=nginx --param port=80 - nginxapp.localhost:/` |
5059
| proxy | <ul><li><b>url</b>: The url to which requests should be proxied</li> </ul> | | No | No source url required when creating app, use - as url | `openrun app create --spec proxy --approve -param url=https://openrun.dev - proxyapp.localhost:/` |
60+
| static | | <ul><li><b>index</b>: The index file to serve</li><li><b>single_file</b>: Serve only the index file</li></ul> | Yes | All files under source folder are served from metadata | `openrun app create --spec static --approve --param index=index.html github.com/example/site /site` |
61+
| static_single | | <ul><li><b>index</b>: The index file to serve</li></ul> | Yes | Only the index file is served from metadata | `openrun app create --spec static_single --approve --param index=index.html github.com/example/site /site` |
62+
| static_disk | | <ul><li><b>index</b>: The index file to serve</li><li><b>single_file</b>: Serve only the index file</li></ul> | Yes | Local disk source only; files are served directly from disk | `openrun app create --spec static_disk --approve --param index=index.html /srv/sites/my-static-site /site` |
5163
| python-wsgi | | <ul><li><b>APP_MODULE</b>: The module:app for the WSGI app. Defaults to app:app, meaning app in app.py</li> </ul> | Depends on app | Runs Web Server Gateway Interface (WSGI) apps using gunicorn |
5264
| python-asgi | | <ul><li><b>APP_MODULE</b>: The module:app for the ASGI app. Defaults to app:app, meaning app in app.py</li> </ul> | Depends on app | Runs Asynchronous Server Gateway Interface (ASGI) apps using uvicorn |
5365
| python-flask | | <ul><li><b>port</b> : The port number within container. If EXPOSE directive is present, that is used. Defaults to 5000</li></ul> | Depends on app | Runs app using flask dev server |

0 commit comments

Comments
 (0)