grocy / grocy-docker

ERP beyond your fridge - now containerized - this is the docker repo of https://github.com/grocy/grocy
MIT License
406 stars 117 forks source link

grocy/grocy-docker or linuxserver/grocy #200

Closed mx2k closed 1 year ago

mx2k commented 1 year ago

Hello, I am using the linuxserver/grocy docker package, but this seems not the official Grocy docker image. I wanted to switch to official repository but am running into issues deploying my stack.

It says in the readme run docker-compose with the downloaded docker-compose.yaml file. Since I am using Portainer to deploy my stacks on my Docker running on a NAS there is no SSH access for CLI commands to deploy things.

Do i need to do more than copy the contents from the docker-compose.yaml to my Portainer stack editor and click on deploy? This doesn't work for some reason. (but it works with linuxserver.io stack)

Currently, I start grocy this way. I do not understand how to adapt my docker-compose to the one provide here in the official repository.

version: "3"

services:
  grocy:
    image: lscr.io/linuxserver/grocy:latest
    container_name: grocy
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Berlin
      - GROCY_CULTURE=de
      - MAX_UPLOAD=50M
      - PHP_MAX_FILE_UPLOAD=200
      - PHP_MAX_POST=100M
      - PHP_MEMORY_LIMIT=512M
    volumes:
      - /volume1/docker/grocy-data:/config
    ports:
      - 8080:80
    restart: unless-stopped
jayaddison commented 1 year ago

Hi @mx2k - thanks for writing. I haven't used Portainer in the past, but will try to help.

A current difference between linuxserver's containerization and grocy-docker is that grocy-docker runs two separate containers -- one for static web content, and one for the dynamic PHP app (and database storage).

Another factor to consider is that the data stored within your existing container would need to be migrated to the grocy-docker backend container.

In all cases: I would recommend taking a backup of your data before making any changes, and attempt to practice any migrations in a secondary/test environment before applying the same approach to your main system.

If there are any reasons you're looking to migrate, I'd be grateful to learn those -- and perhaps we could start to build documentation and knowledge about the migration process.

I'll also note that linuxserver seems well maintained and widely deployed -- and I don't know of any technical reasons that it is any better/worse than grocy-docker. So I would caution against making infrastructure changes unless you're sure you want to.

mx2k commented 1 year ago

Hi and thanks for the quick reply. I sort of want to do the migration because I am learning docker stacks at the moment and the official image provides a "real" stack with more than one container started.

As for the manual: Maybe it is assumed common knowledge, but for me an intro sentence like 1. clone the repository to your computer 2. do docker-compose up etc., 3. do not only download .yaml file, it will not work would have proven useful.

The linuxserver image is the same 3.3.2 version and it feels just a bit more newbie friendly approach (nice for people who want one container only setup for grocy).

Clicking further through the Portainer settings, there seems an option to clone a git repository and start that as a stack. I think this is the way it is intended to work with Github sources (also new to this platform), as my approach with copy/paste to the Portainer web editor is only good if you do not require to read more related files like containerfile-frontend etc. I am going to test how that works soon.

There would be one thing I need to migrate, my current DB and settings reside at a bind mount

    volumes:
      - /volume1/docker/grocy-data:/config

Now the volumes setup of the frontend/backend container looks just a bit more complicated than that. Which would be the relevant volume to change within docker-compose.yaml to make Grocy read existing DB and settings from /volume1/docker/grocy-data

jayaddison commented 1 year ago

Now the volumes setup of the frontend/backend container looks just a bit more complicated than that. Which would be the relevant volume to change within docker-compose.yaml to make Grocy read existing DB and settings from /volume1/docker/grocy-data

In the past I've seen and understood the steps required to hot-swap hard drives on running Linux systems, with subsequent dynamic resizing of filesystems that span multiple disks to make use of the additional storage space -- all with zero downtime of the host machine.

However: I can never remember how volumes work in Docker -- so my best response for this at the moment is that the relevant grocy-docker volume should have app-db in the name.

If you can populate the relevant app-db volume with the Grocy data from your linuxserver equivalent -- and remove the viewdata cache, and make sure that user www-data (uid:82) is the owner of those files, then you should be set.

(not super easy -- it may require some trial and error -- but very possible, I think)

jayaddison commented 1 year ago

Using restart: unless-stopped in the docker-compose.yml file in grocy-docker makes sense too, I think -- I ran into some issues when following the upgrade steps without that in place (I've generally used a few custom deployment commands, but I think it's worthwhile to try to streamline and document the process).

jayaddison commented 1 year ago

copy/paste to the Portainer web editor is only good if you do not require to read more related files like containerfile-frontend

@mx2k After re-reading this part of your message: yep, that makes sense, thank you :+1:

Is copy-pasting docker-compose.yml to Portainer a frequently-used (and/or recommended) method of deployment?

My understanding is that there are many tools like Portainer to run and manage containers, so I'm slightly reluctant to begin documenting the process for each of those. It'd be good for that documentation to exist, but best for it to exist where there's a knowledgeable supporting community around it.

jayaddison commented 1 year ago

@mx2k could you let me know whether you made any progress attempting migration from linuxserver/grocy to grocy/grocy-docker?

I've learned a few more things about volumes (Docker and otherwise) thanks to this issue, and perhaps it'd be worthwhile to continue the effort to create a migration guide.

jayaddison commented 1 year ago

Closing this ticket as old/stale - feel free to add further details though @mx2k, and I can re-open if still relevant.