How to run Grocy on


Grocy is an awesome app one can use to manage groceries, food stock, recipes, chores and more. It’s like a personal ERP, I am using it to hoard responsibly without wasting food and other household items.

Here’s how it looks like:


It is very easy to run Grocy on, and I will show you here what it takes. You can always fork this run-ready repo, and have it running in seconds.


You will need:

  • project, it can be development sized one too.


Clone your project locally first:

platform get <project id>

It should be fresh and empty project. Now, let’s add Grocy as submodule so we can upgrade easily when new version is released:

cd <project id>
git submodule add
git submodule init
git submodule update
cd grocy
git checkout v2.6.1
cd ..
git add .
git commit -am 'Added Grocy 2.6.1'

OK, latest Grocy is ready. Now, let’s add some info so knows how to run it. Grocy itself is not using any additional services, all the data is kept in a file, so let’s create empty .platform/services.yaml file:

# No need for services

Routes can be default ones, have this in .platform/routes.yaml:

    type: upstream
    upstream: "app:http"

    type: redirect
    to: "https://{default}/"

Good. Now, let’s create You can take complete file from here, but here we’ll cover it section by section.

Grocy, at the time this is written, needs PHP 7.2 so let’s use that:

name: 'app'
type: 'php:7.2'

It keeps all the data in single file with db extension it searches for in data/ directory. So, let’s give it writable permanent mount there:

disk: 512

        source: local
        source_path: 'data'

For build it only requires yarn around, so let’s get it:

    flavor: none

        yarn: "*"

Now, this is the build hook:

    build: |
        set -e
        mkdir -p www

        cd www
        ln -s ../data/data data
        cd ..

        mv grocy/public www
        mv grocy/controllers www
        mv grocy/helpers www
        mv grocy/localization www
        mv grocy/middleware www
        mv grocy/migrations www
        mv grocy/publication_assets www
        mv grocy/services www
        mv grocy/views www
        mv grocy/composer.* www
        mv grocy/.yarnrc www
        mv grocy/yarn.* www
        mv grocy/*.php www
        mv grocy/*.json www

        cd www
        composer install
        yarn install

This results with built app in www sub-directory. Notice the trick we did with the data directory. By Grocy’s own installation documentation, /data directory keeps cache and plugins as well (structure is provided in the repo of the app itself), not just the data created by user. So we link it to the permanent mount and then copy the provided plugins in the deploy hook:

    deploy: |
        set -e
        mkdir -p data/data/viewcache
        cp -rp grocy/data/* data/data
        cp config.php data/data

Deploy hook also provides configuration file config.php. You can look at the defaults, but at least you should disable PHP’s error reporting since it breaks session management:


error_reporting(E_ERROR | E_PARSE);

The only thing that’s left is describing how to serve the application, and that’s fairly easy:

            root: 'www/public'
            expires: 5m
            passthru: '/index.php'
            allow: false
                    allow: true
                    expires: 2w

And that is it, you’re now ready to run Grocy and manage your household like a proper company.