Skip to content

Quickstart guide

Prerequisites

We assume that you're already familiar with the core concepts and you have followed the integrations instructions for your environment.

Going further

To demonstrate the use of BunkerWeb, we will deploy a basic stack using the setup wizard as an example. See the examples folder of the repository to get real-world examples.

Protecting existing web applications already accessible with the HTTP(S) protocol is the main goal of BunkerWeb : it will act as a classical reverse proxy with extra security features.

Basic setup

When using Docker integration, the easiest way of protecting an existing application is to add the web service in the bw-services network and then configure them in the web interface :

x-bw-env: &bw-env
  # We use an anchor to avoid repeating the same settings for both services
  API_WHITELIST_IP: "127.0.0.0/8 10.20.30.0/24" # Make sure to set the correct IP range so the scheduler can send the configuration to the instance
  DATABASE_URI: "mariadb+pymysql://bunkerweb:changeme@bw-db:3306/db" # Remember to set a stronger password for the database

services:
  bunkerweb:
    # This is the name that will be used to identify the instance in the Scheduler
    image: bunkerity/bunkerweb:1.6.0-rc2
    ports:
      - "80:8080/tcp"
      - "443:8443/tcp"
      - "443:8443/udp" # For QUIC / HTTP3 support
    environment:
      <<: *bw-env # We use the anchor to avoid repeating the same settings for all services
    restart: "unless-stopped"
    networks:
      - bw-universe
      - bw-services

  bw-scheduler:
    image: bunkerity/bunkerweb-scheduler:1.6.0-rc2
    environment:
      <<: *bw-env
      BUNKERWEB_INSTANCES: "bunkerweb" # Make sure to set the correct instance name
      SERVER_NAME: ""
      MULTISITE: "yes"
      UI_HOST: "http://bw-ui:7000" # Change it if needed
    volumes:
      - bw-data:/data # This is used to persist the cache and other data like the backups
    restart: "unless-stopped"
    networks:
      - bw-universe
      - bw-db

  bw-ui:
    image: bunkerity/bunkerweb-ui:1.6.0-rc2
    environment:
      <<: *bw-env
    restart: "unless-stopped"
    networks:
      - bw-universe
      - bw-db

  bw-db:
    image: mariadb:11
    environment:
      MYSQL_RANDOM_ROOT_PASSWORD: "yes"
      MYSQL_DATABASE: "db"
      MYSQL_USER: "bunkerweb"
      MYSQL_PASSWORD: "changeme" # Remember to set a stronger password for the database
    volumes:
      - bw-db:/var/lib/mysql
    restart: "unless-stopped"
    networks:
      - bw-db

volumes:
  bw-data:
  bw-db:


networks:
  bw-universe:
    name: bw-universe
    ipam:
      driver: default
      config:
        - subnet: 10.20.30.0/24 # Make sure to set the correct IP range so the scheduler can send the configuration to the instance
  bw-services:
    name: bw-services
  bw-db:
    name: bw-db

We will assume that you already have the Docker autoconf integration stack running on your machine.

🧙🪄 If you want an example using the web interface, you can follow the Autoconf Wizard documentation (this is an optional step).

Deprecated

The Swarm integration is deprecated and will be removed in a future release. Please consider using the Docker autoconf integration instead.

More information can be found in the Swarm integration documentation.

🧙🪄 If you want an example using the web interface, you can follow the Swarm Wizard documentation (this is an optional step).

We will assume that you already have the Swarm integration stack running on your cluster and connected to a network called bw-services so you can connect your existing application and configure BunkerWeb with labels (as explained in the Creating a new service section).

We will assume that you already have the Kubernetes integration stack running on your cluster.

🧙🪄 If you want an example using the web interface, you can follow the Kubernetes Wizard documentation (this is an optional step).

We will assume that you already have the Linux integration stack running on your machine.

🧙🪄 If you don't want to use the setup wizard, you will need to run the following command export UI_WIZARD=no before installing BunkerWeb as described in integrations section of the documentation (this is an optional step).

Let's check the status of BunkerWeb :

systemctl status bunkerweb

Now let's check the status of the Scheduler :

systemctl status bunkerweb-scheduler

If they are already running, we can reload them :

systemctl reload bunkerweb bunkerweb-scheduler

Otherwise, we will need to start them :

systemctl start bunkerweb bunkerweb-scheduler

Accessing the setup wizard

Accessing the setup wizard

You can access the setup wizard by browsing the https://your-ip-address/setup URI of your server.

If you didn't run the setup wizard, you can ignore this step.

Create an Administrator account

You should see a setup page just like this one :

Setup Wizard landing page

Setup Wizard landing page

Once you're on the setup page, you can enter the administrator username, email, and password and click on the "Next" button.

Configure the Reverse Proxy and HTTPS

The next step will ask you to enter the server name that the web UI will use. You can also choose to enable Let's Encrypt or use a custom certificate.

Setup Wizard step 2

Setup Wizard step 2

Overview of your settings

The last step will give you an overview of the settings you've entered. You can click on the "Setup" button to complete the setup.

Setup Wizard final step

Setup Wizard final step

Accessing the web interface

You can now access the web interface by browsing to the domain you configured in the previous step and the URI if you changed it (default is https://your-domain/).

Web interface login page

Web interface login page

You can now log in with the administrator account you created during the setup wizard.

Web interface home

Web interface home

Creating a new service

You can create a new service by navigating to the Services section of the web interface and clicking on the ➕ Create new service button.

Their are multiple ways of creating a service using the web interface :

  • The Easy mode will guide you through the process of creating a new service.
  • The Advanced mode will allow you to configure the service with more options.
  • The Raw mode will allow you to enter the configuration directly like editing the variables.env file.

Draft service

You can create a draft service to save your progress and come back to it later. Just click on the 🌐 Online button to toggle the service to draft mode.

In this mode, you can choose among the available templates and fill in the required fields.

Web interface create service easy
Web interface create service easy

  • To navigate between the different plugins, you can use the dropdown menu on the top left corner of the page.
  • Once you've selected the template, you can fill in the required fields and follow the instructions to create the service.
  • Once you're done configuring the service, you can click on the 💾 Save button to save the configuration.

In this mode, you can configure the service with more options while seeing all the available settings from all the different plugins.

Web interface create service advanced
Web interface create service advanced

  • To navigate between the different plugins, you can use the dropdown menu on the top left corner of the page.
  • Each setting has a small piece of information that will help you understand what it does.
  • Once you're done configuring the service, you can click on the 💾 Save button to save the configuration.

In this mode, you can enter the configuration directly like editing the variables.env file.

Web interface create service RAW
Web interface create service RAW

  • Once you're done configuring the service, you can click on the 💾 Save button to save the configuration.

🚀 Once you've saved the configuration, you should see your new service in the list of services.

Web interface services page
Web interface services page

If you wish to edit the service, you can click on the service name or the 📝 Edit button.

We will assume that you followed the Basic setup and you have the Docker integration running on your machine.

You must then have a network called bw-services so you can connect your existing application and configure BunkerWeb:

services:
  myapp:
      image: nginxdemos/nginx-hello
      networks:
        - bw-services

networks:
  bw-services:
    external: true
    name: bw-services

After that, you can create manually add the service in the docker compose file that you created in the previous step.

...

services:
  ...
  bw-scheduler:
    ...
    environment:
      ...
      SERVER_NAME: "www.example.com" # When using the Docker integration, you can set the configuration directly in the scheduler, make sure to set the correct domain name
      MULTISITE: "yes" # Enable multisite mode so you can add multiple services
      www.example.com_USE_REVERSE_PROXY: "yes"
      www.example.com_REVERSE_PROXY_URL: "/"
      www.example.com_REVERSE_PROXY_HOST: "http://myapp:8080"
      ...

You can then restart the bw-scheduler service to apply the changes.

docker compose down bw-scheduler && docker compose up -d bw-scheduler

We will assume that you followed the Basic setup and you have the Docker autoconf integration running on your machine.

You must then have a network called bw-services so you can connect your existing application and configure BunkerWeb with labels :

services:
  myapp:
      image: nginxdemos/nginx-hello
      networks:
        - bw-services
      labels:
        - "bunkerweb.SERVER_NAME=www.example.com"
        - "bunkerweb.USE_REVERSE_PROXY=yes"
        - "bunkerweb.REVERSE_PROXY_URL=/"
        - "bunkerweb.REVERSE_PROXY_HOST=http://myapp:8080"

networks:
  bw-services:
    external: true
    name: bw-services

Doing so will automatically create a new service with the provided labels as configuration.

Deprecated

The Swarm integration is deprecated and will be removed in a future release. Please consider using the Docker autoconf integration instead.

More information can be found in the Swarm integration documentation.

We will assume that you followed the Basic setup and you have the Swarm stack running on your cluster and connected to a network called bw-services so you can connect your existing application and configure BunkerWeb with labels :

services:
  myapp:
    image: nginxdemos/nginx-hello
    networks:
      - bw-services
    deploy:
      placement:
        constraints:
          - "node.role==worker"
      labels:
      - "bunkerweb.SERVER_NAME=www.example.com"
      - "bunkerweb.USE_REVERSE_PROXY=yes"
      - "bunkerweb.REVERSE_PROXY_URL=/"
      - "bunkerweb.REVERSE_PROXY_HOST=http://myapp:8080"

networks:
  bw-services:
    external: true
    name: bw-services

We will assume that you followed the Basic setup and you have the Kubernetes stack running on your cluster.

Let's assume that you have a typical Deployment with a Service to access the web application from within the cluster :

apiVersion: apps/v1
kind: Deployment
metadata:
  name: app
  labels:
    app: app
spec:
  replicas: 1
  selector:
    matchLabels:
      app: app
  template:
    metadata:
      labels:
        app: app
    spec:
      containers:
      - name: app
        image: nginxdemos/nginx-hello
        ports:
        - containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
  name: svc-app
spec:
  selector:
    app: app
  ports:
    - protocol: TCP
      port: 80
      targetPort: 8080

Here is the corresponding Ingress definition to serve and protect the web application :

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress
  annotations:
    bunkerweb.io/DUMMY_SETTING: "value"
spec:
  rules:
    - host: www.example.com
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
              name: svc-app
              port:
                number: 80

We will assume that you followed the Basic setup and you have the Linux integration running on your machine.

You can create a new service by editing the variables.env file located in the /etc/bunkerweb/ directory.

nano /etc/bunkerweb/variables.env

You can then add the following configuration :

SERVER_NAME=www.example.com
MULTISITE=yes
www.example.com_USE_REVERSE_PROXY=yes
www.example.com_REVERSE_PROXY_URL=/
www.example.com_REVERSE_PROXY_HOST=http://myapp:8080

You can then reload the bunkerweb-scheduler service to apply the changes.

systemctl reload bunkerweb-scheduler