this post was submitted on 28 Mar 2024
9 points (100.0% liked)

nextcloud

722 readers
1 users here now

Nextcloud is a suite of client-server software for creating and using file hosting services.

https://nextcloud.com/

https://github.com/nextcloud

IRC: #nextcloud on libera.chat
Matrix: #nextcloud:matrix.org

Other Nextcloud communities on Lemmy

founded 4 years ago
MODERATORS
 

I installed NextCloud previously and it sucked. Most of it, in my mind was down to how slow and clunky it felt. I came here and people said the default installation can be like that, so I kinda just left things alone, determined that I would eventually come back and sort things.

Fast forward to now and my system has matured enough, well at least enough that I've installed Postgres and can access it via Adminer.

So I clear out all my directories, delete the container and decide it's time to reinstall NextCloud. Simple right? Wrong! It's telling me that I have the wrong username and password.

I asked for some help and someone said, don't give any app default access and that's fair and then they pointed me to the docs. The docs said to do some shit I didn't understand really. But from what I could gather, essentially open the console and run a command.

Problem! Every time I try and open the console for the container, it says it can't read the image details. Okay, let's work around that then. I open up Adminer and via SQL command run:

CREATE USER nextcloud WITH PASSWORD 'R4ND0MP4SS' CREATEDB;
CREATE DATABASE nextcloud TEMPLATE template0 ENCODING 'UTF8';
ALTER DATABASE nextcloud OWNER TO nextcloud;
GRANT ALL PRIVILEGES ON DATABASE nextcloud TO nextcloud;
GRANT ALL PRIVILEGES ON SCHEMA public TO nextcloud;

I actually manage to log into Adminer with said details. NextCloud on the other hand is telling me that the username and/or password is incorrect. What am I doing wrong?

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 2 points 7 months ago (1 children)

You know you're awesome right?

services:
    db:
        container_name: db
        image: postgres
        restart: always
        environment:
            - "POSTGRES_USER=postgres"
            - "POSTGRES_PASSWORD=NOTMYREALPASS"
            - "POSTGRES_DB=nextcloud_db"
        ports:
            - "5432:5432"
        volumes:
            - "/opt/postgres/data:/var/lib/postgresql/data"
    nextcloud:
        image: lscr.io/linuxserver/nextcloud:latest
        container_name: nextcloud
        environment:
            - "PUID=1000"
            - "PGID=1000"
            - "TZ=Europe/London"
            - "POSTGRES_DB=nextcloud_db"
            - "POSTGRES_HOST=db"

I just copied and pasted, what you wrote, but I'm noticing that in the compose, you're basically making the database NextCloud dedicated, rather than giving it a table. Is that best practice? Sorry if it seems a basic question, I'm still very much in my learning phase.

[–] [email protected] 2 points 7 months ago (1 children)

Yes nextcloud requires the entire database. You could try moving all of your bind mounted dirs to a single dir for the entire compose stack so you dont mix it up with other postgresql containers you may use in the future. So like /opt/nextcloud/db/data:/var/lib/postgresql/data

Personally I like to use volumes for databases.

[–] [email protected] 2 points 7 months ago (1 children)

I really need to thank you. Truly I learned so much from you and I'm extremely grateful. My database works properly now. Thank you!