Any luck using cockroachdb with nextcloud (in docker)

I’m trying something along the lines of this but am having trouble with the initial ‘install’ step where you create an admin user. I end up with an internal error. I can see in the cockroachdb UI that the nextcloud db is being created and it even appears to get populated a little at some point. But I keep getting the " Internal Server Error

The server was unable to complete your request.

If this happens again, please send the technical details below to the server administrator.

More details can be found in the server log."

version: "3.5"

volumes:
  nextcloud:
  db:

services:
  db:
    container_name: db
    hostname: 'db'
    image: cockroachdb/cockroach:v22.1.5
    restart: always
    volumes:
      - db:/cockroach/cockroach-data
    environment:
      #- COCKROACH_DATABASE=nextcloud 
      - COCKROACH_USER=nextcloud
      - COCKROACH_PASSWORD=password
    networks:
      - default
    ports:
      - '26257:26257'
      - '8081:8080'
    command: start-single-node  --accept-sql-without-tls
    #command: start-single-node --insecure

  app:
    image: nextcloud
    restart: always
    ports:
      - 8080:80
    links:
      - db
    volumes:
      - nextcloud:/var/www/html
    networks:
      - default
    depends_on:
      - db
    environment:
      - POSTGRES_HOST=db:26257
      - POSTGRES_DB=nextcloud
      - POSTGRES_USER=nextcloud
      - POSTGRES_PASSWORD=password


networks:
  default:
    name: roachnet
    external: true
1 Like

This is how I configured CockroachDB for Nextcloud (so far)

./docker-compose.yml

...
  db:
    image: cockroachdb/cockroach:latest
    command: >-
      start-single-node
      --sql-addr :5432
    #   --vmodule=exec_log=2

    # entrypoint: "bash -x cockroach.sh start-single-node --sql-addr :5432"
    restart: always

    volumes:
      - database_data:/cockroach/cockroach-data
      - ./cockroachdb-init-scripts:/docker-entrypoint-initdb.d

    environment:
      COCKROACH_DATABASE: "${MYSQL_DATABASE}"
      COCKROACH_USER: "${MYSQL_USER}"
      COCKROACH_PASSWORD: "${MYSQL_PASSWORD}"
...

The file ./cockroachdb-init-scripts/postgresql-compatibility.sh is used to change the default config of the CockroachDB server so that it can work with Nextcloud.
More Info: Internal Server Error on first launch - lastval() issue? - #2 by dvaerum

./cockroach sql --url="$(cat server.url)" \
    --execute 'SET CLUSTER SETTING sql.defaults.serial_normalization = "virtual_sequence";'

./cockroach sql --url="$(cat server.url)" \
    --execute "DROP DATABASE IF EXISTS ${COCKROACH_DATABASE}; CREATE DATABASE ${COCKROACH_DATABASE};"

I am still playing around with this, so there be more compatibility bug to fix :wink:

Update:
I am stuck because of CockroachDB’s incompatibility with PostgreSQL, I created a bug for this, but it really does not look like something they will fix :cry:

This means that you cannot delete files in Nextcloud using CockroachDB :cry: