Setting up a wallabag Server

Introduction

This tutorial will explain how to set up a wallabag Server.

Environment

Hardware amd64 VPS
OS Debian 10 Buster

Dependencies

  1. Docker
  2. docker-compose
  3. Internet Domain

Step by Step Instructions

1. Add DNS entry to your domain.

A domain of your choice needs to point to the address of your server.

2. Change to root user

sudo -s

3. Installation of additional Dependencies

apt update
apt install -y certbot nginx

4. Create wallabag user and add persistence

useradd --system --create-home --shell /bin/bash --password <your-password-here> wallabag
mkdir /home/wallabag/data /home/wallabag/images /home/wallabag/redis
chown -R wallabag:wallabag /home/wallabag/data /home/wallabag/images /home/wallabag/redis

5. Configure NGINX server

Create and open vhost file:

cd /home/wallabag
nano /etc/nginx/sites-available/wallabag.domain.tld.vhost

Paste the following configuration into the file:

server {
  listen 80;
  server_name wallabag.domain.tld;
  client_max_body_size 0;

  if ($host != "wallabag.domain.tld") {
        return 444;
  }

  location ~* {
    proxy_pass http://127.0.0.1:8800;
    proxy_redirect default;
    proxy_set_header Host      $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Forwarded-Server $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

  }

  location ~ /.well-known/acme-challenge/ {
    allow all;
  }

}

Activate vhost file:

ln -s /etc/nginx/sites-available/wallabag.domain.tld.vhost /etc/nginx/sites-enabled/wallabag.domain.tld.vhost

Restart NGINX:

systemctl restart nginx

6. Create Let's Encrypt certificate for selfoss.domain.tld

https://certbot.eff.org/lets-encrypt/debianbuster-nginx

Restart NGINX:

systemctl restart nginx

7. Run server

Create and open docker-compose.yaml:

cd /home/wallabag
nano docker-compose.yaml

Paste the following configuration into the file:

version: '3'
services:
  wallabag:
    image: wallabag/wallabag
    container_name: wallabag
    links:
      - "wallabag_redis:wallabag_redis"
      - "wallabag_db:wallabag_db"
    environment:
      - 'POSTGRES_USER=<your-postgres-user>' # lowercase alphabetic
      - 'POSTGRES_PASSWORD=<your-postgres-password>'
      - 'SYMFONY__ENV__DATABASE_DRIVER=pdo_pgsql'
      - 'SYMFONY__ENV__DATABASE_DRIVER_CLASS=Wallabag\CoreBundle\Doctrine\DBAL\Driver\CustomPostgreSQLDriver'
      - 'SYMFONY__ENV__DATABASE_HOST=wallabag_db'
      - 'SYMFONY__ENV__DATABASE_PORT=5432'
      - 'SYMFONY__ENV__DATABASE_NAME=wallabag'
      - 'SYMFONY__ENV__DATABASE_USER=<your-postgres-user>' # lowercase alphabetic
      - 'SYMFONY__ENV__DATABASE_PASSWORD=<your-postgres-user-password>'
      - 'SYMFONY__ENV__DOMAIN_NAME=https://wallabag.domain.tld'
    ports:
      - "8800:80"
    volumes:
      - /home/wallabag/images:/var/www/wallabag/web/assets/images

  wallabag_db:
    image: postgres:9.6
    container_name: wallabag_db
    environment:
      - 'POSTGRES_USER=<your-postgres-user>'
      - 'POSTGRES_PASSWORD=<your-postgres-password>'
    volumes:
      - /home/wallabag/data:/var/lib/postgresql/data

  wallabag_redis:
    image: redis:alpine
    container_name: wallabag_redis
    volumes:
      - /home/wallabag/redis:/data

Make sure that all the users set in this file consist of lowercase alphabetic characters, only.

Run server:

docker-compose up -d

8. Create wallabag user

  1.  Visit wallabag.domain.tld .
  2. Register with a username and password.
  3. Do the following instead of waiting for an E-Mail that will never arrive:
docker exec -it wallabag sh
cd /var/www/wallabag
./bin/console fos:user:activate <your-wallabag-user> --env=prod
exit

Hint: You can repeat the process in line 3 to activate every newly created user.

Now log into your wallabag with the newly created user.

 

Sources