# Vikunja Setup

<div style="text-align: right;">Antoine de Barbarin</div>

---


Download the RPM image of Vikunja and install it using the `dnf` package manager

```bash
wget https://dl.vikunja.io/vikunja/0.24.6/vikunja-0.24.6-x86_64.rpm
dnf install ./vikunja-0.24.6-x86_64.rpm
```

In the configuration file of Vikunja, change the database to `postgres` with user `vikunja`, the correct password, the IP address and the name of the database `vikunja`.

```bash
vim /etc/vikunja/config.yml
```



#### Example: 

```yaml
database:
  # Database type to use. Supported values are mysql, postgres and sqlite. Vikunja is able to run with MySQL 8.0+, Mariadb 10.2+, PostgreSQL 12+, and sqlite.
  type: "postgres"
  # Database user which is used to connect to the database.
  user: "vikunja"
  # Database password
  password: "<password>"
  # Database host
  host: "172.17.0.6"
  # Database to use
  database: "vikunja"
  # When using sqlite, this is the path where to store the data
  #path: "./vikunja.db"
  # Sets the max open connections to the database. Only used when using mysql and postgres.
  maxopenconnections: 100
  # Sets the maximum number of idle connections to the db.
  maxidleconnections: 50
  # The maximum lifetime of a single db connection in milliseconds.
  maxconnectionlifetime: 10000
  # Secure connection mode. Only used with postgres.
  # (see https://pkg.go.dev/github.com/lib/pq?tab=doc#hdr-Connection_String_Parameters)
  sslmode: disable
  # The path to the client cert. Only used with postgres.
sslcert: ""
  # The path to the client key. Only used with postgres.
  sslkey: ""
  # The path to the ca cert. Only used with postgres.
  sslrootcert: ""
  # Enable SSL/TLS for mysql connections. Options: false, true, skip-verify, preferred
  tls: false
```

Log in the PostgreSQL Server VM and modify some configuration files (`postgresql.conf` and `pg_hba.conf`)

```bash
vim /var/lib/pgsql/17/data/postgresql.conf
vim /var/lib/pgsql/17/data/pg_hba.conf
```

In `postgresql.conf`, set `listen_addresses` to `172.17.0.6`, the IP address of the PostgreSQL server. 
In `pg_hba.conf`, add the two following lines at the end of the file: 

```
host    vikunja         vikunja         172.16.0.2/32            scram-sha-256
host    vikunja         vikunja         172.16.0.3/32            scram-sha-256
```

That way, both webservers will be able to connect to the `vikunja` database with the `vikunja` user.