Skip to content

Container Deployment

ToastXC edited this page Dec 6, 2022 · 17 revisions

Prerequisites

You will need...

  • podman
  • buildah
  • git

This guide was created using Fedora 37, older versions of podman and buildah may not work the same

Creating container with buildah

This script will download, compile and install Reywen to the container. It may take a while as Rust has very strong rules for compilation. Once completed your container is complete and ready for deployment.

buildah from rust
buildah run rust-working-container wget https://raw.githubusercontent.com/toastxc/Reywen-Revolt/main/.podman/debian.sh
# run again to test if the server works, you should get a 'Websocket protocl' Error
buildah run rust-working-container sh debian.sh
####################################
buildah config --entrypoint "sh debian.sh -D FOREGROUND" rust-working-container
buildah commit rust-working-container reywen

Deploying container

How a container is deployed is up to you, but here's a basic guideline for deployment. There are two important parts of this command, the pod and the volume. It is recommended to run Reywen in a pod so that it can connect to mongodb for database functionality. the volume is used for modifying configurations for both reywen and its plugins.

dir=$( echo "/home/"$USER"/Downloads/reywen")

#### reywen container
podman run  -d -it  \
        --name reywen-server \
        -v $dir/config:/config \
        --pod reywen \
        localhost/reywen

mongodb container

It is very important to save the password and username of mongodb so that it can be added in reywen configurations once deployed.

podman run -d \
        -p 27017:27017 --name reywen-mongodb \
        -v /mnt/raid/reywen/db:/data/db \
        -e MONGO_INITDB_ROOT_USERNAME=reywen \
        -e MONGO_INITDB_ROOT_PASSWORD=PASSWORD \
        mongo

Pod

By default secure websocket operates over port 443, but two containers cannot have the same port. With this setup the internal port is set to 443, and the external port is 8000. In order to communicate with Revolt port mapping has changed so that Reywen is still able to communicate with port 443, if you do not have any web servers then ignore this and set both ports to 443.

podman pod create \
        --name reywen \
        -p 8000:443
Clone this wiki locally