Skip to content

Commit

Permalink
Base Update:
Browse files Browse the repository at this point in the history
Adds process manager
Improve workspace sync
Add method to get wan IP for VM environments
  • Loading branch information
robballantyne committed Nov 21, 2023
1 parent 86d61b7 commit 72db57c
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 57 deletions.
21 changes: 0 additions & 21 deletions .env

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ build/COPY_ROOT_EXTRA/
config/authorized_keys
config/rclone
tpdocs/
.env
58 changes: 27 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,24 +149,26 @@ You can use the included `cloudflared` service to make secure connections withou

## Environment Variables

| Variable | Description |
| --------------------- | ----------- |
| `CF_TUNNEL_TOKEN` | Cloudflare zero trust tunnel token - See [documentation](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/). |
| `CF_QUICK_TUNNELS` | Create ephemeral Cloudflare tunnels for web services (default `false`) |
| `COMFYUI_BRANCH` | ComfyUI branch/commit hash. Defaults to `master` |
| `COMFYUI_FLAGS` | Startup flags. eg. `--gpu-only --highvram` |
| `COMFYUI_PORT` | ComfyUI interface port (default `8188`) |
| `GPU_COUNT` | Limit the number of available GPUs |
| `PROVISIONING_SCRIPT` | URL of a remote script to execute on init. See [note](#provisioning-script). |
| `RCLONE_*` | Rclone configuration - See [rclone documentation](https://rclone.org/docs/#config-file) |
| `SKIP_ACL` | Set `true` to skip modifying workspace ACL |
| `SSH_PORT` | Set a non-standard port for SSH (default `22`) |
| `SSH_PUBKEY` | Your public key for SSH |
| `WEB_ENABLE_AUTH` | Enable password protection for web services (default `true`) |
| `WEB_USER` | Username for web services (default `user`) |
| `WEB_PASSWORD` | Password for web services (default `password`) |
| `WORKSPACE` | A volume path. Defaults to `/workspace/` |
| `WORKSPACE_SYNC` | Move mamba environments and services to workspace if mounted (default `true`) |
| Variable | Description |
| ------------------------ | ----------- |
| `CF_TUNNEL_TOKEN` | Cloudflare zero trust tunnel token - See [documentation](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/). |
| `CF_QUICK_TUNNELS` | Create ephemeral Cloudflare tunnels for web services (default `false`) |
| `COMFYUI_BRANCH` | ComfyUI branch/commit hash. Defaults to `master` |
| `COMFYUI_FLAGS` | Startup flags. eg. `--gpu-only --highvram` |
| `COMFYUI_PORT` | ComfyUI interface port (default `8188`) |
| `DIRECT_ADDRESS` | IP/hostname for service portal direct links (default `localhost`) |
| `DIRECT_ADDRESS_GET_WAN` | Use the internet facing interface for direct links (default `false`) |
| `GPU_COUNT` | Limit the number of available GPUs |
| `PROVISIONING_SCRIPT` | URL of a remote script to execute on init. See [note](#provisioning-script). |
| `RCLONE_*` | Rclone configuration - See [rclone documentation](https://rclone.org/docs/#config-file) |
| `SKIP_ACL` | Set `true` to skip modifying workspace ACL |
| `SSH_PORT` | Set a non-standard port for SSH (default `22`) |
| `SSH_PUBKEY` | Your public key for SSH |
| `WEB_ENABLE_AUTH` | Enable password protection for web services (default `true`) |
| `WEB_USER` | Username for web services (default `user`) |
| `WEB_PASSWORD` | Password for web services (default `password`) |
| `WORKSPACE` | A volume path. Defaults to `/workspace/` |
| `WORKSPACE_SYNC` | Move mamba environments and services to workspace if mounted (default `true`) |

Environment variables can be specified by using any of the standard methods (`docker-compose.yaml`, `docker run -e...`). Additionally, environment variables can also be passed as parameters of `init.sh`.

Expand All @@ -186,6 +188,10 @@ The password is stored as a bcrypt hash. If you prefer not to pass a plain text

If you are running the image locally on a trusted network, you may disable authentication by setting the environment variable `WEB_ENABLE_AUTH=false`.

>[!NOTE]
>You can use `set-web-credentials.sh <username> <password>` change the username and password in a running container.

## Provisioning script

It can be useful to perform certain actions when starting a container, such as creating directories and downloading files.
Expand Down Expand Up @@ -295,24 +301,15 @@ This is a simple webserver acting as a reverse proxy.

Caddy is used to enable basic authentication for all sensitive web services.

### Port Redirector
### Service Portal

This is a simple list of links to the web services available inside the container.

The service will bind to port `1111`.

For each service, you will find a direct link and, if you have set `CF_QUICK_TUNNELS=true`, a link to the service via a fast and secure Cloudflare tunnel.

>[!NOTE]
>*This service will not show links to any pre-configured Cloudflare tunnels as the domains are static and already known to the user.*
### Log Viewer

The web based log viewer will start on port `1122`.

It's a very lightweight websocket based stream of the latest updates in `/var/log/logtail.log`.

This service will also be accessible on any other exposed ports until the program designated to that port is ready to use.
A simple web-based log viewer and process manager are included for convenience.

### Cloudflared

Expand Down Expand Up @@ -396,8 +393,7 @@ Some ports need to be exposed for the services to run or for certain features of
| Open Port | Service / Description |
| --------------------- | ------------------------- |
| `22` | SSH server |
| `1111` | Port redirector web UI |
| `1122` | Log viewer web UI |
| `1111` | Service Portal web UI |
| `8188` | ComfyUI Interface |
| `8888` | Jupyter |
| `53682` | Rclone interactive config |
Expand Down
2 changes: 1 addition & 1 deletion build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ COPY ./COPY_ROOT/ /
ARG IMAGE_BASE
RUN /opt/ai-dock/bin/build/layer0/init.sh

ENV OPT_SYNC=ComfyUI:$OPT_SYNC
ENV OPT_SYNC=ComfyUI:serverless:$OPT_SYNC
ENV MAMBA_DEFAULT_ENV=comfyui
ENV MAMBA_DEFAULT_RUN="micromamba run -n $MAMBA_DEFAULT_ENV"

Expand Down
6 changes: 2 additions & 4 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ services:
- ${SSH_PORT_HOST:-2222}:${SSH_PORT:-22}
# redirect to Cloudflare quick tunnel
- ${REDIRECTOR_PORT_HOST:-1111}:1111
# Websocket log viewer
- ${LOG_VIEWER_PORT_HOST:-1122}:1122
# ComfyUI web interface
- ${COMFYUI_PORT_HOST:-8188}:${COMFYUI_PORT:-8188}
# Jupyter server
Expand All @@ -75,7 +73,8 @@ services:
- COMFYUI_FLAGS=${COMFYUI_FLAGS:-}
- COMFYUI_PORT=${COMFYUI_PORT:-8188}
- JUPYTER_MODE=${JUPYTER_MODE:-lab}
# Allows running true SSH alongside provider proxy SSH
- DIRECT_ADDRESS=${DIRECT_ADDRESS:-127.0.0.1}
- DIRECT_ADDRESS_GET_WAN=${DIRECT_ADDRESS_GET_WAN:-false}
- SSH_PORT=${SSH_PORT:-22}
- WORKSPACE=${WORKSPACE:-/workspace}
- WORKSPACE_SYNC=${WORKSPACE_SYNC:-true}
Expand All @@ -86,4 +85,3 @@ services:
- WEB_PASSWORD=${WEB_PASSWORD:-password}
- SERVERLESS=${SERVERLESS:-false}
#- PROVISIONING_SCRIPT=${PROVISIONING_SCRIPT:-}
- OPT_SYNC=ComfyUI:serverless

0 comments on commit 72db57c

Please sign in to comment.