From f3478e6afb9226d2d1f8cde2e3ebcece616e0531 Mon Sep 17 00:00:00 2001 From: abawi Date: Fri, 25 Apr 2025 00:10:47 +0200 Subject: [PATCH] Added deployment details --- README.md | 28 +++++++++++++++++++++++----- docker-compose.yml | 2 +- package.json | 3 +++ src/components/Footer.tsx | 8 ++++++++ src/components/SharedLinkField.tsx | 2 +- 5 files changed, 36 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index ca7c9aa..7562a47 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,12 @@ -XKCD 949 FilePizza wordmark

Peer-to-peer file transfers in your browser

+XKCD 949 FilePizza wordmark

Peer-to-peer file transfers in your browser *deployed with Cloudflare*

*Cooked up by [Alex Kern](https://kern.io) & [Neeraj Baid](https://github.com/neerajbaid) while eating Sliver @ UC Berkeley.* +*Made deployable by [Fares Abawi](https://abawi.me) using Cloudflare Tunnel.* + Using [WebRTC](http://www.webrtc.org), FilePizza eliminates the initial upload step required by other web-based file sharing services. Because data is never stored in an intermediary server, the transfer is fast, private, and secure. -A hosted instance of FilePizza is available at [file.pizza](https://file.pizza). +A hosted instance of the Cloudflare deployed FilePizza is available at [filepizza.emaily.re](https://filepizza.emaily.re). ## What's new with FilePizza v2 @@ -30,11 +32,27 @@ $ pnpm start ## Running with Docker ``` -$ pnpm docker:build -$ pnpm docker:up -$ pnpm docker:down +$ pnpm docker:local:build +$ pnpm docker:local:up +$ pnpm docker:local:down ``` +## Deployment with Cloudflare Tunnel + +1. Create a Cloudflare account and add your domain. +2. Get the Global API token from Cloudflare. +3. Copy the envfile to `.env` and fill in the required values including the `CLOUDFLARE_API_KEY` and `HOST_DOMAIN` (the link to your cloudflared domain or sub-domain). +4. Run the following command to build the docker file: + ```bash + pnpm run docker:build + ``` +5. Run the following command to start the cloudflare deployment: + ```bash + pnpm run deploy:full + ``` +6. On the first usage, you will be directed to the Cloudflare login page. After logging in, you will have to authorize the domain you specified in the `.env` file `HOST_DOMAIN`. +7. After the authorization, you will be redirected to the FilePizza app. You can now use the app with your custom domain. + ## Stack * Next.js diff --git a/docker-compose.yml b/docker-compose.yml index 01c96aa..c04d3e9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -30,7 +30,7 @@ services: environment: - PORT=8080 - REDIS_URL=redis://redis:6379 - - API_ORIGINS=https://example.com,https://app.example.com:3000,http://localhost:8081 + - API_ORIGINS=http://localhost:8081 networks: - filepizza depends_on: diff --git a/package.json b/package.json index a2696dd..fc6bed7 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,9 @@ "start:peerjs": "./bin/peerjs.js", "lint:check": "eslint 'src/**/*.ts[x]'", "lint:fix": "eslint 'src/**/*.ts[x]' --fix", + "docker:local:build": "docker compose -f docker-compose.yml build", + "docker:local:up": "docker compose -f docker-compose.yml up -d", + "docker:local:down": "docker compose -f docker-compose.yml down", "docker:build": "docker compose -f docker-compose.texlyre.yml build", "docker:up": "docker compose -f docker-compose.texlyre.yml up -d", "docker:down": "docker compose -f docker-compose.texlyre.yml down", diff --git a/src/components/Footer.tsx b/src/components/Footer.tsx index bd5e723..ab3ebe2 100644 --- a/src/components/Footer.tsx +++ b/src/components/Footer.tsx @@ -61,6 +61,14 @@ export function Footer(): JSX.Element { Fork us

+

+ Made deployable with Cloudflare by{' '} + Fares Abawi{' '} + ·{' '} + + Cloudflare fork + +

diff --git a/src/components/SharedLinkField.tsx b/src/components/SharedLinkField.tsx index 2fc3ca0..9ddb576 100644 --- a/src/components/SharedLinkField.tsx +++ b/src/components/SharedLinkField.tsx @@ -32,7 +32,7 @@ export default function SharedLinkField({ onChange={handleChange} />

- You can paste either a full URL or just the slug. When shared, multiple uploaders can provide the same files, making downloads more reliable. + You can paste either a full URL or just the slug. When shared, multiple uploaders can provide the same files, making download links easily accessible.

)