diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index c948c3f..76d9e06 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -26,6 +26,15 @@ jobs: - name: release registry run: heroku container:release -a ttlsh web + - name: build nginx + run: docker build -t registry.heroku.com/ttlsh/nginx nginx + + - name: push nginx + run: docker push registry.heroku.com/ttlsh/nginx + + - name: release nginx + run: heroku container:release -a ttlsh nginx + - name: build hooks run: docker build -f hooks/Dockerfile.hooks -t registry.heroku.com/ttlsh-hooks/web hooks diff --git a/nginx/Dockerfile b/nginx/Dockerfile new file mode 100644 index 0000000..ec14da8 --- /dev/null +++ b/nginx/Dockerfile @@ -0,0 +1,7 @@ +FROM nginx:latest + +COPY nginx.conf /etc/nginx/nginx.conf + +COPY src/favicon.ico /usr/share/nginx/html/ +COPY src/index.htm /usr/share/nginx/html/ +COPY src/ttlsh_files /usr/share/nginx/html/ttlsh_files/ diff --git a/nginx/nginx.conf b/nginx/nginx.conf new file mode 100644 index 0000000..4eb1a72 --- /dev/null +++ b/nginx/nginx.conf @@ -0,0 +1,23 @@ +events {} +http { + server { + listen 80; + server_name staging.ttl.sh; + + location /v2 { + client_max_body_size 10000m; + + proxy_pass https://ttl.sh; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_request_buffering off; + } + + location / { + root /usr/share/nginx/html; + index index.htm; + } + } +} \ No newline at end of file diff --git a/nginx/src/favicon.ico b/nginx/src/favicon.ico new file mode 100644 index 0000000..98aa9a8 Binary files /dev/null and b/nginx/src/favicon.ico differ diff --git a/nginx/src/index.htm b/nginx/src/index.htm new file mode 100644 index 0000000..05fd3d2 --- /dev/null +++ b/nginx/src/index.htm @@ -0,0 +1,201 @@ + + +
+
+
+
+
+ $ IMAGE_NAME=$(uuidgen)
+
+
+ $ docker build -t ttl.sh/${IMAGE_NAME}:1h .
+
+
+ $ docker push ttl.sh/${IMAGE_NAME}:1h
+
+
+
+
+
+ ................................................
+
+
+ image ttl.sh/xxxx-yyyy-nnnn-2a2222-4b44 is available for 1 hour
+
+
+ ttl.sh is contributed by Replicated (www.replicated.com)
+
+
+
+
+ 1. Tag your image with ttl.sh, a UUID, & time limit (i.e. :2h)
+2. Push your image
+3. Pull your image (before it expires)
+No login required. Image names provide the initial secrecy for access. Add a UUID to your image name to reduce discoverability.
+Image tags provide the time limit. The default is 24 hours, and the max is 24 hours (valid time tags :5m, :1600s, :4h, :1d)
+Pulling images is really quick, so it just works thanks to Cloudflare. Even if you aren't near us-east-1.
+Many workflows in CI will build an image, and then subsequent steps will test that image in parallel. Docker registries are a commonly used storage mechanism for these intermediate build artifacts. One build step can push an image, and other distributed steps can pull. The challenge is that most registries require authentication to push and pull. A workflow can either bake credentials in and share them to build workers, or require forked builds to bring their own registry credentials. The first is insecure, the second creates friction for new contributors.
+ttl.sh solves this by making an ephemeral and anonymous registry.
+