Need help with Docker-compose and mount point

Hello,

I’m completely new to grav, and not experienced with Docker or Docker-compose by any stretch of the imagination.

I promised I’d do a favour to a friend, and I built a website using grav and docker-compose. I followed the intructions on how to get started with grav, and had it running, just needed a few finished touches, before I could move it to a server and deploy it.

Alas, I did something to the docker-compose file that broke the image. Now when it runs, I am greeted by “set a new admin account” page.

However, I can see that I still have the files (outside docker) locally. They are under a folder app which in turn has pages and within it, I can see my actual pages. Now I admit, that it looks like a mess, because there’s stuff that is missing (aka pages I had finished) so I suspect that’s a snapshot of what I had done, but not the latest version of it. And, regrettably, I didn’t use git to commit and save the progress.

For example, under my app directory I can see www/user/pages/ which has empty new pages (01.home and 02.typography). At this point I accept I’ve lost all the work I did in the past few months, and I’ll have to recreate it.

What I am trying to understand and haven’t figured is:

  • where is grav expecting to find the data I’m mounting?
  • assuming I have a directory app outside docker, where should I mount it?

For example, when I bash into the running docker container, I see:

  • app/www/public (seems to be pointing to config)
  • config/www/user
  • var/www/html

So for example, assume the following docker-compose.yaml and a local directory app in the host system,

---
version: '3'
services:
  grav:
    image: lscr.io/linuxserver/grav:latest
    container_name: grav
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Etc/UTC
    volumes:
      - ./app:/config
    ports:
      - 80:80
    restart: unless-stopped


Should it be pointing to config???

Any help, hints and tips are greatly appreciated!

There’s contradictory stuff in what you’re saying here and some of it just doesn’t make sense. I’ll throw out some comments and questions. If you want to mess with things any more based on what you learn, please make a backup of any local files.

These two things can’t both be true.

That doesn’t mean the site is not there necessarily. If you have a site and install the Admin plugin, this page will appear when you try to hit any page. It’s forcing you to set an Admin user and password before you go any further. Otherwise you have a security problem. I don’t know how you might have got the Admin plugin, but that could be all it means.

Neither Docker or Grav are making snapshots. Grav might have been making complete, datestamped backups depending on how it was set up. But they would not have persisted unless you mounted its backup directory to a local directory and it looks like you didn’t (from looking at your docker-compose file).

Grav will have no idea it’s running in Docker. Which data are you talking about?

Do you have one or not? The docker-compose file shows that it’s mounted in the directory where you started docker-compose from (.). There you should find an app directory. The compose file shows that mapped to /config inside the container. So if you were to shell into the container, you would find the same files in /confg there as you have on your host at app under where you started compose.

I don’t know anything about that docker image you are using (lscr.io/linuxserver/grav:latest) and can’t imagine why it’s mounting /config. That means nothing in Grav but who knows what they’ve set up. Did you get that docker-compose file from their docs?

.. or did you write it yourself and are wondering if your mounts are correct as seen under volumes:?

I’m sorry I think I may have caused more confusion. It’s late here and I’m not going to dig into linuxserver’s Grav image. That is not the official image BTW. Normally you would mount Grav’s user directory somewhere on your host because that is the part of Grav that you want to persist/save.

I might be able to think of better questions leading us to progress tomorrow.

I probably should not have replied so quickly but your problem seemed desperate. I have an awful habit of checking this forum before sleeping!

What would help make things much clearer is if you describe exactly the steps you followed to set this up and any changes you made before you noticed you couldn’t find your work. If you followed advice or documentation you found somewhere, please try to link to it. Your account of what you did has too many gaps for anyone to follow.

Specifically I’m still wondering:

  • how did you edit your work? not which editor did you use, but which files and how did you access them? If they were on your local host, then it seems likely they still are.
  • do you know about the Grav folder structure?
  • do you know how docker container mounts work and how you would choose them?

Hi,
First of all thanks for the help, I really appreciate it. It’s not so much desperation, rather than frustration. I know the work is gone, I’m just annoyed with myself.

Here’s what I did:

  1. I initially followed the steps in the tutorial on how to setup grav with docker-compose. I had it running, and because I never shut down my PC, the container probably stayed up. When I eventually did reboot I lost it all.
  2. At some point, I must have edited the docker-compose.yaml for persistence which is how I probably ended up with that app folder outside docker. I say this, because I had another folder grav which was empty, so I know at some point I was messing around with it
  3. All editing was done through the WebUI of grav, I’d setup an admin account and then go to localhost and edit the pages.
  4. When I decided to have a go with the plugins I realised I needed to bash into the docker container, that’s the first time I started wondering about the directory structure. I used it to setup a gallery plugin.
  5. Recently, I tried adding another adjacent service to grav, I think sendmail or something similar. I bet that’s when I changed the docker-compose and I broke what I had.

So I have to rebuild it all, that’s ok, I’ve just lost a few late nights of work. But, I do want persistence, and I do want to understand the structure of grav and where files are saved. I appreciate I’m complicating things by using docker and docker–compose, but I’d rather learn this how to use it properly.

Therefore, assume I am now starting fresh.