Self-hosting Periscope with Docker Compose¶
Periscope is distributed as a public container image at
public.ecr.aws/x5l1y7s0/periscope.
These instructions run it with Docker Compose: first a quick look with the bundled sample inventory, then your own devices, then a production setup with Caddy as a TLS-terminating reverse proxy in front of it.
Quick start: the bundled sample inventory¶
To take a look at the interface without configuring anything, run the image directly. It boots serving a fictional sample inventory (RFC 5737 addresses — no device is reachable, but the whole UI works):
Then open http://localhost:4000 on the machine running the container. The
port is published on loopback only, and the bundled sample answers to
localhost only: a browser that reached it by any other hostname would see
the page with an inert interface. From another machine, tunnel first with
ssh -L 4000:127.0.0.1:4000 <docker-host> and open http://localhost:4000
there. For a deployment other people reach, set up
your own deployment with
server.host in its periscope.yaml and a
TLS-terminating reverse proxy
in front.
If a pull fails with toomanyrequests
Anonymous pulls from ECR Public are capped at 1 per second and 500 GB
per month. Both quotas belong to the puller rather than the repository,
so nothing on our side can raise them — and a multi-layer docker pull
can cross 1/sec on its own, more easily behind a campus NAT where many
users share one egress address. Authenticating with any AWS account
raises the rate to 10 per second, adjustable further from that account:
aws ecr-public get-login-password --region us-east-1 \
| docker login --username AWS --password-stdin public.ecr.aws
The login applies to every pull below as well.
Recommended resources¶
With the default settings, Periscope and Looking Glass together run comfortably on a single CPU and 1 GiB of memory.
Memory needs grow with how many Looking Glass executions run at once: each
one runs its own Python/Netmiko interpreter, and
looking_glass.max_concurrent_executions (default 10)
limits how many run together. If you raise that limit, add 60 MiB of
memory for each execution above the default.
Memory also grows slowly with use, because each browser session keeps a history of its recent command output. Give a busy, long-lived deployment headroom above 1 GiB.
Setting up your own deployment¶
Create a directory for the deployment and copy this compose.yaml into it:
services:
periscope:
image: public.ecr.aws/x5l1y7s0/periscope:${PERISCOPE_VERSION:-latest}
ports:
# Published on loopback only by default. Periscope serves plain HTTP
# and does not terminate TLS, so other hosts reach it through a
# TLS-terminating reverse proxy. Set PERISCOPE_BIND in `.env` only when
# that proxy cannot reach loopback, and set server.host in
# periscope.yaml — see the variable table below. PERISCOPE_PORT is the
# host port; the app listens on 4000 inside.
- "${PERISCOPE_BIND:-127.0.0.1}:${PERISCOPE_PORT:-4000}:4000"
environment:
# The mounted periscope.yaml below. The hostname, tuning, analytics, and
# UI settings live in that file — see
# https://docs.periscope.ns.internet2.edu/self-host/#settings
PERISCOPE_CONFIG_PATH: /etc/periscope/periscope.yaml
# Global SSH credentials for the devices in periscope.yaml. Optional at
# boot (an empty value counts as unset); command execution fails without
# them unless every device names its own variables via username_env/
# password_env — each variable named that way must also be passed here.
# Use a least-privileged service account — see
# https://docs.periscope.ns.internet2.edu/self-host/#device-service-account
DEVICE_USERNAME: ${DEVICE_USERNAME:-}
DEVICE_PASSWORD: ${DEVICE_PASSWORD:-}
# Optional: signs browser session cookies. When unset, a random key is
# generated at boot (with a logged warning) and sessions reset on every
# restart. Generate one with: openssl rand -base64 48
SECRET_KEY_BASE: ${SECRET_KEY_BASE:-}
volumes:
# Your periscope.yaml. `create_host_path: false` makes a missing
# ./periscope.yaml a clear Compose error instead of Docker silently
# creating a directory in its place and failing at boot.
- type: bind
source: ./periscope.yaml
target: /etc/periscope/periscope.yaml
read_only: true
bind:
create_host_path: false
restart: unless-stopped
healthcheck:
# python3 is already in the image (the diagnostic commands run under
# it), so the check adds no packages. urlopen raises on any non-2xx/3xx
# response, exiting non-zero and failing the check.
test:
[
"CMD",
"python3",
"-c",
"import urllib.request; urllib.request.urlopen('http://127.0.0.1:4000/health', timeout=5)",
]
interval: 30s
timeout: 10s
retries: 3
start_period: 15s
The latest tag moves with every release. To pin a version, set
PERISCOPE_VERSION in .env (see below) to a release tag from the
gallery page.
Write your periscope.yaml¶
periscope.yaml describes the deployment: the devices Periscope can run
diagnostics against, plus optional branding and settings. The image ships an
annotated template; extract it next to your compose.yaml (plain
docker run — a docker compose run would try to mount the periscope.yaml
that does not exist yet):
docker run --rm --entrypoint cat \
public.ecr.aws/x5l1y7s0/periscope:latest \
/app/periscope.yaml.example > periscope.yaml
Then edit it to describe your inventory. A minimal example:
# Human-facing name shown in the UI (navbar brand, browser-title suffix,
# splash page). Defaults to "Periscope" when omitted.
application_name: "Example Network Console"
# Optional: a URL for your documentation site, linked from the footer and
# the navigation menu. Omit it and neither shows a documentation link.
documentation_url: "https://docs.example.net/periscope"
# Optional: the hostname browsers use to reach the app. Defaults to
# localhost; set it to the real hostname when deploying beyond it.
# server:
# host: periscope.example.net
devices:
- id: "core1.example.net"
host: "192.0.2.10"
platform: "cisco_xr"
location: "Example City, ST"
type: "Core Router"
- id: "sw1.example.net"
host: "192.0.2.20"
platform: "arista_eos"
location: "Example City, ST"
type: "Switch"
# A device can name its own credential environment variables instead of
# the global DEVICE_USERNAME/DEVICE_PASSWORD. The value is the *name* of
# an environment variable, never the secret itself. Any variable named
# this way must also be passed into the container (add it under
# `environment:` in compose.yaml), and boot aborts if it is unset.
# Use a least-privileged service account — see
# https://docs.periscope.ns.internet2.edu/self-host/#device-service-account
- id: "core1.partner.net"
host: "192.0.2.30"
platform: "cisco_xr"
location: "Partner City, ST"
type: "Core Router"
username_env: "PARTNER_USERNAME"
password_env: "PARTNER_PASSWORD"
Every device needs id, host, platform (a Netmiko platform
string),
location, and type. Leave commands: and filters: out to inherit
Periscope's default command and filter sets, including improvements that
arrive with image upgrades; an explicit section replaces the corresponding
default set entirely. The file is validated at boot — unknown keys,
duplicate ids, or a platform not covered by any commands: entry (your
own, see Supporting other commands, filters, or vendor
devices, or the
built-in set used when commands: is omitted) aborts startup with an
error naming the offending entry. A platform with no filters: entry of
its own is not an error: boot logs a warning and the UI offers no output
filter for devices on that platform until you add one. Boot validation
only checks that devices and commands agree with each other, not that
the string names a real Netmiko platform: a misspelled or invalid
platform passes validation, and every run against that device then
fails until the string is corrected.
Settings¶
Every setting is optional and has a default. Numbers are unquoted integers,
and booleans are unquoted true or false. Omit a section rather than
leaving its header empty: server: or analytics: with nothing under it
stops Periscope at boot. So does posthog_api_key: ""; a bare
posthog_api_key: with no value is allowed and leaves analytics off.
| Key | Default | Purpose |
|---|---|---|
server.host |
localhost |
The hostname browsers reach the app through: a bare hostname or IP address, with no scheme, port, or path. WebSocket connections from any other origin are rejected, so a wrong value renders the UI but leaves it dead. Set it whenever you serve beyond localhost. The app warns at boot if a custom periscope.yaml leaves it at localhost. |
server.trust_proxy_headers |
false |
Whether the per-IP rate limit on the REST API and MCP endpoint takes the client IP from the X-Forwarded-For header. Set it true only when every request arrives through a reverse proxy that replaces that header, such as the Caddy setup. Leave it false when Periscope is reached directly, or behind a proxy that appends to the header, such as AWS ALB or nginx with $proxy_add_x_forwarded_for: there, true lets clients spoof their IP. |
ui_enabled |
true |
Set false to disable the web UI and serve only the health check, REST API, and MCP endpoint. |
looking_glass.read_timeout |
30 |
Seconds to wait for a device's command output (1 to 3600). |
looking_glass.max_concurrent_executions |
10 |
Device executions allowed to run at once across all requests (1 to 100). Each execution runs its own Python/Netmiko interpreter, so this bounds worst-case memory — see Recommended resources before raising it. |
looking_glass.gate_wait_timeout |
5 |
Seconds an execution waits for a free slot before it is rejected as busy (1 to 60). Size it against how long a typical command takes, not against read_timeout. |
mcp.server_timeout |
180 |
Seconds before the MCP transport gives up on a request. Keep it above the per-device ceiling (gate_wait_timeout + read_timeout + about 45 seconds to connect and log in), or slow devices time out at the transport before their error reaches the client. The app warns at boot if it does not. |
analytics.posthog_api_key |
none | A PostHog project API key. Analytics are off unless it is set. |
For example, a deployment at a real hostname that allows more concurrent executions:
Periscope reads these settings only from periscope.yaml. Upgrading from a
release before 0.3.0? See Upgrading.
Default commands and filters¶
Periscope is built with support for cisco_xr and arista_eos devices and inherits these commands: and filters: when its periscope.yaml omits those sections the sets shipped in image tag 0.1.0. Later image versions can add to these; check priv/default_commands.yaml and priv/default_filters.yaml inside a given image tag for what it actually ships:
docker run --rm --entrypoint sh public.ecr.aws/x5l1y7s0/periscope:<tag> \
-c 'cat lib/periscope-*/priv/default_commands.yaml \
lib/periscope-*/priv/default_filters.yaml'
Default commands: and filters:
Commands:
| Command | Description |
|---|---|
ping |
Ping from router to supplied destination |
traceroute |
Traceroute from router to supplied destination |
show bfd |
Show bfd information |
show bgp |
Show BGP info |
show cef |
Show Cisco Express Forwarding |
show controllers |
Show controller stats |
show interfaces |
Show interface stats |
show ipv4 interface |
IPv4 interface status and configuration |
show ipv6 interface |
IPv6 interface status and configuration |
show isis |
Show IS-IS routing information |
show l2vpn xconnect |
L2VPN xconnect information |
show l2vpn bridge-domain group |
L2VPN bridge domain (VPLS) information |
show lacp |
LACP information |
show lldp neighbors |
LLDP neighbors |
show policy-map interface |
QoS service policy applied to an interface |
show qos interface |
QoS interface-level configuration |
show route |
IP routing table |
show version |
Show router firmware version |
show vrf all |
Show VRF information |
Filters:
| Filter | Hidden alias of | Notes |
|---|---|---|
include |
— | Keep only matching lines |
inc |
include |
Short alias, accepted but not listed in the UI |
i |
include |
Short alias, accepted but not listed in the UI |
exclude |
— | Drop matching lines |
exc |
exclude |
Short alias, accepted but not listed in the UI |
e |
exclude |
Short alias, accepted but not listed in the UI |
Commands:
| Command | Description |
|---|---|
ping |
Ping from router to supplied destination |
traceroute |
Traceroute from router to supplied destination |
show bfd |
Show bfd information |
show bgp |
Show BGP info |
show interfaces |
Show interface stats |
show isis |
Show IS-IS routing information |
show lacp |
LACP information |
show lldp neighbors |
LLDP neighbors |
show policy-map interface |
QoS service policy applied to an interface |
show qos interface |
QoS interface-level configuration |
show route |
IP routing table |
show version |
Show router firmware version |
show vrf all |
Show VRF information |
show vxlan |
Show VXLAN information |
Filters:
| Filter | Notes |
|---|---|
include |
Keep only matching lines |
exclude |
Drop matching lines |
Supporting other commands:, filters: or vendor devices¶
Periscope's built-in command set is written for cisco_xr and arista_eos and devices on
those platforms work with no commands: section at all, as in the minimal
example above. Any other Netmiko platform, Juniper Junos, Nokia SR OS,
MikroTik RouterOS, and so on has a different CLI syntax and needs its own
commands: entries naming the platform explicitly before Periscope can run
anything against it.
commands: is defined once at the top level of periscope.yaml, not
per-device, so adding it replaces the entire built-in command set for
every device in the file including cisco_xr and arista_eos devices
that worked without in the minimal example. Once any device needs a custom entry,
every platform in the inventory needs its commands written out explicitly;
there's no partial override.
Multi vendor example: periscope.yaml with Cisco, Arista, Juniper, Nokia, and MikroTik devices
devices:
- id: "core1.example.net"
host: "192.0.2.10"
platform: "cisco_xr"
location: "Example City, ST"
type: "Core Router"
- id: "sw1.example.net"
host: "192.0.2.20"
platform: "arista_eos"
location: "Example City, ST"
type: "Switch"
- id: "core2.example.net"
host: "192.0.2.11"
platform: "juniper_junos"
location: "Example City, ST"
type: "Core Router"
- id: "core3.example.net"
host: "192.0.2.12"
platform: "nokia_sros"
location: "Example City, ST"
type: "Core Router"
- id: "mikrotik.example.net"
host: "192.168.0.1"
platform: "mikrotik_routeros"
location: "City, ST"
type: "Edge Router"
commands:
# --- Cisco IOS XR (cisco_xr) ---
- name: "ping"
help: "Ping from router to supplied destination"
platforms: ["cisco_xr"]
- name: "traceroute"
help: "Traceroute from router to supplied destination"
platforms: ["cisco_xr"]
- name: "show route ipv4"
help: "IPv4 routing table"
platforms: ["cisco_xr"]
- name: "show route ipv6"
help: "IPv6 routing table"
platforms: ["cisco_xr"]
- name: "show interfaces brief"
help: "Interface status"
platforms: ["cisco_xr"]
- name: "show version"
help: "System resource usage and IOS XR version"
platforms: ["cisco_xr"]
# --- Arista EOS (arista_eos) ---
- name: "ping"
help: "Ping from switch to supplied destination"
platforms: ["arista_eos"]
- name: "traceroute"
help: "Traceroute from switch to supplied destination"
platforms: ["arista_eos"]
- name: "show ip route"
help: "IPv4 routing table"
platforms: ["arista_eos"]
- name: "show ipv6 route"
help: "IPv6 routing table"
platforms: ["arista_eos"]
- name: "show interfaces status"
help: "Interface status"
platforms: ["arista_eos"]
- name: "show version"
help: "System resource usage and EOS version"
platforms: ["arista_eos"]
# --- Juniper Junos (juniper_junos) ---
- name: "ping count 4"
help: "Ping from router to supplied destination"
platforms: ["juniper_junos"]
- name: "traceroute"
help: "Traceroute from router to supplied destination"
platforms: ["juniper_junos"]
- name: "show route"
help: "IPv4 routing table"
platforms: ["juniper_junos"]
- name: "show route table inet6.0"
help: "IPv6 routing table"
platforms: ["juniper_junos"]
- name: "show interfaces terse"
help: "Interface status and configured addresses"
platforms: ["juniper_junos"]
- name: "show version"
help: "System resource usage and Junos version"
platforms: ["juniper_junos"]
# --- Nokia SR OS (nokia_sros) ---
- name: "ping"
help: "Ping from router to supplied destination"
platforms: ["nokia_sros"]
- name: "traceroute"
help: "Traceroute from router to supplied destination"
platforms: ["nokia_sros"]
- name: "show router route-table"
help: "IPv4 routing table"
platforms: ["nokia_sros"]
- name: "show router route-table ipv6"
help: "IPv6 routing table"
platforms: ["nokia_sros"]
- name: "show port"
help: "Interface status"
platforms: ["nokia_sros"]
- name: "show router interface"
help: "IPv4 addresses configured on interfaces"
platforms: ["nokia_sros"]
- name: "show system information"
help: "System resource usage and SR OS version"
platforms: ["nokia_sros"]
# --- MikroTik RouterOS (mikrotik_routeros) ---
- name: "/tool/ping count=4"
help: "Ping from router to supplied destination"
platforms: ["mikrotik_routeros"]
- name: "/tool/traceroute count=1"
help: "Traceroute from router to supplied destination"
platforms: ["mikrotik_routeros"]
- name: "/ip route print"
help: "IPv4 routing table"
platforms: ["mikrotik_routeros"]
- name: "/ipv6 route print"
help: "IPv6 routing table"
platforms: ["mikrotik_routeros"]
- name: "/interface print"
help: "Interface status"
platforms: ["mikrotik_routeros"]
- name: "/ip address print"
help: "IPv4 addresses configured on interfaces"
platforms: ["mikrotik_routeros"]
- name: "/system resource print"
help: "System resource usage and RouterOS version"
platforms: ["mikrotik_routeros"]
Tip
Drop any one of those five platforms blocks and devices on that platform fail boot validation — commands: only replaces what it names; it does not fall back to the built-in set for the platforms it leaves out, so the dropped platform is covered by no entry at all.
Device service account¶
The credentials Periscope uses to SSH into devices
(DEVICE_USERNAME/DEVICE_PASSWORD, or a per-device
username_env/password_env pair) should be provisioned as a dedicated,
non-personal service account scoped to the minimum access required to run
diagnostic commands — never a shared admin or personal engineer login.
Grant the account only the permissions needed to open an SSH session and
run the commands in your commands: set. With the
defaults, that means the show commands
plus ping and traceroute. Vendor read-only presets can leave out those
two or grant more than needed. If you replace commands: with your own set,
keep it to commands that inspect state or run diagnostics, never ones that
change configuration, so the account can stay narrow.
This is defense in depth rather than the only control. The commands: set
bounds what anyone using the interface can run, but anyone who can edit
periscope.yaml can change that set, and after the next restart Periscope
runs whatever it lists. Anyone who can read the .env file or the host's
environment holds the credentials and can skip Periscope entirely. In both
cases the device account's permissions are the one limit that still holds.
Device SSH server requirements¶
Periscope's SSH client (Paramiko 5) negotiates only SHA-2 algorithms. The device's SSH server must advertise at least one of each:
- Host-key signature:
rsa-sha2-256,rsa-sha2-512,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521, orssh-ed25519. The key type is not the issue: an RSA host key works as long as the device advertisesrsa-sha2-256orrsa-sha2-512for it. A device that advertises onlyssh-rsa(SHA-1) is rejected. - Key exchange:
curve25519-sha256@libssh.org, anecdh-sha2-nistp*curve,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512, ordiffie-hellman-group-exchange-sha256with a modulus of 2048 bits or more. The plaincurve25519-sha256name does not count, and the SHA-1 groups (group1-sha1,group14-sha1,group-exchange-sha1) are rejected. When the image's cryptography library exposes ML-KEM, Paramiko also offers and prefersmlkem768x25519-sha256.
A device that offers only SHA-1 algorithms fails every run. The connection
error Periscope shows for the device contains Incompatible ssh peer (no
acceptable host key) or Incompatible ssh peer (no acceptable kex
algorithm), and no periscope.yaml setting re-enables them. To see what a
device offers, run ssh -vv <device> from any workstation and read the
peer server KEXINIT proposal block in the output.
Customize the navigation menu¶
The menu button at the top left of every page opens Periscope's navigation
menu. Out of the box it lists Periscope's own pages, Home and Looking Glass,
followed by a Documentation item when documentation_url is set. The
template you extracted already has a navigation: section listing Home and
Looking Glass. Edit that block to add your own items, such as links to the
other tools your operators use, or delete it to keep the default menu. For
example, this adds two external tools after Periscope's own pages:
navigation:
- name: "Home"
link: "/"
- name: "Looking Glass"
description: "Run commands on network devices"
link: "/looking-glass"
- name: "Grafana"
description: "View statistics"
link: "https://grafana.example.net"
- name: "Network Operations Center"
description: "Service requests, ops calendar"
link: "https://noc.example.net"
Items appear in the order you list them. Each one has:
| Field | Required? | Purpose |
|---|---|---|
name |
Yes | The item's label. |
description |
No | A one-line subtitle shown under the name. |
link |
Yes | Where the item goes: a path within Periscope, or a full http:// or https:// URL. |
A path such as /looking-glass opens in the same tab. The menu highlights the
Home and Looking Glass entries while you are on those pages. A full URL opens
in a new tab and is marked with an external-link icon.
The section replaces the whole default menu rather than adding to it. That is why the example lists Home and Looking Glass: leave them out and the menu no longer shows them. Delete the section to go back to the default menu.
The Documentation item¶
When documentation_url is set, Periscope adds a Documentation item for it to
the end of the menu, with or without a navigation: section. It points at the
same URL as the footer's documentation link. To choose where the item appears,
or to give it a different name or description, list an entry with exactly the
same link yourself; Periscope then adds nothing extra. For a URL, a trailing
slash counts: https://docs.example.net/periscope/ does not match
https://docs.example.net/periscope.
documentation_url: "https://docs.example.net/periscope"
navigation:
- name: "Help"
description: "Guides for this console"
link: "https://docs.example.net/periscope"
- name: "Home"
link: "/"
- name: "Looking Glass"
link: "/looking-glass"
Validation¶
Periscope checks the section at boot and aborts startup with an error naming the offending entry when:
- a
linkis neither a path starting with/nor a fullhttp://orhttps://URL.grafana.example.net,//grafana.example.net, andjavascript:links are all turned away. Percent-encode spaces and non-ASCII characters. - two entries share a
name, compared ignoring case. - two entries share a
link. A path with and without a trailing slash counts as the same link. - a
nameordescriptionis present but blank. Leavedescriptionout instead of writing it empty. - an entry has a key other than
name,description, andlink. - the section is present but empty. Delete it instead to keep the default menu.
Periscope reads periscope.yaml only at boot, so restart the container after
editing the menu:
Set the environment variables¶
The compose.yaml above reads its variables from a .env file in the same
directory (Docker Compose loads it automatically). Create one:
# .env — next to compose.yaml. Keep it out of version control.
# Use a least-privileged service account — see
# https://docs.periscope.ns.internet2.edu/self-host/#device-service-account
DEVICE_USERNAME=lookingglass
DEVICE_PASSWORD=change-me
SECRET_KEY_BASE=<output of: openssl rand -base64 48>
# PERISCOPE_VERSION=1.2.3
# PERISCOPE_BIND=127.0.0.1
# PERISCOPE_PORT=4000
What each variable does:
| Variable | Required? | Purpose |
|---|---|---|
DEVICE_USERNAME / DEVICE_PASSWORD |
Yes, to run commands | Global SSH credentials for the devices in periscope.yaml. Optional at boot (an empty value counts as unset), but command execution fails without them unless every device names its own variables via username_env/password_env. Use a least-privileged service account. |
SECRET_KEY_BASE |
Recommended | Signs browser session cookies. When unset, a random key is generated at each boot (with a logged warning) and sessions reset on every restart. Generate one with openssl rand -base64 48. |
PERISCOPE_VERSION |
No | Image tag to run; defaults to latest. Pin a release tag for reproducible deploys. |
PERISCOPE_BIND |
No | Host address to publish the port on; defaults to 127.0.0.1, so only the Docker host can connect. Periscope serves plain HTTP and does not terminate TLS, so put a TLS-terminating reverse proxy in front of it. Change this only when that proxy cannot reach loopback — see the note below. |
PERISCOPE_PORT |
No | Host port to publish; defaults to 4000. |
When the reverse proxy cannot reach loopback
A proxy container on this host belongs on the Compose network, as in the
Caddy example, and needs no published port at all. For a proxy on another
machine, set PERISCOPE_BIND to this host's address on a private network
the proxy shares, and set server.host to the hostname
browsers use. In the host firewall, allow the published port from the
proxy's address and block it from everything else. Docker routes
published ports around common host firewalls — ufw INPUT rules never
see them — so write the rules the way Docker's
Restrict external connections to containers
guide shows, including its rule for established connections, which
Periscope's SSH sessions to devices need. To limit a rule to Periscope,
match container port 4000, not PERISCOPE_PORT: the rules run
after Docker rewrites the destination.
PERISCOPE_BIND is a single address and publishes one
address family; for a proxy that reaches this host over IPv6, use the
host's IPv6 address.
Any per-device credential variables your periscope.yaml names via
username_env/password_env (like PARTNER_USERNAME above) must also be
added to the .env file and passed through in the environment: block of
compose.yaml — Compose does not forward host variables into a container
unless they are listed there.
Then start it:
With the default PERISCOPE_BIND, open http://localhost:4000 (or the port
you configured) on the Docker host. From another machine, tunnel first with
ssh -L 4000:127.0.0.1:4000 <docker-host> and open http://localhost:4000
there; the default server.host of localhost works through the tunnel. The
second 4000 in the -L argument is PERISCOPE_PORT. If you moved
PERISCOPE_BIND for a proxy on another machine, reach Periscope through that
proxy. For a deployment other people reach, continue to the
Caddy section. Logs
are available with docker compose logs -f periscope; the first log line names
the configuration file the app loaded, which is the first thing to check if
you see the fictional sample inventory instead of your own.
Production: Caddy as a TLS-terminating reverse proxy¶
Periscope is designed to be reachable publicly, but it serves plain HTTP and
does not terminate TLS. Periscope has no login: anyone who can reach it can run
your commands: set through the web UI, the REST API, or the MCP server; the
device service account bounds what those commands
do. For a deployment reachable at a real hostname, put
Caddy in front of Periscope. Caddy obtains and
renews Let's Encrypt certificates automatically and proxies both HTTP and the
LiveView WebSocket with no extra configuration.
compose.yaml:
services:
periscope:
image: public.ecr.aws/x5l1y7s0/periscope:${PERISCOPE_VERSION:-latest}
# No `ports:` block — only Caddy is reachable from outside; it talks to
# Periscope over the Compose network on port 4000.
environment:
PERISCOPE_CONFIG_PATH: /etc/periscope/periscope.yaml
DEVICE_USERNAME: ${DEVICE_USERNAME:-}
DEVICE_PASSWORD: ${DEVICE_PASSWORD:-}
SECRET_KEY_BASE: ${SECRET_KEY_BASE:-}
volumes:
# server.host in periscope.yaml must match the Caddyfile's site address.
- type: bind
source: ./periscope.yaml
target: /etc/periscope/periscope.yaml
read_only: true
bind:
create_host_path: false
restart: unless-stopped
healthcheck:
test:
[
"CMD",
"python3",
"-c",
"import urllib.request; urllib.request.urlopen('http://127.0.0.1:4000/health', timeout=5)",
]
interval: 30s
timeout: 10s
retries: 3
start_period: 15s
caddy:
image: caddy:2
ports:
- "80:80"
- "443:443"
# HTTP/3
- "443:443/udp"
environment:
PERISCOPE_HOST: ${PERISCOPE_HOST:?set PERISCOPE_HOST to the public hostname}
volumes:
- type: bind
source: ./Caddyfile
target: /etc/caddy/Caddyfile
read_only: true
bind:
create_host_path: false
# Certificates and ACME account state — must persist across restarts,
# or Caddy re-requests certificates and can hit Let's Encrypt rate
# limits.
- caddy_data:/data
- caddy_config:/config
restart: unless-stopped
depends_on:
periscope:
condition: service_healthy
volumes:
caddy_data:
caddy_config:
Caddyfile, next to it:
That is the whole proxy configuration. Caddy fills in the rest: it redirects
HTTP to HTTPS, provisions a certificate for the hostname, and upgrades
WebSocket connections transparently. Browsers connect through it with an
Origin of https://<PERISCOPE_HOST>, which is what Periscope's WebSocket
origin check expects once server.host names the same hostname.
Set the public hostname in two places. PERISCOPE_HOST in .env gives
Caddy its site address, and server.host in periscope.yaml
gives Periscope its origin check. Keep them identical: on a mismatch pages
render, but the UI stays dead.
Also set server.trust_proxy_headers to true. With no
trusted_proxies in the Caddyfile, Caddy replaces any X-Forwarded-For a
client sends. Periscope publishes no ports, so every request arrives through
Caddy, and the per-IP rate limiter can key on each IPv4 client. Without
the setting, every client shares one bucket keyed on Caddy's address.
# .env
PERISCOPE_HOST=periscope.example.net
DEVICE_USERNAME=lookingglass
DEVICE_PASSWORD=change-me
SECRET_KEY_BASE=<output of: openssl rand -base64 48>
Requirements before docker compose up -d:
- DNS for the hostname points at this machine.
- Ports 80 and 443 are open and not held by another web server (Caddy needs 80 for the ACME HTTP challenge and the HTTPS redirect).
Then browse to https://periscope.example.net. Certificate issuance happens on the
first request and takes a few seconds; docker compose logs -f caddy shows
its progress.
Upgrading¶
To move to a new release, set PERISCOPE_VERSION in .env to its tag (or, on
latest, run docker compose pull), then run docker compose up -d. Most
releases need nothing more. Before you upgrade, check
Upgrading for the releases that also need changes to your
deployment.