linuxserver / docker-grocy

A container for grocy - the ERP application for your kitchen https://grocy.info
GNU General Public License v3.0
333 stars 44 forks source link

Grocy reverse proxy Traefik #10

Closed madereddy closed 5 years ago

madereddy commented 5 years ago

linuxserver.io

Ubuntu 18.10

version: "2" services: grocy: image: linuxserver/grocy container_name: grocy environment:

networks: monitoring: external: name: monitoring

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.

[s6-init] ensuring user provided files have correct perms...exited 0.

[fix-attrs.d] applying ownership & permissions fixes...

[fix-attrs.d] done.

[cont-init.d] executing container initialization scripts...

[cont-init.d] 10-adduser: executing...


      _         ()

     | |  ___   _    __

     | | / __| | |  /  \ 

     | | \__ \ | | | () |

     |_| |___/ |_|  \__/

Brought to you by linuxserver.io

We gratefully accept donations at:

https://www.linuxserver.io/donate/


GID/UID


User uid: 1000

User gid: 1000


[cont-init.d] 10-adduser: exited 0.

[cont-init.d] 20-config: executing...

[cont-init.d] 20-config: exited 0.

[cont-init.d] 30-keygen: executing...

using keys found in /config/keys

[cont-init.d] 30-keygen: exited 0.

[cont-init.d] 50-config: executing...

[cont-init.d] 50-config: exited 0.

[cont-init.d] 99-custom-files: executing...

[custom-init] no custom files found exiting...

[cont-init.d] 99-custom-files: exited 0.

[cont-init.d] done.

[services.d] starting services

[services.d] done.

NA

Essentially I am unable to get Grocy to work as a subdirectory. I got Ombi and Tautulli from you guys working as a subdirectory so I dont know what is causing this issue with same label setup.

kachunkachunk commented 5 years ago

This is quite some time later, but I got subdirectory URLs working by editing URL_BASE in /config/data/config.php. This file is generated and accessible to you per LSIO's usual container config directory design. Nice and easy!

I think ideally this is handled via environment variable and ingested to the config.php file upon starting, but this may not be properly implemented yet (in the original project, not an LSIO fault), or at least as far as I can tell so far.

Maybe this can be put in the readme?

Here's what has worked for me:

# The base url of your installation,
# should be just "/" when running directly under the root of a (sub)domain
# or for example "https://example.com/grocy" when using a subdirectory
Setting('BASE_URL', 'https://apps.example.com/grocy');
kdavis commented 5 years ago

Above also worked for me

In docker-compose.yml

...
 grocy:
    ...
    labels:
      traefik.enable: "true"
      traefik.port: "80"
      traefik.protocol: http
      traefik.frontend.rule: "Host:10.25.0.20; PathPrefixStrip: /grocy"
      traefik.backend: "grocy"

Then in grocy's data/config.php

Setting('BASE_URL', 'http://[domain]/grocy');

Like a charm! Thanks madereddy