How to run a Webserver on Standalone Deployments
Some config options require a webserver that can server content. These are for example :
Changing Element Web apperance with custom background pictures. Or Providing a HomePage for display in Element Web. Or Providing a Guide PDF from your server in an airgapped environment.
You can run a Webserver in Element Server Suite deployemnts. This guide is applicable to the Single Node deployment of Element Server Suite but can be used for guidance on how to host a webserver in the Kubernetes Cluster deployemnts as well.
You an use any webserver that you like, in this example we will user the Bitnami Apache chart.
Install helm on the machine that you are using to manage your deployment. Makes sure to use Helm version 3.
curl https://baltocdn.com/helm/signing.asc | gpg --dearmor | sudo tee /usr/share/keyrings/helm.gpg > /dev/null
sudo apt-get install apt-transport-https --yes
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list
sudo apt-get update
sudo apt-get install helm
Add the bitnami repository
helm repo add bitnami https://charts.bitnami.com/bitnami
Update the repo information
helm repo update
We need add configurations to adjust the apache deployment to our needs. The K8s service should be switched to ClusterIP. The Single Node deployemnt includes an Ingress configuration through nginx that we can use to route traffic to this webserver. The name of the ingressClass is "nginx". We will need a hostname as well. This name needs to be resolvable through DNS. This could be done through the wildcard entry for *.$BASEDOMAIN that you might already have.
For providing content Git would be best, as this apace helm chart is capable of pulling a git repo
Create a file called apache-values.yml in the home directory of your element user directory. Remember to replace BASEDOMAIN with the correct value for your deployment.
We will be using a config map to load the content that the webserver will serve.
Create a directory to supply this content :
Put your content into the apache-content directory.
cp /tmp/background.jpg ~element/apache-content/
cp /tpm/home.html ~element/apache-content/
We can now create the apache-content config map from the content in the apache-content directory
kubectl create cm apache-content --from-file=./apache-content/
Now we are ready to deploy the apache helm chart
helm install myhomepage -f apache-values.yaml oci://registry-1.docker.io/bitnamicharts/apache