Backend
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.
The postgres database will need to be populated with migrations if postgres.migrateOnBoot
isn't enabled.
Method 1 - Docker Deployment#
This method provides a straightforward setup with minimal configuration. For more extensive customization, see the Configuration Reference.
Prerequisites
- Docker: If you don't have Docker installed, download it from the official website: Docker installation
- Docker Compose: Install Docker Compose following the instructions for your operating system: Docker-Compose installation
Setup
Create docker-compose.yml
:
Important:
- Replace
YourPasswordHere
with your secure database password. - Generate a strong session secret and replace
32CharacterLongStringHere
.
Start the Backend: Open a terminal in the directory containing docker-compose.yml
and execute:
Accessing Your Backend#
Your backend should be accessible on (YourPrivateIP):80
. To share it outside your local network, you'll need to configure port forwarding or cloudflared tunnel.
Optional: Implementing a Reverse Proxy#
To enhance your SSL and domain configuration, it's advisable to establish a reverse proxy, such as Nginx. For an optimal choice in this regard, Cloudflare Zero Trust Tunnel is recommended. You can find more information here.
- If you decide to utilize a reverse proxy, it's important to include
MWB_SERVER__CORS: "https://movie.example.com"
in your configuration.MWB_SERVER__CORS
must contain a space-separated list of origins (Protocol + Hostname) for the client to be able to access the backend.
- Depending on your specific setup, you may also require the addition of
MWB_SERVER__TRUST_PROXY: true
andMWB_SERVER__TRUST_CLOUDFLARE: true
.
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 the Deployments
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.