Sign inSign up

stanhu86/derper

By stanhu86

•Updated about 1 month ago

Self-hosted tailscale derper based on alpine docker image

Image
Networking
Web servers
0

292

stanhu86/derper repository overview

⁠Usage

derp:
  image: stanhu86/derper:latest
  container_name: derp
  restart: unless-stopped
  user: "${UID_GID}"
  ports:
    - "3478:3478/udp"
    - "443:443"
    - "80:80"
  volumes:
    - ./derp/certs:/app/certs
  environment:
    - DERP_CONFIG=/app/certs/derper.key
    - DERP_DOMAIN=your-domain.com

⁠Environment Variables

envrequireddescriptiondefault value
DERP_CONFIGfalsederp config file/var/lib/derper/derper.key
DERP_DOMAINtruederper server hostnameyour-hostname.com
DERP_CERT_DIRfalsedirectory to store LetsEncrypt certs(if addr's port is :443)/app/certs
DERP_CERT_MODEfalsemode for getting a cert. possible options: manual, letsencryptletsencrypt
DERP_ADDRfalselistening server address:443
DERP_STUNfalsealso run a STUN servertrue
DERP_STUN_PORTfalseThe UDP port on which to serve STUN.3478
DERP_HTTP_PORTfalseThe port on which to serve HTTP. Set to -1 to disable80
DERP_VERIFY_CLIENTSfalseverify clients to this DERP server through a local tailscaled instancefalse
DERP_VERIFY_CLIENT_URLfalseif non-empty, an admission controller URL for permitting client connections""

⁠Dockerfile

ARG GOLANG_VERSION=1.25
ARG ALPINE_VERSION=3.22

FROM golang:${GOLANG_VERSION}-alpine${ALPINE_VERSION} AS builder
WORKDIR /go/src

ARG DERP_VERSION=v1.88.2

RUN go install -ldflags "-w -s" -trimpath tailscale.com/cmd/derper@${DERP_VERSION}


FROM alpine:${ALPINE_VERSION}
WORKDIR /app

RUN set -eux; \
    apk add --update --no-cache ca-certificates tini; \
    apk del openssl apk-tools; \
    mkdir /app/certs

ENV DERP_CONFIG /var/lib/derper/derper.key
ENV DERP_DOMAIN your-domain.com
ENV DERP_CERT_MODE letsencrypt
ENV DERP_CERT_DIR /app/certs
ENV DERP_ADDR :443
ENV DERP_STUN true
ENV DERP_STUN_PORT 3478
ENV DERP_HTTP_PORT 80
ENV DERP_VERIFY_CLIENTS false
ENV DERP_VERIFY_CLIENT_URL ""

COPY --from=builder /go/bin/derper .
ENTRYPOINT [ "/sbin/tini", "--" ]
CMD /app/derper \
-c ${DERP_CONFIG} \
--hostname=${DERP_DOMAIN} \
--certmode=${DERP_CERT_MODE} \
--certdir=${DERP_CERT_DIR} \
--a=${DERP_ADDR} \
--stun=${DERP_STUN} \
--stun-port=${DERP_STUN_PORT} \
--http-port=${DERP_HTTP_PORT} \
--verify-clients=${DERP_VERIFY_CLIENTS} \
--verify-client-url=${DERP_VERIFY_CLIENT_URL}

Tag summary

Content type

Image

Digest

sha256:40fdb9270…

Size

10.1 MB

Last updated

about 1 month ago

docker pull stanhu86/derper