diff --git a/client/Dockerfile b/client/Dockerfile new file mode 100644 index 0000000..016e2fe --- /dev/null +++ b/client/Dockerfile @@ -0,0 +1,19 @@ +FROM ubuntu + +# Install dependencies +RUN apt-get update && apt-get install -y nginx certbot python3-certbot-nginx + +# Contains the final certificates created by certbot +VOLUME /etc/letsencrypt + +# Application configuration for our site +COPY nginx/quic.video.conf /etc/nginx/conf.d/quic.video.conf + +# The script to init and run nginx +COPY nginx/run.sh /run/warp-client + +# Copy over the web contents +COPY dist/* /var/www/quic.video + +# Run the shell script +CMD /run/warp-client diff --git a/client/nginx/quic.video.conf b/client/nginx/quic.video.conf new file mode 100644 index 0000000..01f7b3f --- /dev/null +++ b/client/nginx/quic.video.conf @@ -0,0 +1,6 @@ +server { + listen 80; + listen [::]:80; + server_name quic.video; + root /var/www/quic.video; +} diff --git a/client/nginx/run.sh b/client/nginx/run.sh new file mode 100755 index 0000000..d7bdae7 --- /dev/null +++ b/client/nginx/run.sh @@ -0,0 +1,9 @@ +#!/bin/bash +set -euxo pipefail + +# Try to generate a certificate that expires in 90 days. +# This will listen on port 80 and serve a challenge file, proving we own the domain. +certbot --nginx --email kixelated@gmail.com -d quic.video --agree-tos + +# The certbot nginx plugin will automatically append the certs to the configuration. +nginx diff --git a/client/package.json b/client/package.json index 59e63dd..2feada3 100644 --- a/client/package.json +++ b/client/package.json @@ -2,6 +2,7 @@ "source": "src/index.html", "scripts": { "serve": "parcel serve --https --host localhost.warp.demo --port 4444", + "prebuild": "rm -rf dist", "build": "parcel build", "check": "tsc --noEmit" }, diff --git a/server/Dockerfile b/server/Dockerfile new file mode 100644 index 0000000..f56f064 --- /dev/null +++ b/server/Dockerfile @@ -0,0 +1,36 @@ +# build image # +FROM golang:1.18 AS build + +WORKDIR /src + +# Don't use the Go proxy because it's blocked on my laptop (lul) +ENV GOPRIVATE=* + +# Copy over the files. +COPY . . + +# Run the unit tests. +RUN go test -race ./... + +# Run go vet +RUN go vet ./... + +# Make sure go fmt was run. +# If this fails, you should configure your editor to run `gofmt` on save. +RUN test -z $(go fmt ./...) + +# Install the binary. +RUN go install -v ./warp-server + +# Final image +FROM ubuntu:22.04 + +# Install root certs for HTTPS +RUN apt-get update && \ + apt-get install -y --no-install-recommends ca-certificates + +# Copy the binary from the build image +COPY --from=build /go/bin /usr/local/bin + +# Copy over our pre-encoded media. +COPY media /media diff --git a/server/internal/warp/session.go b/server/internal/warp/session.go index 3458672..eb08a4c 100644 --- a/server/internal/warp/session.go +++ b/server/internal/warp/session.go @@ -116,7 +116,7 @@ func (s *Session) handleStream(ctx context.Context, stream *webtransport.Receive } if msg.Throttle != nil { - s.setThrottle(msg.Throttle) + //s.setThrottle(msg.Throttle) } } }