|
@@ -76,13 +76,14 @@ You can call `ui.run()` with optional arguments for some high-level configuratio
|
|
|
|
|
|
## Docker
|
|
|
|
|
|
-Use the [multi-arch docker image](https://hub.docker.com/repository/docker/zauberzeug/nicegui) for pain-free installation:
|
|
|
+You can use our [multi-arch docker image](https://hub.docker.com/repository/docker/zauberzeug/nicegui) for pain-free installation:
|
|
|
|
|
|
```bash
|
|
|
-docker run --rm -p 8888:8080 -v $(pwd)/my_script.py:/app/main.py -it zauberzeug/nicegui:latest
|
|
|
+docker run --rm -p 8888:8080 -v $(pwd):/app/ -it zauberzeug/nicegui:latest
|
|
|
```
|
|
|
|
|
|
-This will start the server at http://localhost:8888 with code from `my_script.py` within the current directory.
|
|
|
+This will start the server at http://localhost:8888 with the code from your current directory.
|
|
|
+The file containing your `app.run(port=8080, ...)` command must be named `main.py`.
|
|
|
Code modification triggers an automatic reload.
|
|
|
|
|
|
## Why?
|
|
@@ -95,3 +96,33 @@ While too "low-level HTML" for our daily usage it provides a great basis for "Ni
|
|
|
|
|
|
The API reference is hosted at [https://nicegui.io](https://nicegui.io) and is [implemented with NiceGUI itself](https://github.com/zauberzeug/nicegui/blob/main/main.py).
|
|
|
You may also have a look at [examples.py](https://github.com/zauberzeug/nicegui/tree/main/examples.py) for more demonstrations of what you can do with NiceGUI.
|
|
|
+
|
|
|
+## Abstraction
|
|
|
+
|
|
|
+NiceGUI is based on [JustPy](https://justpy.io/) which is based on the ASGI framework [Starlette](https://www.starlette.io/) and the ASGI webserver [Uvicorn](https://www.uvicorn.org/).
|
|
|
+
|
|
|
+# Deployment
|
|
|
+
|
|
|
+To deploy your NiceGUI app, you will need to execute your `main.py` (or which ever file contains your `app.run(...)`) on your server infrastructure.
|
|
|
+You can either install the [NiceGUI python package via pip](https://pypi.org/project/nicegui/) on the server or use our [pre-build docker image](https://hub.docker.com/r/zauberzeug/nicegui) which contains all necessary dependencies and provides a much much cleaner deployment.
|
|
|
+For example you can use this docker run command to start the script `main.py` in the current directory on port 80:
|
|
|
+
|
|
|
+```bash
|
|
|
+docker run -p 80:8080 -v $(pwd)/:/app/ -d --restart always zauberzeug/nicegui:latest
|
|
|
+```
|
|
|
+
|
|
|
+The example assumes `main.py` uses the port 8080 in the `ui.run` command (which is the default).
|
|
|
+The `--restart always` makes sure the container is restarted on crash of the app or reboot of the server.
|
|
|
+Of course this can also be written in a docker compose file:
|
|
|
+
|
|
|
+```yaml
|
|
|
+nicegui:
|
|
|
+ image: zauberzeug/nicegui:latest
|
|
|
+ restart: always
|
|
|
+ ports:
|
|
|
+ - 80:8080
|
|
|
+ volumes:
|
|
|
+ - ./:/app/
|
|
|
+```
|
|
|
+
|
|
|
+While it's possible to provide SSL certificates directly through NiceGUI (using [JustPy config](https://justpy.io/reference/configuration/)) we suggest to use an reverse proxy like [Traefik](https://doc.traefik.io/traefik/) or [NGINX](https://www.nginx.com/).
|