docs/content/4.backend/1.deploy.md

35 lines
1.8 KiB
Markdown
Raw Normal View History

2023-12-12 18:36:07 +00:00
---
title: 'Deploy'
---
2023-12-12 18:25:35 +00:00
2023-12-31 14:39:55 +00:00
# Deploying the backend
2023-12-12 18:25:35 +00:00
2023-12-31 14:39:55 +00:00
The only officially recognized hosting method is through Docker (or similar container runtimes). It can be scaled horizontally to all your heart's content and is the safest way to host the backend.
2023-12-12 18:25:35 +00:00
For configuration, check out the [configuration reference](2.configuration.md).
::alert{type="info"}
2023-12-31 14:39:55 +00:00
The postgres database will need to be populated with [migrations](0.introduction.md#migrations) if `postgres.migrateOnBoot` isn't enabled.
::
## Method 1 - Docker
2023-12-31 14:39:55 +00:00
This method will help you set up the backend with the bare minimum configuration options. You'll most likely want to [add some more environment variables](2.configuration.md) to customize your experience more thoroughly.
The command below will not work unless customized by you, change the [`MWB_POSTGRES__CONNECTION`](2.configuration.md#postgresconnection) and [`MWB_CRYPTO__SESSION_SECRET`](2.configuration.md#cryptosessionsecret) to something valid for the backend to function.
If you're using a hosted postgres database like [Neon](https://neon.tech/){target="\_blank"}, you'll also want to enable SSL support for the backend using the [`postgres.ssl`](2.configuration.md#postgresssl) option.
For other versions of the image, [check out the package page](https://github.com/movie-web/backend/pkgs/container/backend){target="\_blank"}.
```sh
docker run \
-p 80:80 \
2023-12-31 14:39:55 +00:00
-e MWB_POSTGRES__CONNECTION=postgresql://localhost:5432 \
-e MWB_CRYPTO__SESSION_SECRET=add-your-own-secret \
-e MWB_META__NAME=unofficial-movie-web \
ghcr.io/movie-web/backend:latest
```
2023-12-31 14:39:55 +00:00
After running that command, your backend [_should_](../1.self-hosting/4.troubleshooting.md) now be available on `localhost:80`. if you want to be able to connect to the backend outside of your local network (for example sharing it with your friends), then you'll need set up to port forwarding.