Skip to content

Container Deployment

ToastXC edited this page Dec 13, 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. Ensure that SELinux is disabled until the container is created and deployed.

Cleaning old images, containers and scripts

This will clean ALL containers and images from podman and buildah

podman stop -a
podman container rm -a
podman image rm -a

buildah rmi -a
buildah rm -a

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

Pod

A pod is a collection of containers, it is required for Reywen if you intend to connect to any database or similar service. By default secure websocket operates over port 443 but since this is a privileged port non-root podman cannot use it. In the example below internal 443 is port mapped to 1086.

podman pod create \
        --name reywen \
        -p 1086:443

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

Updating

Luckily updating Reywen easy, and can be done while the container is running! Make sure that you do not stop the updating process midway through as this could break the container. Once done the container may need to be restarted.

name=$( echo "reywen-server" ) # container name
container=$( echo "podman exec $name" )
$container rm Reywen-Revolt -r
$container sh debian.sh
podman restart $name
Clone this wiki locally