Deploy
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.
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
Setup
-
Create
docker-compose.yml:services:postgres:image: postgresenvironment:POSTGRES_USER: pstream_userPOSTGRES_DB: pstreamPOSTGRES_PASSWORD: YourPasswordHereports:- "5432:5432"networks:- p-stream-networkp-stream:image: ghcr.io/okikio/backend:latestenvironment:DATABASE_URL: postgresql://pstream_user:YourPasswordHere@postgres:5432/pstreamCRYPTO_SECRET: 32CharacterLongStringHereMETA_NAME: unofficial-backendports:- "80:80"depends_on:- postgresnetworks:- p-stream-networknetworks:p-stream-network:driver: bridgeImportant:
- Replace
YourPasswordHerewith your secure database password. - Generate a strong session secret and replace
32CharacterLongStringHere.
- Replace
-
Start the Backend: Open a terminal in the directory containing
docker-compose.ymland execute:Terminal window docker-compose up -d
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.
Method 2 - Railway (Easy)
Railway offers a 30-day free trial that includes a one-time $5 credit. After the trial, you receive $1 in usage credits for free each 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. Ensure you setup your server location here to the closest one possible.
-
Click the
Deploy on Railwaybutton above. -
Click on configure for the one that says Backend.
-
Fill in the required variable
META_NAME; the rest are optional and can be set later on. -
The
Deploybutton at the bottom of the template should be active, click on it. -
Once the
Backendservice has deployed, copy the URL from theDeploymentspage. (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.