3.1 KiB
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 and is the safest way to host the backend.
For configuration, check out the configuration reference.
::alert{type="info"}
The postgres database will need to be populated with migrations if postgres.migrateOnBoot
isn't enabled.
::
Method 1 - Docker
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 to customize your experience more thoroughly.
The command below will not work unless customized by you, change the MWB_POSTGRES__CONNECTION
and MWB_CRYPTO__SESSION_SECRET
to something valid for the backend to function.
If you're using a hosted postgres database like Neon{target="_blank"}, you'll also want to enable SSL support for the backend using the postgres.ssl
option.
For other versions of the image, check out the package page{target="_blank"}.
docker run \
-p 80:80 \
-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
After running that command, your backend should 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.
Method 2 - Railway (Easy)
Railway offers you $5 of credit once you verify your account, which is enough to run the backend for around 5 months (~$0.90 per month).
- Login to your Railway account if you have one, otherwise create one here.
- If you are signing up, then verify your account by clicking the link in the email Railway sends you.
- If you created your account with an email, then to verify your account further, go to your account, then plans and verify your account with a GitHub account.
- Click the
Deploy on Railway
button above. - If a
Configure
button is displayed, click on it and allow Railway to access your GitHub account. - Fill in the required variables or change the default values.
- The
Deploy
button at the bottom of the template should be active, click on it. - Once the
Backend
service has deployed, copy the URL from theDeployments
page. (Might take a second for it to be available after the service has deployed) - Congratulations! You have deployed the backend, you can now set up the client.