diff --git a/.env b/.env index 8feebc2..6d11703 100644 --- a/.env +++ b/.env @@ -20,6 +20,10 @@ WEB_PASSWORD=password WORKSPACE=/workspace/ CF_TUNNEL_TOKEN= CF_QUICK_TUNNELS=true +JUPYTER_PORT=8888 +JUPYTER_PORT_HOST=8888 +JUPYTER_TOKEN=password +JUPYTER_MODE=notebook SSH_PORT=22 SSH_PORT_HOST=2222 RCLONE_PORT_HOST=53682 \ No newline at end of file diff --git a/build/COPY_ROOT/opt/ai-dock/bin/preflight.sh b/build/COPY_ROOT/opt/ai-dock/bin/preflight.sh index c15e89b..ba45311 100755 --- a/build/COPY_ROOT/opt/ai-dock/bin/preflight.sh +++ b/build/COPY_ROOT/opt/ai-dock/bin/preflight.sh @@ -2,6 +2,7 @@ function main() { move_to_workspace + copy_notebook update_horde set_safe_envs write_config @@ -17,6 +18,14 @@ function move_to_workspace() { fi } +function copy_notebook() { + if micromamba env list | grep 'jupyter' > /dev/null 2>&1; then + if [[ ! -f "${WORKSPACE}/dreamer.ipynb" ]]; then + cp /usr/local/share/ai-dock/dreamer.ipynb ${WORKSPACE} + fi + fi +} + function update_horde() { /opt/horde/bin/update-hordelib.sh /opt/horde/bin/update-horde-worker.sh diff --git a/build/COPY_ROOT/usr/local/share/ai-dock/dreamer.ipynb b/build/COPY_ROOT/usr/local/share/ai-dock/dreamer.ipynb new file mode 100644 index 0000000..d2dd6ae --- /dev/null +++ b/build/COPY_ROOT/usr/local/share/ai-dock/dreamer.ipynb @@ -0,0 +1,81 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "id": "9f9fd726-736c-40f9-b4b3-d4439c6fe94f", + "metadata": {}, + "outputs": [], + "source": [ + "# Stop the dreamer service\n", + "\n", + "!supervisorctl stop dreamer:*" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "715b36cb-ae96-4887-acb9-fd393fa1c2d8", + "metadata": {}, + "outputs": [], + "source": [ + "# Start the dreamer service\n", + "\n", + "!supervisorctl start dreamer:*" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "df0afee2-8e20-4206-bccf-fecac674f481", + "metadata": {}, + "outputs": [], + "source": [ + "# View the live logs\n", + "\n", + "!logtail.sh" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "9950e252-a1ad-4f7e-baef-0703b1cd3bd6", + "metadata": {}, + "outputs": [], + "source": [ + "# Get secure web UI link\n", + "\n", + "!grep -b0 -a0 'trycloudflare.com' /var/log/supervisor/quicktunnel-horde-webui.log" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "08cbd5a5-0d3f-44d0-a952-cc0d0dd35a2a", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Horde", + "language": "python", + "name": "horde" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.10.12" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/docker-compose.yaml b/docker-compose.yaml index 1421027..b89a203 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -7,7 +7,7 @@ services: args: IMAGE_BASE: ${IMAGE_BASE} tags: - - "ghcr.io/ai-dock/horde-dreamer:${IMAGE_TAG}" + - "ghcr.io/ai-dock/ai-horde-dreamer:${IMAGE_TAG}" image: ghcr.io/ai-dock/ai-horde-dreamer:${IMAGE_TAG} @@ -42,6 +42,8 @@ services: - ${RCLONE_PORT_HOST}:53682 # AI Horde web UI - ${HORDE_WEBUI_PORT_HOST}:7860 + # Jupyter + - ${JUPYTER_PORT_HOST}:${JUPYTER_PORT} environment: # AI-Horde-Worker branch or commit hash @@ -63,6 +65,9 @@ services: # Allows running true SSH alongside provider proxy SSH - SSH_PORT=${SSH_PORT} - WORKSPACE=${WORKSPACE} + - JUPYTER_PORT=${JUPYTER_PORT} + - JUPYTER_TOKEN=${JUPYTER_TOKEN} + - JUPYTER_MODE=${JUPYTER_MODE} - CF_TUNNEL_TOKEN=${CF_TUNNEL_TOKEN} - CF_QUICK_TUNNELS=${CF_QUICK_TUNNELS} #- PROVISIONING_SCRIPT=https://raw.githubusercontent.com/ai-dock/base-image/main/demo/provisioning.sh