๐Ÿ‡
RaspberryPI Home Server
  • ๐Ÿ Home
  • ๐Ÿ› ๏ธSettings
    • โš™๏ธGPIO and Fan Controller
    • โšกPower Optimization
    • ๐Ÿ›ก๏ธUncomplicated Firewall
    • ๐Ÿ“ƒManual Steps
  • ๐Ÿ”ฎServices
    • ๐Ÿ”€Traefik Proxy
    • ๐ŸกHomer
    • ๐Ÿ–ฅ๏ธMonitoring
    • ๐ŸŽž๏ธJellyfin
    • ๐Ÿ’ฝDatabases
    • โ˜๏ธNextcloud
      • ๐Ÿ’ชUpgrade
      • โ™ป๏ธRestore
      • ๐Ÿ“ฆBackup
    • ๐ŸฅงPihole
    • ๐Ÿ›ณ๏ธPortainer
    • ๐Ÿ—ƒ๏ธFile Browser
    • ๐Ÿ”ŽSearXNG
    • ๐Ÿ“ฅTorrent Stack
      • ๐ŸฅทWireguard
      • ๐ŸŽฅRadarr
      • ๐Ÿ“ฝ๏ธSonarr
      • ๐ŸงฅJackett
  • ๐Ÿ‘‰Tip and Tricks
    • ๐Ÿ”ตBluetooth
    • ๐Ÿ’ฝDisk Configurations
Powered by GitBook
On this page
  • Deploy
  • Secrets
  • Create database

Was this helpful?

  1. Services

Databases

PreviousJellyfinNextNextcloud

Last updated 2 years ago

Was this helpful?

Databases kept in separate docker stack and network, because there might be other services uses databases. Currently there are 2 databases being used by Nextcloud

  • Postgresql

  • Redis

Deploy

Make surenetwork_databases is created. Know more in section

$ git clone git@github.com:veerendra2/raspberrypi-homeserver.git
$ cd raspberrypi-homeserver/services/databases
$ docker stack deploy -c docker-stack.yml databases

Secrets

Databases passwords are stored docker secrets which are defined in the stack.

$ docker secret ls
ID                          NAME                                 DRIVER    CREATED              UPDATED
iwf1jjhfc1wd2hzftp8f41247   databases_postgres_password                    6 minutes ago        6 minutes ago
a6cm47sv3lzkj7936gqrblv1f   databases_postgres_user                        6 minutes ago        6 minutes ago
nf17rcx3nqdv34cpa6m89bws5   databases_redis_host_password                  6 minutes ago        6 minutes ago

For example, you can use databases secrets in other stack like below

```
version: '3'

secrets:
  db_user:
    external: true
  db_password:
    external: true

services:
  postgres_db:
  image: postgres
  secrets:
    - db_user
    - db_password
```

Create database

Default user trinity and nextcloud database create during startup. If required create databases manually for other services

# Find the postgres container
$ docker ps | grep postgres
$ docker exec -it --user postgres [CONTAINER_ID] /bin/sh
$ psql -U veerendra

Run below sql command to create database(If required, create user too)

CREATE USER suma WITH ENCRYPTED PASSWORD 'mypass';
CREATE DATABASE mydb;
GRANT ALL PRIVILEGES ON DATABASE mydb TO suma;
๐Ÿ”ฎ
๐Ÿ’ฝ
Page cover image
Traefik
raspberrypi-homeserver/services/databases at main ยท veerendra2/raspberrypi-homeserverGitHub
Databases stack
Logo