bunkerized-nginx/docs/integrations.md

729 lines
19 KiB
Markdown
Raw Normal View History

2021-08-10 10:41:34 +02:00
# Integrations
## Docker
2022-06-03 17:24:14 +02:00
<figure markdown>
![Overwiew](assets/img/integration-docker.svg){ align=center }
<figcaption>Docker integration</figcaption>
</figure>
Using BunkerWeb as a [Docker](https://www.docker.com/) container is a quick and easy way to test and use it as long as you are familiar with the Docker technology.
We provide ready to use prebuilt images for x64, x86, armv7 and arm64 platforms on [Docker Hub](https://hub.docker.com/r/bunkerity/bunkerweb) :
2021-08-10 10:41:34 +02:00
```shell
2022-06-03 17:24:14 +02:00
docker pull bunkerity/bunkerweb:1.4.0
2021-08-10 10:41:34 +02:00
```
2022-06-03 17:24:14 +02:00
Alternatively, you can build the Docker images directly from the [source](https://github.com/bunkerity/bunkerweb) (and take a coffee ☕ because it may be long depending on your hardware) :
2021-08-10 10:41:34 +02:00
```shell
2022-06-03 17:24:14 +02:00
git clone https://github.com/bunkerity/bunkerweb.git && \
cd bunkerweb && \
docker build -t my-bunkerweb .
2021-08-10 10:41:34 +02:00
```
2022-06-03 17:24:14 +02:00
Usage and configuration of the BunkerWeb container are based on :
2021-08-10 10:41:34 +02:00
2022-06-03 17:24:14 +02:00
- **Environment variables** to configure BunkerWeb and meet your use cases
- **Volume** to cache important data and mount custom configuration files
- **Networks** to expose ports for clients and connect to upstream web services
2021-08-10 10:41:34 +02:00
2022-06-03 17:24:14 +02:00
### Environment variables
2021-08-10 10:41:34 +02:00
2022-06-03 17:24:14 +02:00
Settings are passed to BunkerWeb using Docker environment variables. You can use the `-e` flag :
2021-08-10 10:41:34 +02:00
```shell
2022-06-03 17:24:14 +02:00
docker run \
...
-e MY_SETTING=value \
-e "MY_OTHER_SETTING=value with spaces" \
...
bunkerity/bunkerweb:1.4.0
```
Here is the docker-compose equivalent :
```yaml
...
services:
mybunker:
image: bunkerity/bunkerweb:1.4.0
environment:
- MY_SETTING=value
2021-08-10 10:41:34 +02:00
```
2022-06-03 17:24:14 +02:00
!!! info "Full list"
For the complete list of environment variables, see the [settings section](/1.4/settings) of the documentation.
2022-06-03 17:24:14 +02:00
### Volume
A volume is used to share data with BunkerWeb and store persistent data like certificates, cached files, ...
The easiest way of managing the volume is by using a named one. You will first need to create it :
2021-08-10 10:41:34 +02:00
```shell
2022-06-03 17:24:14 +02:00
docker volume create bw-data
2021-08-10 10:41:34 +02:00
```
2022-06-03 17:24:14 +02:00
Once it's created, you can mount it on `/data` when running the container :
2021-08-10 10:41:34 +02:00
```shell
2022-06-03 17:24:14 +02:00
docker run \
...
-v "${PWD}/bw-data:/data" \
...
bunkerity/bunkerweb:1.4.0
2021-08-10 10:41:34 +02:00
```
2022-06-03 17:24:14 +02:00
Here is the docker-compose equivalent :
2021-08-10 10:41:34 +02:00
```yaml
2022-06-03 17:24:14 +02:00
...
2021-08-10 10:41:34 +02:00
services:
2022-06-03 17:24:14 +02:00
mybunker:
image: bunkerity/bunkerweb:1.4.0
2021-08-10 10:41:34 +02:00
volumes:
2022-06-03 17:24:14 +02:00
- bw-data:/data
...
volumes:
bw-data:
2021-08-10 10:41:34 +02:00
```
2022-06-03 17:24:14 +02:00
!!! warning
BunkerWeb runs as an **unprivileged user with UID 101 and GID 101** inside the container. The reason behind this is the security : in case a vulnerability is exploited, the attacker won't have full root (UID/GID 0) privileges.
But there is a downside : if you use a **local folder for the persistent data**, you will need to **set the correct permissions** so the unprivileged user can write data to it. Something like that should do the trick :
`shell mkdir bw-data && \ chown root:101 bw-data && \ chmod 770 bw-data `
2021-08-10 10:41:34 +02:00
2022-06-03 17:24:14 +02:00
Alternatively, if the folder already exists :
2021-08-10 10:41:34 +02:00
```shell
2022-06-03 17:24:14 +02:00
chown -R root:101 bw-data && \
chmod -R 770 bw-data
2021-08-10 10:41:34 +02:00
```
2022-06-03 17:24:14 +02:00
Mounting the folder :
2021-08-10 10:41:34 +02:00
```shell
2022-06-03 17:24:14 +02:00
docker run \
...
-v ./bw-data:/data \
...
bunkerity/bunkerweb:1.4.0
2021-08-10 10:41:34 +02:00
```
2022-06-03 17:24:14 +02:00
Here is the docker-compose equivalent :
2021-08-10 10:41:34 +02:00
```yaml
2022-06-03 17:24:14 +02:00
2021-08-10 10:41:34 +02:00
...
services:
2022-06-03 17:24:14 +02:00
mybunker:
image: bunkerity/bunkerweb:1.4.0
volumes:
- ./bw-data:/data
```
### Networks
The easiest way to connect BunkerWeb to web applications is by using Docker networks.
First of all, you will need to create a network :
```shell
docker network create mynetwork
```
Once it's created, you will need to connect the container to that network :
```shell
docker run \
...
--network mynetwork \
...
bunkerity/bunkerweb:1.4.0
```
You will also need to do the same with your web application(s). Please note that the other containers are accessible using their name as the hostname.
Here is the docker-compose equivalent :
```yaml
2021-08-10 10:41:34 +02:00
...
2022-06-03 17:24:14 +02:00
services:
mybunker:
image: bunkerity/bunkerweb:1.4.0
networks:
- bw-net
...
networks:
bw-net:
2021-08-10 10:41:34 +02:00
```
## Docker autoconf
2022-06-03 17:24:14 +02:00
<figure markdown>
![Overwiew](assets/img/integration-autoconf.svg){ align=center }
<figcaption>Docker autoconf integration</figcaption>
</figure>
!!! info "Docker integration"
The Docker autoconf integration is an "evolution" of the Docker one. Please read the [Docker integration section](#docker) first if needed.
2022-06-03 17:24:14 +02:00
The downside of using environment variables is that the container needs to be recreated each time there is an update which is not very convenient. To counter that issue, you can use another image called **autoconf** which will listen for Docker events and automatically reconfigure BunkerWeb in real-time without recreating the container.
Instead of defining environment variables for the BunkerWeb container, you simply add **labels** to your web applications containers and the **autoconf** will "automagically" take care of the rest.
!!! info "Multisite mode"
The Docker autoconf integration implies the use of **multisite mode**. Please refer to the [multisite section](/1.4/concepts/#multisite-mode) of the documentation for more information.
2022-06-03 17:24:14 +02:00
First of all, you will need to create the data volume :
```shell
2022-06-03 17:24:14 +02:00
docker volume create bw-data
```
2022-06-03 17:24:14 +02:00
- One for sharing the persistent data, mounted on **/data**
- Another one for sharing the generated Nginx configurations, mounted on **/etc/nginx**
Then, you can create two networks (replace 10.20.30.0/24 with an unused subnet of your choice) :
```shell
2022-06-03 17:24:14 +02:00
docker network create --subnet 10.20.30.0/24 bw-autoconf && \
docker network create bw-services
```
2022-06-03 17:24:14 +02:00
- One for communication between **BunkerWeb** and **autoconf**
- Another one for communication between **BunkerWeb** and **web applications**
You can now create the BunkerWeb container with the `AUTOCONF_MODE=yes` setting and the `bunkerweb.AUTOCONF` label (replace 10.20.30.0/24 with the subnet specified before) :
```shell
2022-06-03 17:24:14 +02:00
docker run \
-d \
--name mybunker \
--network bw-autoconf \
-p 80:8080 \
-p 443:8443 \
-e AUTOCONF_MODE=yes \
-e MULTISITE=yes \
-e SERVER_NAME= \
-e "API_WHITELIST_IP=127.0.0.0/8 10.20.30.0/24" \
-l bunkerweb.AUTOCONF \
bunkerity/bunkerweb:1.4.0 && \
docker network connect bw-services mybunker
```
And the autoconf one :
```shell
2022-06-03 17:24:14 +02:00
docker run \
-d \
--name myautoconf \
--network bw-autoconf \
-v bw-data:/data \
-v /var/run/docker.sock:/var/run/docker.sock:ro \
bunkerity/bunkerweb-autoconf:1.4.0
```
2022-06-03 17:24:14 +02:00
Here is the docker-compose equivalent for the BunkerWeb autoconf stack :
```yaml
version: '3'
services:
2022-06-03 17:24:14 +02:00
mybunker:
image: bunkerity/bunkerweb:1.4.0
ports:
- 80:8080
2022-06-03 17:24:14 +02:00
- 443:8443
volumes:
2022-06-03 17:24:14 +02:00
- bw-data:/data
environment:
2022-06-03 17:24:14 +02:00
- MULTISITE=yes
- SERVER_NAME=
2022-06-03 17:24:14 +02:00
- API_WHITELIST_IP=127.0.0.0/8 10.20.30.0/24
labels:
2022-06-03 17:24:14 +02:00
- "bunkerweb.AUTOCONF"
networks:
2022-06-03 17:24:14 +02:00
- bw-autoconf
- bw-services
myautoconf:
2022-06-03 17:24:14 +02:00
image: bunkerity/bunkerweb-autoconf:1.4.0
volumes:
2022-06-03 17:24:14 +02:00
- bw-data:/data
- /var/run/docker.sock:/var/run/docker.sock:ro
2022-06-03 17:24:14 +02:00
networks:
- bw-autoconf
volumes:
2022-06-03 17:24:14 +02:00
bw-data:
networks:
2022-06-03 17:24:14 +02:00
bw-autoconf:
ipam:
driver: default
config:
- subnet: 10.20.30.0/24
bw-services:
name: bw-services
```
2022-06-03 17:24:14 +02:00
Once the stack is setup, you can now create the web application container and add the settings as labels using the "bunkerweb." prefix in order to automatically setup BunkerWeb :
```shell
2022-06-03 17:24:14 +02:00
docker run \
-d \
--name myapp \
--network bw-services \
-l bunkerweb.MY_SETTING_1=value1 \
-l bunkerweb.MY_SETTING_2=value2 \
...
mywebapp:4.2
```
2022-06-03 17:24:14 +02:00
Here is the docker-compose equivalent :
```yaml
2022-06-03 17:24:14 +02:00
...
services:
2022-06-03 17:24:14 +02:00
myapp:
image: mywebapp:4.2
networks:
2022-06-03 17:24:14 +02:00
bw-services:
aliases:
2022-06-03 17:24:14 +02:00
- myapp
labels:
2022-06-03 17:24:14 +02:00
- "bunkerweb.MY_SETTING_1=value1"
- "bunkerweb.MY_SETTING_2=value2"
...
networks:
2022-06-03 17:24:14 +02:00
bw-services:
external:
2022-06-03 17:24:14 +02:00
name: bw-services
...
```
2022-06-03 17:24:14 +02:00
## Swarm
2022-06-03 17:24:14 +02:00
<figure markdown>
![Overwiew](assets/img/integration-swarm.svg){ align=center }
<figcaption>Docker Swarm integration</figcaption>
</figure>
2022-06-03 17:24:14 +02:00
!!! info "Docker autoconf"
The Docker autoconf integration is similar of the Docker autoconf one (but with services instead of containers). Please read the [Docker autoconf integration section](#docker-autoconf) first if needed.
2022-06-03 17:24:14 +02:00
To automatically configure BunkerWeb instances, a special service, called **autoconf**, will be scheduled on a manager node. That service will listen for Docker Swarm events like service creation or deletion and automatically configure the **BunkerWeb instances** in real-time without downtime.
2021-08-10 10:41:34 +02:00
2022-06-03 17:24:14 +02:00
Like the [Docker autoconf integration](#docker-autoconf), configuration for web services is defined using labels starting with the special **bunkerweb.** prefix.
2021-08-10 15:01:03 +02:00
2022-06-03 17:24:14 +02:00
The recommended setup is to schedule the **BunkerWeb service** as a **global service** on all worker nodes and the **autoconf service** as a **single replicated service** on a manager node.
2021-08-10 15:01:03 +02:00
2022-06-03 17:24:14 +02:00
First of all, you will need to create two networks (replace 10.20.30.0/24 with an unused subnet of your choice) :
2021-08-10 15:01:03 +02:00
```shell
2022-06-03 17:24:14 +02:00
docker network create -d overlay --attachable --subnet 10.20.30.0/24 bw-autoconf && \
docker network create -d overlay --attachable bw-services
2021-08-10 15:01:03 +02:00
```
2022-06-03 17:24:14 +02:00
- One for communication between **BunkerWeb** and **autoconf**
- Another one for communication between **BunkerWeb** and **web applications**
You can now create the BunkerWeb service (replace 10.20.30.0/24 with the subnet specified before) :
2021-08-10 15:01:03 +02:00
```shell
2022-06-03 17:24:14 +02:00
docker service create \
--name mybunker \
--mode global \
--constraint node.role==worker \
--network bw-autoconf \
--network bw-services \
-p published=80,target=8080,mode=host \
-p published=443,target=8443,mode=host \
-e SWARM_MODE=yes \
-e SERVER_NAME= \
-e MULTISITE=yes \
-e "API_WHITELIST_IP=127.0.0.0/8 10.20.30.0/24" \
-l bunkerweb.AUTOCONF \
bunkerity/bunkerweb:1.4.0
```
And the autoconf one :
2021-08-10 15:01:03 +02:00
```shell
2022-06-03 17:24:14 +02:00
docker service \
create \
--name myautoconf \
--constraint node.role==manager \
--network bw-autoconf \
--mount type=bind,source=/var/run/docker.sock,destination=/var/run/docker.sock,ro \
--mount type=volume,source=bw-data,destination=/data \
-e SWARM_MODE=yes \
bunkerity/bunkerweb-autoconf:1.4.0
```
Here is the docker-compose equivalent (using `docker stack deploy`) :
2021-08-10 15:01:03 +02:00
```yaml
2022-06-03 17:24:14 +02:00
version: '3.5'
2021-08-10 15:01:03 +02:00
services:
2022-06-03 17:24:14 +02:00
mybunker:
image: bunkerity/bunkerweb:1.4.0
2021-08-10 15:01:03 +02:00
ports:
- published: 80
target: 8080
mode: host
protocol: tcp
- published: 443
target: 8443
mode: host
protocol: tcp
environment:
- SWARM_MODE=yes
- SERVER_NAME=
2022-06-03 17:24:14 +02:00
- MULTISITE=yes
- API_WHITELIST_IP=127.0.0.0/8 10.20.30.0/24
2021-08-10 15:01:03 +02:00
networks:
2022-06-03 17:24:14 +02:00
- bw-autoconf
- bw-services
2021-08-10 15:01:03 +02:00
deploy:
mode: global
placement:
constraints:
- "node.role==worker"
labels:
2022-06-03 17:24:14 +02:00
- "bunkerweb.AUTOCONF"
2021-08-10 15:01:03 +02:00
2022-06-03 17:24:14 +02:00
myautoconf:
image: bunkerity/bunkerweb-autoconf:1.4.0
2021-08-10 15:01:03 +02:00
environment:
- SWARM_MODE=yes
2022-06-03 17:24:14 +02:00
volumes:
- bw-data:/data
- /var/run/docker.sock:/var/run/docker.sock:ro
2021-08-10 15:01:03 +02:00
networks:
2022-06-03 17:24:14 +02:00
- bw-autoconf
2021-08-10 15:01:03 +02:00
deploy:
replicas: 1
placement:
constraints:
- "node.role==manager"
networks:
2022-06-03 17:24:14 +02:00
bw-autoconf:
2021-08-10 15:01:03 +02:00
driver: overlay
attachable: true
2022-06-03 17:24:14 +02:00
name: bw-autoconf
ipam:
config:
- subnet: 10.20.30.0/24
bw-services:
2021-08-10 15:01:03 +02:00
driver: overlay
attachable: true
2022-06-03 17:24:14 +02:00
name: bw-services
volumes:
2022-06-03 17:24:14 +02:00
bw-data:
2021-08-10 15:01:03 +02:00
```
2022-06-03 17:24:14 +02:00
Once the BunkerWeb Swarm stack is set up and running (see autoconf logs for more information), you can now deploy web applications in the cluster and use labels to dynamically configure BunkerWeb :
2021-08-10 15:01:03 +02:00
```shell
2022-06-03 17:24:14 +02:00
docker service \
create \
--name myapp \
--network bw-services \
-l bunkerweb.MY_SETTING_1=value1 \
-l bunkerweb.MY_SETTING_2=value2 \
...
mywebapp:4.2
```
2021-08-10 15:01:03 +02:00
2022-06-03 17:24:14 +02:00
Here is the docker-compose equivalent (using `docker stack deploy`) :
2021-08-10 15:01:03 +02:00
2022-06-03 17:24:14 +02:00
```yaml
...
services:
myapp:
image: mywebapp:4.2
2021-08-10 15:01:03 +02:00
networks:
2022-06-03 17:24:14 +02:00
- bw-services
2021-08-10 15:01:03 +02:00
deploy:
placement:
constraints:
- "node.role==worker"
labels:
2022-06-03 17:24:14 +02:00
- "bunkerweb.MY_SETTING_1=value1"
- "bunkerweb.MY_SETTING_2=value2"
...
2021-08-10 15:01:03 +02:00
networks:
2022-06-03 17:24:14 +02:00
bw-services:
2021-08-10 15:01:03 +02:00
external:
2022-06-03 17:24:14 +02:00
name: bw-services
2021-08-10 15:01:03 +02:00
```
2021-08-10 10:41:34 +02:00
## Kubernetes
2022-06-03 17:24:14 +02:00
<figure markdown>
![Overwiew](assets/img/integration-kubernetes.svg){ align=center }
<figcaption>Kubernetes integration</figcaption>
</figure>
2021-08-10 15:01:03 +02:00
2022-06-03 17:24:14 +02:00
The autoconf acts as an [Ingress controller](https://kubernetes.io/docs/concepts/services-networking/ingress-controllers/) and will configure the BunkerWeb instances according to the [Ingress resources](https://kubernetes.io/docs/concepts/services-networking/ingress/). It also monitors other Kubernetes objects like [ConfigMap](https://kubernetes.io/docs/concepts/configuration/configmap/) for custom configurations.
2021-08-10 15:01:03 +02:00
2022-06-03 17:24:14 +02:00
The first step to install BunkerWeb on a Kubernetes cluster is to add a role and permissions on the cluster for the autoconf :
2021-08-10 15:01:03 +02:00
2021-08-10 17:04:17 +02:00
```yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
2022-06-03 17:24:14 +02:00
name: cr-bunkerweb
2021-08-10 17:04:17 +02:00
rules:
- apiGroups: [""]
2022-06-03 17:24:14 +02:00
resources: ["services", "pods", "configmaps"]
2021-08-10 17:04:17 +02:00
verbs: ["get", "watch", "list"]
2022-06-03 17:24:14 +02:00
- apiGroups: ["networking.k8s.io"]
2021-08-10 17:04:17 +02:00
resources: ["ingresses"]
verbs: ["get", "watch", "list"]
---
apiVersion: v1
kind: ServiceAccount
metadata:
2022-06-03 17:24:14 +02:00
name: sa-bunkerweb
2021-08-10 17:04:17 +02:00
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
2022-06-03 17:24:14 +02:00
name: crb-bunkerweb
2021-08-10 17:04:17 +02:00
subjects:
- kind: ServiceAccount
2022-06-03 17:24:14 +02:00
name: sa-bunkerweb
2021-08-10 17:04:17 +02:00
namespace: default
apiGroup: ""
roleRef:
kind: ClusterRole
2022-06-03 17:24:14 +02:00
name: cr-bunkerweb
2021-08-10 17:04:17 +02:00
apiGroup: rbac.authorization.k8s.io
```
2022-06-03 17:24:14 +02:00
The recommended way of deploying BunkerWeb is using a [DaemonSet](https://kubernetes.io/docs/concepts/workloads/controllers/daemonset/) which means each node in the cluster will run an instance of BunkerWeb :
2021-08-10 17:04:17 +02:00
```yaml
apiVersion: apps/v1
kind: DaemonSet
metadata:
2022-06-03 17:24:14 +02:00
name: bunkerweb
2021-08-10 17:04:17 +02:00
spec:
selector:
matchLabels:
2022-06-03 17:24:14 +02:00
app: bunkerweb
2021-08-10 17:04:17 +02:00
template:
metadata:
labels:
2022-06-03 17:24:14 +02:00
app: bunkerweb
# mandatory annotation
annotations:
bunkerweb.io/AUTOCONF: "yes"
2021-08-10 17:04:17 +02:00
spec:
containers:
2022-06-03 17:24:14 +02:00
- name: bunkerweb
image: bunkerity/bunkerweb
securityContext:
runAsUser: 101
runAsGroup: 101
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
2021-08-10 17:04:17 +02:00
ports:
- containerPort: 8080
hostPort: 80
- containerPort: 8443
hostPort: 443
env:
- name: KUBERNETES_MODE
value: "yes"
2022-06-03 17:24:14 +02:00
# replace with your DNS resolvers
# e.g. : kube-dns.kube-system.svc.cluster.local
- name: DNS_RESOLVERS
value: "coredns.kube-system.svc.cluster.local"
2021-08-10 17:04:17 +02:00
- name: USE_API
value: "yes"
2022-06-03 17:24:14 +02:00
# 10.0.0.0/8 is the cluster internal subnet
- name: API_WHITELIST_IP
value: "127.0.0.0/8 10.0.0.0/8"
2021-08-10 17:04:17 +02:00
- name: SERVER_NAME
value: ""
- name: MULTISITE
value: "yes"
2022-06-03 17:24:14 +02:00
livenessProbe:
exec:
command:
- /opt/bunkerweb/helpers/healthcheck.sh
initialDelaySeconds: 30
periodSeconds: 5
timeoutSeconds: 1
failureThreshold: 3
readinessProbe:
exec:
command:
- /opt/bunkerweb/helpers/healthcheck.sh
initialDelaySeconds: 30
periodSeconds: 1
timeoutSeconds: 1
failureThreshold: 3
2021-08-10 17:04:17 +02:00
---
apiVersion: v1
kind: Service
metadata:
2022-06-03 17:24:14 +02:00
name: svc-bunkerweb
2021-08-10 17:04:17 +02:00
spec:
clusterIP: None
selector:
2022-06-03 17:24:14 +02:00
app: bunkerweb
2021-08-10 17:04:17 +02:00
```
2022-06-03 17:24:14 +02:00
In order to store persistent data, you will need a [PersistentVolumeClaim](https://kubernetes.io/docs/concepts/storage/persistent-volumes/) :
2021-08-10 17:04:17 +02:00
```yaml
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
2022-06-03 17:24:14 +02:00
name: pvc-bunkerweb
spec:
accessModes:
2022-06-03 17:24:14 +02:00
- ReadWriteOnce
resources:
requests:
storage: 5Gi
2022-06-03 17:24:14 +02:00
```
Now, you can start the autoconf as a single replica [Deployment](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/) :
```yaml
2021-08-10 17:04:17 +02:00
apiVersion: apps/v1
kind: Deployment
metadata:
2022-06-03 17:24:14 +02:00
name: bunkerweb-controller
2021-08-10 17:04:17 +02:00
spec:
replicas: 1
2022-06-03 17:24:14 +02:00
strategy:
type: Recreate
2021-08-10 17:04:17 +02:00
selector:
matchLabels:
2022-06-03 17:24:14 +02:00
app: bunkerweb-controller
2021-08-10 17:04:17 +02:00
template:
metadata:
labels:
2022-06-03 17:24:14 +02:00
app: bunkerweb-controller
2021-08-10 17:04:17 +02:00
spec:
2022-06-03 17:24:14 +02:00
serviceAccountName: sa-bunkerweb
volumes:
2022-06-03 17:24:14 +02:00
- name: vol-bunkerweb
persistentVolumeClaim:
2022-06-03 17:24:14 +02:00
claimName: pvc-bunkerweb
2021-08-10 17:04:17 +02:00
containers:
2022-06-03 17:24:14 +02:00
- name: bunkerweb-controller
image: bunkerity/bunkerweb-autoconf
imagePullPolicy: Always
2021-08-10 17:04:17 +02:00
env:
- name: KUBERNETES_MODE
value: "yes"
volumeMounts:
2022-06-03 17:24:14 +02:00
- name: vol-bunkerweb
mountPath: /data
2021-08-10 17:04:17 +02:00
```
Once the BunkerWeb Kubernetes stack is setup and running (see autoconf logs for more information), you can now deploy web applications in the cluster and declare your Ingress resource. Please note that [settings](/1.4/settings) need to be set as annotations for the Ingress resource with the special value **bunkerweb.io** for the domain part :
2021-08-10 17:04:17 +02:00
```yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
2022-06-03 17:24:14 +02:00
name: ingress
2021-08-10 17:04:17 +02:00
annotations:
2022-06-03 17:24:14 +02:00
bunkerweb.io/MY_SETTING_1: "value1"
bunkerweb.io/MY_SETTING_2: "value2"
2021-08-10 17:04:17 +02:00
spec:
rules:
2022-06-03 17:24:14 +02:00
...
2021-08-10 17:04:17 +02:00
```
2022-06-03 17:24:14 +02:00
## Linux
2021-08-10 17:04:17 +02:00
2022-06-03 17:24:14 +02:00
<figure markdown>
![Overwiew](assets/img/integration-linux.svg){ align=center }
<figcaption>Linux integration</figcaption>
</figure>
2021-08-10 17:04:17 +02:00
2022-06-03 17:24:14 +02:00
List of supported Linux distros :
2021-08-10 15:01:03 +02:00
2022-06-03 17:24:14 +02:00
- Debian 11 "Bullseye"
- Ubuntu 22.04 "Jammy"
- Fedora 36
- CentOS Stream 8
2021-08-10 21:13:17 +02:00
2022-06-03 17:24:14 +02:00
Please note that you will need to **install NGINX 1.20.2 before BunkerWeb**. The installation is not covered in this documentation but you need to use prebuilt packages from the NGINX official repository as described [here](https://nginx.org/en/linux_packages.html). If you are on Fedora, you can use the prebuilt packages from the Fedora repository.
2021-08-10 21:13:17 +02:00
2022-06-03 17:24:14 +02:00
Repositories of Linux packages for BunkerWeb are available on [PackageCloud](https://packagecloud.io/bunkerity/bunkerweb), they provide a bash script to automatically add and trust the repository (but you can also follow the [manual installation](https://packagecloud.io/bunkerity/bunkerweb/install) instructions if you prefer) :
2021-08-10 21:13:17 +02:00
2022-06-03 17:24:14 +02:00
=== "Debian"
2021-08-10 21:13:17 +02:00
2022-06-03 17:24:14 +02:00
```shell
curl -s https://packagecloud.io/install/repositories/bunkerity/bunkerweb/script.deb.sh | sudo bash && \
apt update && \
apt install -y bunkerweb
```
2021-08-10 21:13:17 +02:00
2022-06-03 17:24:14 +02:00
=== "Ubuntu"
2021-08-10 21:13:17 +02:00
2022-06-03 17:24:14 +02:00
```shell
curl -s https://packagecloud.io/install/repositories/bunkerity/bunkerweb/script.deb.sh | sudo bash && \
apt update && \
apt install -y bunkerweb
```
2021-08-10 21:13:17 +02:00
2022-06-03 17:24:14 +02:00
=== "Fedora"
2021-08-10 21:13:17 +02:00
2022-06-03 17:24:14 +02:00
```shell
curl -s https://packagecloud.io/install/repositories/bunkerity/bunkerweb/script.rpm.sh | sudo bash && \
dnf check-update && \
dnf install -y bunkerweb
```
2021-08-10 21:13:17 +02:00
2022-06-03 17:24:14 +02:00
=== "CentOS Stream"
2021-08-10 21:13:17 +02:00
2022-06-03 17:24:14 +02:00
```shell
dnf install -y epel-release && \
curl -s https://packagecloud.io/install/repositories/bunkerity/bunkerweb/script.rpm.sh | sudo bash && \
dnf check-update && \
dnf install -y bunkerweb
```
Configuration of BunkerWeb is done by editing the `/opt/bunkerweb/variables.env` file :
```conf
MY_SETTING_1=value1
MY_SETTING_2=value2
...
2021-08-10 21:13:17 +02:00
```
2022-06-03 17:24:14 +02:00
BunkerWeb is managed using systemctl :
- Check BunkerWeb status : `systemctl status bunkerweb`
- Reload the configuration : `systemctl reload bunkerweb`
- Start it if it's stopped : `systemctl start bunkerweb`
- Stop it if it's started : `systemctl stop bunkerweb`
- And restart : `systemctl restart bunkerweb`