Skip to main content

Migrating Nextcloud to Docker

I migrated from mariadb to postgres. All my other containers use postgres so I felt it would be better for my maintenance needs to have everything on postgres.

docker-compose.yaml

version: '2'

services:
  db:
    image: postgres:alpine
    restart: always
    ports:
      - 127.0.0.1:5432
    volumes:
      - db:/var/lib/postgresql/data
    env_file:
      - db.env

  app:
    image: nextcloud:apache
    restart: always
    ports:
      - 8080:80
    volumes:
      - nextcloud:/var/www/html
    environment:
      - POSTGRES_HOST=db
    env_file:
      - db.env
    depends_on:
      - db

volumes:
  db:
  nextcloud:

db.env

POSTGRES_PASSWORD=my-super-good-password
POSTGRES_DB=nextclouddb
POSTGRES_USER=nextcloud
docker-compose up -d

sudo -u www-data php occ db:convert-type --all-apps --password "my-super-good-password" pgsql nextcloud localhost nextclouddb

sudo docker-compose exec --user www-data app php /var/www/html/occ upgrade

Comments