diff --git a/Dockerfile b/Dockerfile index 55442c43..efd319bb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,24 +1,31 @@ -FROM python:3.12.3-alpine as base -WORKDIR /opt/hyperglass -ENV HYPERGLASS_APP_PATH=/etc/hyperglass -ENV HYPERGLASS_HOST=0.0.0.0 -ENV HYPERGLASS_PORT=8001 -ENV HYPERGLASS_DEBUG=false -ENV HYPERGLASS_DEV_MODE=false -ENV HYPERGLASS_REDIS_HOST=redis -ENV HYPEGLASS_DISABLE_UI=true -ENV HYPERGLASS_CONTAINER=true -COPY . . - -FROM base as ui -WORKDIR /opt/hyperglass/hyperglass/ui +FROM python:3.12.3-alpine AS tools RUN apk add build-base pkgconfig cairo-dev nodejs npm RUN npm install -g pnpm + +FROM tools AS base +ENV HYPERGLASS_APP_PATH=/etc/hyperglass \ + HYPERGLASS_HOST=0.0.0.0 \ + HYPERGLASS_PORT=8001 \ + HYPERGLASS_DEBUG=false \ + HYPERGLASS_DEV_MODE=false \ + HYPERGLASS_REDIS_HOST=redis \ + HYPEGLASS_DISABLE_UI=true \ + HYPERGLASS_CONTAINER=true + +FROM base AS deps +# JS Dependencies for UI +WORKDIR /opt/hyperglass/hyperglass/ui +COPY hyperglass/ui/package.json . +COPY hyperglass/ui/pnpm-lock.yaml . RUN pnpm install -P -FROM ui as hyperglass +# Python Dependencies for Backend WORKDIR /opt/hyperglass -RUN pip3 install -e . +COPY README.md . +COPY pyproject.toml . +RUN pip install -e . +FROM deps AS hyperglass +COPY . . EXPOSE ${HYPERGLASS_PORT} CMD ["python3", "-m", "hyperglass.console", "start"] diff --git a/compose-self.yaml b/compose-self.yaml new file mode 100644 index 00000000..86c526f9 --- /dev/null +++ b/compose-self.yaml @@ -0,0 +1,22 @@ +services: + kv-storage: + image: "valkey/valkey:8-alpine" + + hyperglass: + build: . + depends_on: + - kv-storage + environment: + - HYPERGLASS_APP_PATH=/etc/hyperglass + - HYPERGLASS_REDIS_HOST=${HYPERGLASS_REDIS_HOST-kv-storage} + - HYPERGLASS_HOST=${HYPERGLASS_HOST-0.0.0.0} + - HYPERGLASS_PORT=${HYPERGLASS_PORT-8001} + - HYPERGLASS_DEBUG=${HYPERGLASS_DEBUG-false} + - HYPERGLASS_DEV_MODE=${HYPERGLASS_DEV_MODE-false} + - HYPEGLASS_DISABLE_UI=${HYPEGLASS_DISABLE_UI-false} + - HYPERGLASS_CONTAINER=${HYPERGLASS_CONTAINER-true} + - HYPERGLASS_ORIGINAL_APP_PATH=${HYPERGLASS_APP_PATH} + ports: + - "${HYPERGLASS_PORT-8001}:${HYPERGLASS_PORT-8001}" + volumes: + - ${HYPERGLASS_APP_PATH-/etc/hyperglass}:/etc/hyperglass diff --git a/compose.yaml b/compose.yaml index 74a6ff6d..93395c86 100644 --- a/compose.yaml +++ b/compose.yaml @@ -1,21 +1,23 @@ services: - redis: - image: "redis:alpine" + kv-storage: + image: "valkey/valkey:8-alpine" + hyperglass: + image: ghcr.io/thatmattlove/hyperglass:main + restart: unless-stopped depends_on: - - redis + - kv-storage environment: - HYPERGLASS_APP_PATH=/etc/hyperglass + - HYPERGLASS_REDIS_HOST=${HYPERGLASS_REDIS_HOST-kv-storage} - HYPERGLASS_HOST=${HYPERGLASS_HOST-0.0.0.0} - HYPERGLASS_PORT=${HYPERGLASS_PORT-8001} - HYPERGLASS_DEBUG=${HYPERGLASS_DEBUG-false} - HYPERGLASS_DEV_MODE=${HYPERGLASS_DEV_MODE-false} - - HYPERGLASS_REDIS_HOST=${HYPERGLASS_REDIS_HOST-redis} - HYPEGLASS_DISABLE_UI=${HYPEGLASS_DISABLE_UI-false} - HYPERGLASS_CONTAINER=${HYPERGLASS_CONTAINER-true} - HYPERGLASS_ORIGINAL_APP_PATH=${HYPERGLASS_APP_PATH} - build: . ports: - "${HYPERGLASS_PORT-8001}:${HYPERGLASS_PORT-8001}" volumes: - - ${HYPERGLASS_APP_PATH-/etc/hyperglass}:/etc/hyperglass + - ./data:/etc/hyperglass diff --git a/docs/pages/installation.mdx b/docs/pages/installation.mdx index 0eb736a4..8843b70b 100644 --- a/docs/pages/installation.mdx +++ b/docs/pages/installation.mdx @@ -2,6 +2,7 @@ import { Cards } from "nextra/components"; + diff --git a/docs/pages/installation/docker-ghcr.mdx b/docs/pages/installation/docker-ghcr.mdx new file mode 100644 index 00000000..22e65aa5 --- /dev/null +++ b/docs/pages/installation/docker-ghcr.mdx @@ -0,0 +1,49 @@ +--- +title: Using Docker +description: Installing hyperglass with Docker +--- + +import { Cards, Steps, Callout } from "nextra/components"; +// import { Callout } from "nextra-theme-docs"; + +**Docker is the recommended method for running hyperglass.** + + + +### Install Docker + + + + + +### Download hyperglass + +```shell copy +mkdir /home/hyperglass +cd /home/hyperglass +wget "https://github.com/thatmattlove/hyperglass/blob/main/compose.yaml" +``` + +### Optional: Quickstart + +Do this if you just want to see the hyperglass page working with a fake device. + +```shell copy +mkdir data +wget -O ./data/devices.yaml "https://raw.githubusercontent.com/thatmattlove/hyperglass/refs/heads/main/.samples/sample_devices.yaml" +docker compose up +``` + +Navigate to http://IPADDRESS:8001 + +### Enable auto-restart + +You may want to ensure that Hyperglass stays running even after a reboot. +To do this, you can easily change the "restart" parameter in `compose.yaml` to `always`. + +