docs/content/2.proxy/1.deploy.md

67 lines
5.1 KiB
Markdown
Raw Normal View History

2023-12-12 18:36:07 +00:00
---
title: 'Deploy'
---
2023-12-31 14:39:55 +00:00
2023-12-12 18:25:35 +00:00
# Deploying the proxy
## Method 1 - Cloudflare (Easy)
2023-12-12 18:25:35 +00:00
Cloudflare has a generous free plan, so you don't need to pay anything unless you get hundreds of users.
2023-12-12 18:25:35 +00:00
2023-12-31 14:39:55 +00:00
[![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/movie-web/simple-proxy){target="\_blank"}
2023-12-12 18:25:35 +00:00
1. Create a GitHub account at https://github.com if you don't have one.
1. Click the `Deploy with workers` button above.
1. Click the `Authorize Workers` button to authorise Cloudflare to talk to GitHub.
1. Authorize Cloudflare Workers in the GitHub page that pops up.
1. Follow the instructions to configure your Cloudflare account. Select `I have an account` if you have a Cloudflare account already, otherwise follow the link to create one.
2023-12-31 14:39:55 +00:00
1. Click the link to [`Workers Dashboard`](https://dash.cloudflare.com/sign-up?to=/:account/workers-and-pages){target="\_blank"} to find your account ID.
1. You can copy your account ID from the URL e.g. https://dash.cloudflare.com/ab7cb454c93987b6343350d4e84c16c7/workers-and-pages/create where `ab7cb454c93987b6343350d4e84c16c7` is the account ID.
1. Paste the account ID into the text box on the original Cloudflare workers page.
1. Click the link to [`My Profile`](https://dash.cloudflare.com/profile/api-tokens){target="\_blank"}, to create an API token.
1. Click `Create Token`.
1. Select `Use template` next to `Edit Cloudflare Workers`.
1. Under `Account Resources`, select `Include` and your account under the dropdown.
1. Under `Zone Resources`, select `All zones` (You can select a more specific zone if you have the zones available).
1. At the bottom of the page, click `Continue to summary`.
1. On the next screen, click `Create token`.
1. Copy the API token and **save it in a safe place, it won't be shown again**.
1. Paste the API token into the Cloudflare Workers API Token text box.
1. Click `Fork the Repository` and follow the instructions to enable workflows.
1. Click `Deploy` to deploy to Cloudflare Workers.
2023-12-31 14:39:55 +00:00
1. Congratulations! Your worker is now deploying. Please wait for the GitHub Action to build and publish your worker.
1. You can click the [`Worker dash`](https://dash.cloudflare.com/sign-up?to=/:account/workers-and-pages){target="\_blank"} and `GitHub repo` buttons to see the status of the deploy.
1. When the worker has deployed, you will need to take note of the URL. This can be found on Cloudflare under [Workers and Pages -> Overview](https://dash.cloudflare.com/sign-up?to=/:account/workers-and-pages){target="\_blank"} -> Proxy.
2023-12-12 18:25:35 +00:00
## Method 1 - Cloudflare (Manual)
2023-12-31 14:39:55 +00:00
1. Login to your Cloudflare account if you have one, otherwise create one [here](https://dash.cloudflare.com/sign-up?to=/:account/workers-and-pages)
1. If you are signing up for an account, make sure to verify your email before going further!
1. Download the latest version of the Cloudflare [`simple-proxy-cloudflare.mjs` script from here](https://github.com/movie-web/simple-proxy/releases/latest/download/simple-proxy-cloudflare.mjs).
1. Go to `Workers & Pages` and then `Overview` in the left-hand navigation bar.
1. Click the `Create Worker` button
2023-12-31 14:39:55 +00:00
1. If you've made a worker or pages application before, you will need to click `Create Application` first
1. Give your worker a name and click `Deploy`. This can be anything you would like!
1. On the `Congratulations` web page, click the `Edit code` button to edit the code in the worker you have just created.
1. There should now be a code editor on the left hand side on the web page.
2023-12-31 14:39:55 +00:00
1. Select all of the existing template code and delete it. **You must make sure all of the code is deleted for this to work!**
1. Go to your downloads folder and open up the `simple-proxy-cloudflare.mjs` file you downloaded earlier in a text editor, and **copy** the contents.
1. Back in your browser, paste the contents of the file into the code editor.
1. The `Save and deploy` button in the top right corner should now be active, click it to deploy your proxy!
1. A confirmation dialog will appear, click `Save and deploy` once more.
1. Your worker is now deployed! You can click the back button in the top left to take you back to the summary screen.
2023-12-31 14:39:55 +00:00
1. On the summary screen, your worker link will be displayed under `Preview`. Right click the link, click `Copy link address` and save the link somewhere - you will need it to set up the client!
2023-12-12 18:25:35 +00:00
## Method 2 - Docker
2023-12-12 18:25:35 +00:00
::alert{type="warning"}
Experience with Docker, domains and web hosting is **highly recommended** for this method. <br />
[Deploying with Cloudflare](#method-1-cloudflare-easy) is easier and safer to do! You are exposing your server at your own risk!
::
2023-12-31 14:39:55 +00:00
Our `simple-proxy` application is available from the GitHub Container Registry under the image [`ghcr.io/movie-web/simple-proxy:latest`](https://ghcr.io/movie-web/simple-proxy:latest){target="\_blank"} :copy-button{content="ghcr.io/movie-web/simple-proxy:latest"}
The container exposes the HTTP port (Without TLS/SSL) as `3000/TCP`.
2023-12-31 14:39:55 +00:00
If you know what you are doing, you should know what to do with this information. If you don't, then please follow our Cloudflare guides.