Merge pull request #3 from movie-web/dev

Deploy documentation
This commit is contained in:
William Oldham 2023-12-15 22:22:11 +00:00 committed by GitHub
commit 6fc9a34ccc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 513 additions and 133 deletions

3
.github/CODEOWNERS vendored Normal file
View File

@ -0,0 +1,3 @@
* @movie-web/core
.github @binaryoverload

1
.github/CODE_OF_CONDUCT.md vendored Normal file
View File

@ -0,0 +1 @@
Please visit the [main document at primary repository](https://github.com/movie-web/movie-web/blob/dev/.github/CODE_OF_CONDUCT.md).

1
.github/CONTRIBUTING.md vendored Normal file
View File

@ -0,0 +1 @@
Please visit the [main document at primary repository](https://github.com/movie-web/movie-web/blob/dev/.github/CONTRIBUTING.md).

View File

@ -1,57 +1,3 @@
# Docus Starter
# movie-web docs
Starter template for [Docus](https://docus.dev).
## Clone
Clone the repository (using `nuxi`):
```bash
npx nuxi init -t themes/docus
```
## Setup
Install dependencies:
```bash
yarn install
```
## Development
```bash
yarn dev
```
## Edge Side Rendering
Can be deployed to Vercel Functions, Netlify Functions, AWS, and most Node-compatible environments.
Look at all the available presets [here](https://v3.nuxtjs.org/guide/deploy/presets).
```bash
yarn build
```
## Static Generation
Use the `generate` command to build your application.
The HTML files will be generated in the .output/public directory and ready to be deployed to any static compatible hosting.
```bash
yarn generate
```
## Preview build
You might want to preview the result of your build locally, to do so, run the following command:
```bash
yarn preview
```
---
For a detailed explanation of how things work, check out [Docus](https://docus.dev).
Find it at https://docs.movie-web.app/

View File

@ -8,7 +8,7 @@ layout: page
---
cta:
- Get Started
- /introduction/getting-started
- /self-hosting/hosting-intro
secondary:
- Open on GitHub →
- https://github.com/movie-web/movie-web

View File

@ -1,2 +0,0 @@
# Getting Started

View File

@ -1,2 +0,0 @@
icon: ph:star-duotone
navigation.redirect: /introduction/getting-started

View File

@ -0,0 +1,33 @@
---
title: 'Start self-hosting'
---
# How to self host
::alert{type="info"}
We **do not** provide support on how to self-host. If you can't figure it out then tough luck. Please do not make GitHub issues or ask in our Discord server for support on how to self-host.
::
There are a few configurations of hosting movie-web. Each with their own benefits.
**If you don't know what to choose, go with method 1.**
## Method 1 - Only host the frontend
With this method, you only host the essential parts that make movie-web work. But keep using the account server from offical movie-web.
This method is the easiest to self-host and is recommended for most users.
1. [Setup the Proxy!](../2.proxy/1.deploy.md)
2. [Setup the Client!](../3.client/1.deploy.md)
## Method 2 - Only host the account server
If you want to own your own data, it's possible to selfhost just the account server and nothing else.
This method is only recommended if you have experience hosting databases or other similar stateful applications.
1. [Setup the Backend!](../4.backend/1.deploy.md)
2. [Configure the Client!](../3.client/1.deploy.md)
## Method 3 - Host everything
If you want an instance that's completely isolated from official movie-web. You can selfhost all parts.
This method is not recommended for inexperienced hosters.
1. [Setup the Proxy!](../2.proxy/1.deploy.md)
2. [Setup the Backend!](../4.backend/1.deploy.md)
3. [Setup the Client!](../3.client/1.deploy.md)

View File

@ -0,0 +1,15 @@
---
title: 'Configure backend'
---
# Configure your client with the backend
If you would like to use an alternative backend server (The server responsible for saving user data across devices) then you can specify your own URL **without needing to host your own movie-web frontend!**
::alert{type="danger"}
Changing your backend server will log you out of your account - make sure you have a copy of your 12-word passphrase saved safely in case you need to go back!
::
1. On movie-web, got to your settings page by click the menu icon at the top right and then `Settings`.
1. Scroll down the page to the section named `Connections` where there is a toggle named `Custom server`.
1. Enable the `Custom server` toggle and enter your backend URL in the input box named `Custom server URL`.
1. Click `Save` at the bottom right corner of your screen.

View File

@ -0,0 +1,20 @@
---
title: 'PWA vs no-PWA'
---
# About Selfhosting PWA
So that clients can have a more native app-like experience on mobile, movie-web has a function to support Progessive Web Apps (PWA). You can learn more about what a PWA is [here](https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Guides/What_is_a_progressive_web_app).
In movie-web version 3, PWAs were enabled by default. Unfortunately, PWAs tend to come with caching complications that can be tricky to resolve. That's why we have **disabled** PWAs by default in movie-web version 4. If you are upgrading from version 3, please [read our upgrade guide](../3.client/5.upgrade.md) for more information.
::alert{type="warning"}
Enabling PWAs means that you cannot disable it again - Please only proceed if you know what you are doing!
::
## If you are running movie-web on a hoster such as Vercel
If your hosting is building movie-web from the source, you can enable PWAs using environment variables. The full environment variable reference can be found [here](../3.client/3.configuration.md) but for PWAs we are only interested in `VITE_PWA_ENABLED`.
Setting `VITE_PWA_ENABLED` to `true` will generate a [service worker file](https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Guides/Making_PWAs_installable#service_worker) and a [web app manifest](https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Guides/Making_PWAs_installable#the_web_app_manifest) which enable the website to be installed from a [web browser both on Desktop and on Mobile](https://developer.mozilla.org/en-US/docs/Web/Progressive_web_apps/Guides/Making_PWAs_installable#installation_from_the_web).
## If you are running movie-web using the .zip files
If you are downloading the movie-web `zip` files from our GitHub and installing them on a static website hoster, then all you need to do is to make sure to download the [`movie-web.pwa.zip`](https://github.com/movie-web/movie-web/releases/latest/download/movie-web.pwa.zip) file instead of the `movie-web.zip` file!

View File

@ -0,0 +1,42 @@
---
title: 'Troubleshooting'
---
# Troubleshooting
There is a possibility for something to go wrong while trying to deploy your own instance of movie-web. This page will contain common issues people come across while self-hosting and their solutions.
## "Failed to find media, try again!" while searching
This is likely a misconfigured TMDB api key. Verify that TMDB isn't working by going to `/admin` or `/#/admin`. Then clicking `Test TMDB`.
If it succeeds, the TMDB api key is correct and it will be a different issue.
If it does not work. Recheck your TMDB api key. **Make sure its the READ api key, not the normal api key.**
## Everything I try to watch fails
This is likely a misconfigured worker. Verify that the workers are the issue by going to `/admin` or `/#/admin`. Then clicking `Test workers`.
You should have at least 1 worker registered.
If any worker fails the test, you should double check its URL and double check if the worker has the correct code.
## I can't make an account or login
This is likely misconfigured or broken backend. Verify the backend by going to `/admin` or `/#/admin`. Then clicking `Test backend`.
It should give you the name that you have configured as backend with the latest version of the backend.
If the test gives you an error, your backend URL configuration option likely has a typo.
If the version is not the latest version, you should update your backend instance.
If the name and description of the results don't match your own instance, make sure you have your backend URL set correctly.
## I updated from version 3 to version 4 but still see the old version
This is likely that you haven't installed the PWA version of movie-web. Please read the [upgrade guide](../3.client/5.upgrade.md)

View File

@ -0,0 +1,3 @@
title: 'Self-Hosting'
icon: mdi:server-network
navigation.redirect: /self-hosting/hosting-intro

View File

@ -0,0 +1,9 @@
---
title: 'Introduction'
---
# Introduction to the proxy
Our proxy is used to bypass CORS-protected URLs on the client side, allowing users to make requests to CORS protected endpoints without a backend server.
The proxy is made using [Nitro by UnJS](https://nitro.unjs.io/) which supports building the proxy to work on multiple providers including Cloudflare Workers, AWS Lambda and [more...](https://nitro.unjs.io/deploy)
Our recommended provider is Cloudflare due to its [generous free plan](https://www.cloudflare.com/en-gb/plans/developer-platform/).

View File

@ -0,0 +1,64 @@
---
title: 'Deploy'
---
# Deploying the proxy
## Method 1 - Cloudflare (Easy)
Cloudflare has a generous free plan, so you don't need to pay anything unless you get hundreds of users.
[![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/movie-web/simple-proxy)
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.
1. Click the link to `Workers Dashboard` 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` 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.
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` 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 -> Proxy.
## Method 1 - Cloudflare (Manual)
1. Login to your Cloudflare account if you have one, otherwise create one [here](https://dash.cloudflare.com/sign-up)
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
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.
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.
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 setup the client!
## Method 2 - Docker
::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!
::
Our `simple-proxy` application is available from the GitHub Container Registry under the image `ghcr.io/movie-web/simple-proxy:latest` :copy-button{content="ghcr.io/movie-web/simple-proxy:latest"}
The container exposes the HTTP port (Without TLS/SSL) as `3000/TCP`.
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.

3
content/2.proxy/_dir.yml Normal file
View File

@ -0,0 +1,3 @@
title: 'Proxy'
icon: mdi:server-network
navigation.redirect: /proxy/introduction

View File

@ -1,9 +0,0 @@
# How to self host
::alert{type="info"}
We **do not** provide support on how to self-host. If you can't figure it out then tough luck. Please do not make GitHub issues or ask in our Discord server for support on how to self-host.
::
The movie-web application is made of two parts: the proxy and the client. Click the following links to find out more:
- [Setup the Proxy](2.proxy.md)
- [Setup the Client](3.client.md)

View File

@ -1,37 +0,0 @@
# Setting up the proxy
Our proxy is used to bypass CORS-protected URLs on the client side, allowing users to make requests to protected endpoints without a backend server.
The proxy is made using [Nitro by UnJS](https://nitro.unjs.io/) which supports building the proxy to work on multiple providers including Cloudflare Workers, AWS Lambda and [more...](https://nitro.unjs.io/deploy)
Our recommended provider is Cloudflare due to its [generous free plan](https://www.cloudflare.com/en-gb/plans/developer-platform/).
## Cloudflare Workers
The proxy is made as a Cloudflare worker. Cloudflare has a generous free plan, so you don't need to pay anything unless you get hundreds of users.
[![Deploy to Cloudflare Workers](https://deploy.workers.cloudflare.com/button)](https://deploy.workers.cloudflare.com/?url=https://github.com/movie-web/simple-proxy)
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.
1. Click the link to "Workers Dashboard" to find your account ID.
1. If you have used workers in the past, there will be a place on the right hand side to copy your account ID.
1. If you haven't used workers before, 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" 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.
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" 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 -> proxy.

View File

@ -1,2 +0,0 @@
title: 'Self-Hosting'
icon: mdi:server-network

View File

@ -0,0 +1,16 @@
---
title: 'Introduction'
---
# Introduction to the client
The client is what the main part of the application, it houses the interface and all of the scraping logic.
## PWA
The client can be optionally ran as a PWA. This can be hard to do correctly and really hard to reverse, so it's generally not recommended to do so if you don't have experience hosting PWA's.
You can read more about it [here](../1.self-hosting/3.about-pwa.md).
## Configuration
The client has a decent amount of configuration options. You can view them all [here](./3.configuration.md).

View File

@ -1,6 +1,9 @@
# Setting up the client
---
title: 'Deploy'
---
# Deploying the client
## Vercel - Recommended
## Method 1 - Vercel - Recommended
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fmovie-web%2Fmovie-web%2Ftree%2Fmaster&env=VITE_CORS_PROXY_URL,VITE_TMDB_READ_API_KEY)
1. Click the Deploy button.
1. Sign in using either a GitHub, GitLab, or Bitbucket.
@ -9,41 +12,26 @@
- `VITE_CORS_PROXY_URL`: Enter your proxy URL here. Make sure to not have a slash at the end of your URL.
Example (THIS IS AN EXAMPLE, IT WON'T WORK FOR YOU): `https://test-proxy.test.workers.dev`
- `VITE_TMDB_READ_API_KEY`: Enter your TMDB Read Access Token here. Please read [below](#tmdb-api-key) on how to get an API key.
- `VITE_TMDB_READ_API_KEY`: Enter your TMDB Read Access Token here. Please read [the TMDB page](2.tmdb.md) on how to get an API key.
- `VITE_BACKEND_URL`: Only set if you have a self-hosted backend. Put in your backend URL. Check out [configuration reference](../4.client/2.configuration.md) for details. Make sure to not have a slash at the end of the URL.
1. Click "Deploy"
1. Congrats! You have your own version of movie-web hosted.
1. You may wish to configure a custom domain - Please consult [the Vercel docs for how to do this](https://vercel.com/docs/getting-started-with-vercel/domains).
## Any Static Web Host
## Method 2 - Static Web Host
1. Download the file `movie-web.zip` from the latest release: https://github.com/movie-web/movie-web/releases/latest.
2. Extract the ZIP file so you can edit the files.
3. Open `config.js` in an editor such as Notepad, Visual Studio Code or similar.
4. Put your proxy URL in-between the double quotes of `VITE_CORS_PROXY_URL: ""`. Make sure to not have a slash at the end of your URL.
Example (THIS IS AN EXAMPLE, IT WON'T WORK FOR YOU): `VITE_CORS_PROXY_URL: "https://test-proxy.test.workers.dev"`
5. Put your TMDB Read Access Token inside the quotes of `VITE_TMDB_READ_API_KEY: ""`. Please read [below](#tmdb-api-key) on how to get an API key.
5. Put your TMDB Read Access Token inside the quotes of `VITE_TMDB_READ_API_KEY: ""`. Please read [the TMDB page](2.tmdb.md) on how to get an API key.
6. If you have a self-hosted backend server, enter your URL in the `VITE_BACKEND_URL` variable. Check out [configuration reference](../4.client/2.configuration.md) for details. Make sure to not have a slash at the end of the URL.
6. Save the file.
7. Upload **all** of the files to a static website hosting such as:
- GitHub Pages
- Netlify
- Vercel
- Etc, there are lots - Google it if the ones above don't work for you.
1. Congrats! You have your own version of movie-web hosted.
## TMDB API Key
In order to search for movies and TV shows, we use an API called "The Movie Database" (TMDB). In order for your client to be able to search, you need to generate an API key.
::alert{type="info"}
The API key is **free**, you just need to create an account.
::
1. Create an account at https://www.themoviedb.org/signup
1. You will be required to verify your email; click the link that you get sent to verify your account.
1. Go to https://www.themoviedb.org/settings/api/request to create a developer account.
1. Read the terms and conditions and accept them.
1. Fill out your details:
- Select "Website" as type of use.
- For the other details can put any values; they are not important.
1. Copy the "API Read Access Token" - **DO NOT COPY THE API Key - IT WILL NOT WORK**
1. Congrats! You have your own version of movie-web hosted.

View File

@ -0,0 +1,19 @@
---
title: 'TMDB API Key'
---
## Getting an API Key
In order to search for movies and TV shows, we use an API called "The Movie Database" (TMDB). In order for your client to be able to search, you need to generate an API key.
::alert{type="info"}
The API key is **free**, you just need to create an account.
::
1. Create an account at https://www.themoviedb.org/signup
1. You will be required to verify your email; click the link that you get sent to verify your account.
1. Go to https://www.themoviedb.org/settings/api/request to create a developer account.
1. Read the terms and conditions and accept them.
1. Fill out your details:
- Select "Website" as type of use.
- For the other details can put any values; they are not important.
1. Copy the "API Read Access Token" - **DO NOT COPY THE API Key - IT WILL NOT WORK**

View File

@ -1,3 +1,6 @@
---
title: 'Configuration'
---
# Client Config Reference
The config for the movie-web can be provided in 2 different ways, depending on how you are hosting movie-web:
@ -71,6 +74,8 @@ This is the URL for the movie-web backend server which handles cross-device sync
The backend server can be found at https://github.com/movie-web/backend and is offered as a [Docker](https://docs.docker.com/get-started/overview/) image for deployment.
Backend url must **not** end with a slash.
Example: `VITE_BACKEND_URL=https://backend.example.com`
Default: `https://backend.movie-web.app`

View File

@ -0,0 +1,43 @@
---
title: 'Changelog'
---
# Version 4.0.0
::alert{type="info"}
If you are upgrading from a previous version, make sure to read [the upgrade guide](5.upgrade.md).
::
### Bug fixes
- Fixed bug where video player overlays the controls on IOS.
- Fixed bug where you are kicked out of the fullscreen when switching episode.
- Fixed bug where you cannot select a different episode if first episode fails to load.
### Enhancements
- Completely redesigned look and feel for the entire website.
- Added FAQ and DMCA pages.
- Source loading page is more detailed.
- Video player has been remade from scratch, all internal workings are brand new.
- You can now input numbers manually into the subtitle customization menu.
- Subtitle delay can now be increased outside of the slider range by inputting manual numbers.
- Movie and show URL's now include the name of the media in the link, makes it easier at a glance to see what a link is about.
- Instructions on how to download are now given inside the app.
- Chromecasting no longer shows captions on the web player (still doesnt show on cast receiver)
- Chromecasting now supports HLS
### New features
- Quality selector! You can now switch qualities.
- Search bar no longer requires you to choose between shows or movies.
- Visit `/s/:term` to quickly watch something. For example `https://movie-web.app/s/hamilton`.
- You can now add movie-web as a search provider in your browser.
- Safari now has subtitles when fullscreening.
- A next episode button will appear when close to the end of an episode, allowing quick switching to next episode.
- When seeking and hovering over progress bar, you will now see a thumbnail for the place you're hovering.
- Subtitles now have language flag next to them.
- Your subtitle preference gets saved.
- Turn on subtitles using keyboard shortcut `C`.
- Self-hosters can now test their configurations at the `/admin` page.
- Subtitles can now be downloaded.
- Sync your data through online accounts (using passphrases for maximum privacy)
- You can now choose your own worker URL set in the settings page.
- A custom backend server URL can be set on the settings page.
- On the settings page, you can now choose between multiple themes.

View File

@ -0,0 +1,12 @@
---
title: 'Upgrade guide'
---
# Upgrade guide
## From `3.X` to `4.X`
You will need the latest version of the proxy worker. Redeploy a new worker using [our self-hosting guide](../2.proxy/1.deploy.md).
After you have the new worker, you will need to [get the new movie-web deployment files](https://github.com/movie-web/movie-web/releases/latest). **You CANNOT use the non-PWA version**. To upgrade safely without any complications, you need to update with `movie-web.pwa.zip`, Not the non-PWA version.
In the future, you will **ALWAYS** need to go with the PWA option. You cannot downgrade to non-PWA version without facing many caching complications.

View File

@ -0,0 +1,3 @@
title: 'Client'
icon: mdi:server-network
navigation.redirect: /client/introduction

View File

@ -0,0 +1,22 @@
---
title: 'Introduction'
---
# Introduction to the backend
The backend is essentially just an account server. There is not much more to it.
## Metrics
The backend exposes prometheus metrics, it can be accessed on `/metrics`.
## Security
Optionally, there are a few security settings:
- Recaptcha support, the server can verify Recaptcha v3 tokens on register and login.
- Ratelimits, Some expensive endpoints have ratelimits, but only when enabled. This requires an additional redis connection.
## Migrations
To run migrations, You can use the command `pnpm migration:up` inside the docker container.
Alternatively, you can enabled `postgres.migrateOnBoot` and it will be automatically migrated on boot.

View File

@ -0,0 +1,27 @@
---
title: 'Deploy'
---
# Deploying the backend
The only officially recognized hosting method is through Docker (or similar container runtimes).
It can be scaled horizontally to all your heart's content.
For configuration, check out the [configuration reference](2.configuration.md).
::alert{type="info"}
The postgres database will need to be populated with [migrations](0.introduction.md) if `postgres.migrateOnBoot` isn't enabled.
::
## Method 1 - Docker
For other versions, [check out the package page](https://github.com/movie-web/backend/pkgs/container/backend).
```sh
docker run \
-p 80:80 \
-e POSTGRES__CONNECTION=postgresql://localhost:5432 \
-e CRYPTO__SESSION_SECRET=add-your-own-secret \
-e META__NAME=unofficial-movie-web \
ghcr.io/movie-web/backend:latest
```

View File

@ -0,0 +1,134 @@
---
title: 'Configuration'
---
# Backend Config Reference
The config the backend can be provided in 3 ways.
- Make a `config.json` file in the working directory of the application (root of repository)
- Make a `.env` file in the working directory of the application (root of repository)
- Add environment variables to your system (or container)
## Method 1 - `config.json`
This method uses nesting. So the key `server.basePath`. Will result in a json file like this:
```json
{
"server": {
"basePath": "/backend",
}
}
```
## Method 2 - `.env`
This method is a flat method using double underscores as seperators and `MW_` as prefix. So the key `server.basePath`. Will result in the .env file like this:
```sh
MB_SERVER__BASE_PATH=/backend
```
## Method 3 - environment
This method is identical to the `.env` method listed above, but instead of writing it in a file, you add it to the environment.
# Reference
### `server.port`
Port number that the HTTP server listens on.
Example: `8080`
### `server.cors`
Space seperated list of allowed origins.
Example:
```
https://movie-web.app https://testing.movie-web.app
```
### `server.allowAnySite`
If this setting is set to true, it allows any origin to access the site.
This overwrites the setting at `server.cors`.
Example: `false`
### `server.trustProxy`
Should the server trust reverse proxy headers? This is used for ratelimiting
Example: `false`
### `server.basePath`
Prefix for which path is being listened on. Useful you're hosting on `example.com/backend` for example.
If this is set, you shouldn't apply url rewriting before proxying.
Example: `/backend`
### `logging.format`
Logging format, Should be either `pretty` or `json`.
Example: `pretty`
### `postgres.connection` - REQUIRED
Connection URL for postgres instance, should contain the database in the URL.
Example: `postgresql://localhost:5432`
### `postgres.migrateOnBoot`
Run all migrations that haven't ran yet on boot.
Example: `false`
::alert{type="warn"}
If you have multiple replicas running, this can cause a lot of issues. We recommend only using this if you run only one replica.
::
### `postgres.debugLogging`
Log all postgres queries in the console, this outputs sensitive data so DO NOT run it in production.
Example: `false`
### `crypto.sessionSecret` - REQUIRED
The secret used to sign sessions. Must be at least 32 characters long.
Example: `Make your own`
### `meta.name` - REQUIRED
The name of the backend instance, this will be displayed to users who try to create an account.
Example: `Unofficial movie-web`
### `meta.description`
The description of the backend instance, this will be displayed to users who try to create an account.
Example: `This is not an official instance of movie-web`
### `captcha.enabled`
To protect your server from bot attacks, captcha's can be useful to enabled. If this is enabled, all other captcha related settings are required.
Example: `false`
### `captcha.secret`
Google Recaptcha secret key.
Example: `sjgaJ@3djasFVx`
### `captcha.clientKey`
Google Recaptcha site key.
Example: `2jf853z5bc63bvDb2323FAda`
### `ratelimits.enabled`
To protect bot attacks or spammy users, you can enabled ratelimits. Make sure your ip headers are properly forwarded if you're using a reverse proxy. Also see `server.trustProxy`. If this is enabled, all other ratelimit related settings are required.
Example: `false`
### `ratelimits.redisUrl`
Redis connection URL for storing ratelimit data. Just uses plain redis without any modules.
Example: `redis://localhost:6379`

View File

@ -0,0 +1,13 @@
---
title: 'Changelog'
---
# Version 1.1.5
Initial version of the backend.
- Prometheus metrics endpoint
- Account creation/deletion endpoints
- Endpoints for importing old account data
- Endpoints for syncing data
- Ratelimit system
- Captcha system

View File

@ -0,0 +1,7 @@
---
title: 'Upgrade guide'
---
# Upgrade guide
There is only one major version, there is nothing to write here yet.

View File

@ -0,0 +1,3 @@
title: 'Backend'
icon: mdi:server-network
navigation.redirect: /backend/introduction