diff --git a/README.md b/README.md new file mode 100755 index 0000000..073f0ba --- /dev/null +++ b/README.md @@ -0,0 +1,216 @@ +# Community Hass.io Add-ons: Grocy + +[![GitHub Release][releases-shield]][releases] +![Project Stage][project-stage-shield] +[![License][license-shield]](LICENSE.md) + +[![GitLab CI][gitlabci-shield]][gitlabci] +![Project Maintenance][maintenance-shield] +[![GitHub Activity][commits-shield]][commits] + +[![Discord][discord-shield]][discord] +[![Community Forum][forum-shield]][forum] + +[![Buy me a coffee][buymeacoffee-shield]][buymeacoffee] + +[![Support my work on Patreon][patreon-shield]][patreon] + +ERP beyond your fridge! A groceries & household management solution +for your home. + +## About + +Lorem ipsum. + +## Installation + +The installation of this add-on is pretty straightforward and not different in +comparison to installing any other Hass.io add-on. + +1. [Add our Hass.io add-ons repository][repository] to your Hass.io instance. +1. Install the "Grocy" add-on. +1. Start the "Grocy" add-on +1. Check the logs of the "Grocy" add-on to see if everything went well. + +**NOTE**: Do not add this repository to Hass.io, please use: +`https://github.com/hassio-addons/repository`. + +## Docker status + +![Supports armhf Architecture][armhf-shield] +![Supports aarch64 Architecture][aarch64-shield] +![Supports amd64 Architecture][amd64-shield] +![Supports i386 Architecture][i386-shield] + +[![Docker Layers][layers-shield]][microbadger] +[![Docker Pulls][pulls-shield]][dockerhub] + +## Configuration + +**Note**: _Remember to restart the add-on when the configuration is changed._ + +Example add-on configuration: + +```json +{ + "log_level": "info", + "ssl": false, + "certfile": "fullchain.pem", + "keyfile": "privkey.pem" +} +``` + +**Note**: _This is just an example, don't copy and paste it! Create your own!_ + +### Option: `log_level` + +The `log_level` option controls the level of log output by the addon and can +be changed to be more or less verbose, which might be useful when you are +dealing with an unknown issue. Possible values are: + +- `trace`: Show every detail, like all called internal functions. +- `debug`: Shows detailed debug information. +- `info`: Normal (usually) interesting events. +- `warning`: Exceptional occurrences that are not errors. +- `error`: Runtime errors that do not require immediate action. +- `fatal`: Something went terribly wrong. Add-on becomes unusable. + +Please note that each level automatically includes log messages from a +more severe level, e.g., `debug` also shows `info` messages. By default, +the `log_level` is set to `info`, which is the recommended setting unless +you are troubleshooting. + +### Option: `ssl` + +Enables/Disables SSL (HTTPS) on the web interface of Grocy +Panel. Set it `true` to enable it, `false` otherwise. + +### Option: `certfile` + +The certificate file to use for SSL. + +**Note**: _The file MUST be stored in `/ssl/`, which is the default for Hass.io_ + +### Option: `keyfile` + +The private key file to use for SSL. + +**Note**: _The file MUST be stored in `/ssl/`, which is the default for Hass.io_ + +## Known issues and limitations + +- Lorem ipsum. + +## Changelog & Releases + +This repository keeps a change log using [GitHub's releases][releases] +functionality. The format of the log is based on +[Keep a Changelog][keepchangelog]. + +Releases are based on [Semantic Versioning][semver], and use the format +of ``MAJOR.MINOR.PATCH``. In a nutshell, the version will be incremented +based on the following: + +- ``MAJOR``: Incompatible or major changes. +- ``MINOR``: Backwards-compatible new features and enhancements. +- ``PATCH``: Backwards-compatible bugfixes and package updates. + +## Support + +Got questions? + +You have several options to get them answered: + +- The [Community Hass.io Add-ons Discord chat server][discord] for add-on + support and feature requests. +- The [Home Assistant Discord chat server][discord-ha] for general Home + Assistant discussions and questions. +- The Home Assistant [Community Forum][forum]. +- Join the [Reddit subreddit][reddit] in [/r/homeassistant][reddit] + +You could also [open an issue here][issue] GitHub. + +## Contributing + +This is an active open-source project. We are always open to people who want to +use the code or contribute to it. + +We have set up a separate document containing our +[contribution guidelines](CONTRIBUTING.md). + +Thank you for being involved! :heart_eyes: + +## Authors & contributors + +The original setup of this repository is by [Franck Nijhof][frenck]. + +For a full list of all authors and contributors, +check [the contributor's page][contributors]. + +## We have got some Hass.io add-ons for you + +Want some more functionality to your Hass.io Home Assistant instance? + +We have created multiple add-ons for Hass.io. For a full list, check out +our [GitHub Repository][repository]. + +## License + +MIT License + +Copyright (c) 2019 Franck Nijhof + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +[aarch64-shield]: https://img.shields.io/badge/aarch64-yes-green.svg +[alpine-packages]: https://pkgs.alpinelinux.org/packages +[amd64-shield]: https://img.shields.io/badge/amd64-yes-green.svg +[armhf-shield]: https://img.shields.io/badge/armhf-yes-green.svg +[buymeacoffee-shield]: https://www.buymeacoffee.com/assets/img/guidelines/download-assets-sm-2.svg +[buymeacoffee]: https://www.buymeacoffee.com/frenck +[commits-shield]: https://img.shields.io/github/commit-activity/y/hassio-addons/addon-grocy.svg +[commits]: https://github.com/hassio-addons/addon-grocy/commits/master +[contributors]: https://github.com/hassio-addons/addon-grocy/graphs/contributors +[discord-ha]: https://discord.gg/c5DvZ4e +[discord-shield]: https://img.shields.io/discord/478094546522079232.svg +[discord]: https://discord.me/hassioaddons +[dockerhub]: https://hub.docker.com/r/hassioaddons/grocy +[forum-shield]: https://img.shields.io/badge/community-forum-brightgreen.svg +[forum]: https://community.home-assistant.io/?u=frenck +[frenck]: https://github.com/frenck +[gitlabci-shield]: https://gitlab.com/hassio-addons/addon-grocy/badges/master/pipeline.svg +[gitlabci]: https://gitlab.com/hassio-addons/addon-grocy/pipelines +[home-assistant]: https://home-assistant.io +[i386-shield]: https://img.shields.io/badge/i386-yes-green.svg +[issue]: https://github.com/hassio-addons/addon-grocy/issues +[keepchangelog]: http://keepachangelog.com/en/1.0.0/ +[license-shield]: https://img.shields.io/github/license/hassio-addons/addon-grocy.svg +[maintenance-shield]: https://img.shields.io/maintenance/yes/2019.svg +[microbadger]: https://microbadger.com/images/hassioaddons/grocy +[patreon-shield]: https://www.frenck.nl/images/patreon.png +[patreon]: https://www.patreon.com/ +[project-stage-shield]: https://img.shields.io/badge/project%20stage-experimental-yellow.svg +[python-packages]: https://pypi.org/ +[reddit]: https://reddit.com/r/homeassistant +[releases-shield]: https://img.shields.io/github/release/hassio-addons/addon-grocy.svg +[releases]: https://github.com/hassio-addons/addon-grocy/releases +[repository]: https://github.com/hassio-addons/repository +[semver]: http://semver.org/spec/v2.0.0.htm +[layers-shield]: https://images.microbadger.com/badges/image/hassioaddons/grocy.svg +[pulls-shield]: https://img.shields.io/docker/pulls/hassioaddons/grocy.svg diff --git a/grocy/.README.j2 b/grocy/.README.j2 new file mode 100644 index 0000000..3a5dcf8 --- /dev/null +++ b/grocy/.README.j2 @@ -0,0 +1,73 @@ +# Community Hass.io Add-ons: Grocy + +[![Release][release-shield]][release] ![Project Stage][project-stage-shield] ![Project Maintenance][maintenance-shield] + +[![Discord][discord-shield]][discord] [![Community Forum][forum-shield]][forum] + +[![Buy me a coffee][buymeacoffee-shield]][buymeacoffee] + +[![Support my work on Patreon][patreon-shield]][patreon] + +ERP beyond your fridge! A groceries & household management solution for your home. + +## About + +Lorem ipsum. + +[Click here for the full documentation][docs] + +![Grocy screenshot][screenshot] + +{% if channel == "edge" %} +## WARNING! THIS IS AN EDGE VERSION! + +This Hass.io Add-ons repository contains edge builds of add-ons. Edge builds +add-ons are based upon the latest development version. + +- They may not work at all. +- They might stop working at any time. +- They could have a negative impact on your system. + +This repository was created for: + +- Anybody willing to test. +- Anybody interested in trying out upcoming add-ons or add-on features. +- Developers. + +If you are more interested in stable releases of our add-ons: + + + +{% endif %} +{% if channel == "beta" %} +## WARNING! THIS IS A BETA VERSION! + +This Hass.io Add-ons repository contains beta releases of add-ons. + +- They might stop working at any time. +- They could have a negative impact on your system. + +This repository was created for: + +- Anybody willing to test. +- Anybody interested in trying out upcoming add-ons or add-on features. + +If you are more interested in stable releases of our add-ons: + + + +{% endif %} +[buymeacoffee-shield]: https://www.buymeacoffee.com/assets/img/guidelines/download-assets-sm-2.svg +[buymeacoffee]: https://www.buymeacoffee.com/frenck +[discord-shield]: https://img.shields.io/discord/478094546522079232.svg +[discord]: https://discord.me/hassioaddons +[docs]: {{ repo }}/blob/{{ version }}/README.md +[forum-shield]: https://img.shields.io/badge/community-forum-brightgreen.svg +[forum]: https://community.home-assistant.io/?u=frenck +[maintenance-shield]: https://img.shields.io/maintenance/yes/2019.svg +[patreon-shield]: https://www.frenck.nl/images/patreon.png +[patreon]: https://www.patreon.com/frenck +[project-stage-shield]: https://img.shields.io/badge/project%20stage-experimental-yellow.svg +[release-shield]: https://img.shields.io/badge/version-{{ version }}-blue.svg +[release]: {{ repo }}/tree/{{ version }} +[screenshot]: https://github.com/hassio-addons/addon-grocy/raw/master/images/screenshot.png diff --git a/grocy/Dockerfile b/grocy/Dockerfile new file mode 100755 index 0000000..3c4961a --- /dev/null +++ b/grocy/Dockerfile @@ -0,0 +1,83 @@ +ARG BUILD_FROM=hassioaddons/base:2.3.2 +# hadolint ignore=DL3006 +FROM ${BUILD_FROM} + +# Set shell +SHELL ["/bin/bash", "-o", "pipefail", "-c"] + +# Setup base +# hadolint ignore=DL3003 +RUN \ + apk add --no-cache \ + nginx=1.14.2-r0 \ + php7-fpm=7.2.13-r0 \ + php7-json=7.2.13-r0 \ + php7-mbstring=7.2.13-r0 \ + php7-opcache=7.2.13-r0 \ + php7-pdo_sqlite=7.2.13-r0 \ + php7-pdo=7.2.13-r0 \ + php7-tokenizer=7.2.13-r0 \ + php7=7.2.13-r0 \ + \ + && apk add --no-cache --virtual .build-dependencies \ + git=2.18.1-r0 \ + yarn=1.13.0-r0 \ + composer=1.8.4-r0 \ + \ + && yarn global add modclean \ + \ + && git clone --branch "v1.24.1" --depth=1 \ + https://github.com/grocy/grocy.git /var/www/grocy \ + \ + && cd /var/www/grocy \ + \ + && composer install --no-dev \ + && yarn --production \ + \ + && modclean \ + --path /var/www/grocy/public \ + --no-progress \ + --keep-empty \ + --run \ + \ + && yarn global remove modclean \ + && yarn cache clean \ + && apk del --purge .build-dependencies \ + \ + && find /var/www/ -type f -name "*.md" -depth -exec rm -f {} \; \ + && rm -f -r \ + /tmp/* \ + /usr/local/share/.cache \ + /usr/lib/node_modules \ + /var/www/grocy/.git \ + /var/www/grocy/.tx \ + /var/www/grocy/.vscode \ + /var/www/grocy/build.bat \ + /var/www/grocy/build_tools + +# Copy root filesystem +COPY rootfs / + +# Build arguments +ARG BUILD_ARCH +ARG BUILD_DATE +ARG BUILD_REF +ARG BUILD_VERSION + +# Labels +LABEL \ + io.hass.name="Grocy" \ + io.hass.description="ERP beyond your fridge! A groceries & household management solution for your home" \ + io.hass.arch="${BUILD_ARCH}" \ + io.hass.type="addon" \ + io.hass.version=${BUILD_VERSION} \ + maintainer="Franck Nijhof " \ + org.label-schema.description="ERP beyond your fridge! A groceries & household management solution for your home" \ + org.label-schema.build-date=${BUILD_DATE} \ + org.label-schema.name="Grocy" \ + org.label-schema.schema-version="1.0" \ + org.label-schema.url="https://community.home-assistant.io/?u=frenck" \ + org.label-schema.usage="https://github.com/hassio-addons/addon-grocy/tree/master/README.md" \ + org.label-schema.vcs-ref=${BUILD_REF} \ + org.label-schema.vcs-url="https://github.com/hassio-addons/addon-grocy" \ + org.label-schema.vendor="Community Hass.io Addons" diff --git a/grocy/build.json b/grocy/build.json new file mode 100755 index 0000000..ca12437 --- /dev/null +++ b/grocy/build.json @@ -0,0 +1,10 @@ +{ + "squash": false, + "build_from": { + "aarch64": "hassioaddons/base-aarch64:2.3.2", + "amd64": "hassioaddons/base-amd64:2.3.2", + "armhf": "hassioaddons/base-armhf:2.3.2", + "i386": "hassioaddons/base-i386:2.3.2" + }, + "args": {} +} diff --git a/grocy/config.json b/grocy/config.json new file mode 100755 index 0000000..e3a1cb6 --- /dev/null +++ b/grocy/config.json @@ -0,0 +1,38 @@ +{ + "name": "Grocy", + "version": "dev", + "slug": "grocy", + "description": "ERP beyond your fridge! A groceries & household management solution for your home", + "url": "https://github.com/hassio-addons/addon-grocy", + "webui": "[PROTO:ssl]://[HOST]:[PORT:9192]", + "startup": "system", + "arch": [ + "aarch64", + "amd64", + "armhf", + "i386" + ], + "boot": "auto", + "hassio_api": true, + "hassio_role": "default", + "map": [ + "ssl" + ], + "ports": { + "80/tcp": 9192 + }, + "options": { + "ssl": true, + "certfile": "fullchain.pem", + "keyfile": "privkey.pem" + }, + "schema": { + "log_level": "match(^(trace|debug|info|notice|warning|error|fatal)$)?", + "ssl": "bool", + "certfile": "str", + "keyfile": "str" + }, + "environment": { + "LOG_FORMAT": "{LEVEL}: {MESSAGE}" + } +} diff --git a/grocy/icon.png b/grocy/icon.png new file mode 100644 index 0000000..2e2c59c Binary files /dev/null and b/grocy/icon.png differ diff --git a/grocy/logo.png b/grocy/logo.png new file mode 100644 index 0000000..9b2fdbd Binary files /dev/null and b/grocy/logo.png differ diff --git a/grocy/rootfs/etc/cont-init.d/10-requirements.sh b/grocy/rootfs/etc/cont-init.d/10-requirements.sh new file mode 100755 index 0000000..1c37c42 --- /dev/null +++ b/grocy/rootfs/etc/cont-init.d/10-requirements.sh @@ -0,0 +1,26 @@ +#!/usr/bin/with-contenv bash +# ============================================================================== +# Community Hass.io Add-ons: Grocy +# This files check if all user configuration requirements are met +# ============================================================================== +# shellcheck disable=SC1091 +source /usr/lib/hassio-addons/base.sh + +# Check SSL requirements, if enabled +if hass.config.true 'ssl'; then + if ! hass.config.has_value 'certfile'; then + hass.die 'SSL is enabled, but no certfile was specified' + fi + + if ! hass.config.has_value 'keyfile'; then + hass.die 'SSL is enabled, but no keyfile was specified' + fi + + if ! hass.file_exists "/ssl/$(hass.config.get 'certfile')"; then + hass.die 'The configured certfile is not found' + fi + + if ! hass.file_exists "/ssl/$(hass.config.get 'keyfile')"; then + hass.die 'The configured keyfile is not found' + fi +fi diff --git a/grocy/rootfs/etc/cont-init.d/11-nginx.sh b/grocy/rootfs/etc/cont-init.d/11-nginx.sh new file mode 100755 index 0000000..5362df4 --- /dev/null +++ b/grocy/rootfs/etc/cont-init.d/11-nginx.sh @@ -0,0 +1,21 @@ +#!/usr/bin/with-contenv bash +# ============================================================================== +# Community Hass.io Add-ons: Grocy +# Configures NGINX for use with Grocy +# ============================================================================== +# shellcheck disable=SC1091 +source /usr/lib/hassio-addons/base.sh + +declare certfile +declare keyfile + +if hass.config.true 'ssl'; then + rm /etc/nginx/nginx.conf + mv /etc/nginx/nginx-ssl.conf /etc/nginx/nginx.conf + + certfile=$(hass.config.get 'certfile') + keyfile=$(hass.config.get 'keyfile') + + sed -i "s/%%certfile%%/${certfile}/g" /etc/nginx/nginx.conf + sed -i "s/%%keyfile%%/${keyfile}/g" /etc/nginx/nginx.conf +fi diff --git a/grocy/rootfs/etc/cont-init.d/13-persistent-data.sh b/grocy/rootfs/etc/cont-init.d/13-persistent-data.sh new file mode 100644 index 0000000..3b1aca0 --- /dev/null +++ b/grocy/rootfs/etc/cont-init.d/13-persistent-data.sh @@ -0,0 +1,23 @@ +#!/usr/bin/with-contenv bash +# ============================================================================== +# Community Hass.io Add-ons: Grocy +# Ensures data is store in a persistent location +# ============================================================================== +# shellcheck disable=SC1091 +source /usr/lib/hassio-addons/base.sh + +if ! hass.directory_exists "/data/grocy"; then + hass.log.debug 'Data directory not initialized, doing that now...' + + # Setup structure + cp -R /var/www/grocy/data /data/grocy + + # Ensure file permissions + chown -R nginx:nginx /data/grocy + find /data/grocy -not -perm 0644 -type f -exec chmod 0644 {} \; + find /data/grocy -not -perm 0755 -type d -exec chmod 0755 {} \; +fi + +hass.log.debug 'Symlinking data directory to persistent storage location...' +rm -f -r /var/www/grocy/data +ln -s /data/grocy /var/www/grocy/data diff --git a/grocy/rootfs/etc/fix-attrs.d/01-grocy b/grocy/rootfs/etc/fix-attrs.d/01-grocy new file mode 100644 index 0000000..e497e78 --- /dev/null +++ b/grocy/rootfs/etc/fix-attrs.d/01-grocy @@ -0,0 +1 @@ +/data/grocy true nginx 0644 0755 diff --git a/grocy/rootfs/etc/nginx/nginx-ssl.conf b/grocy/rootfs/etc/nginx/nginx-ssl.conf new file mode 100755 index 0000000..efe737b --- /dev/null +++ b/grocy/rootfs/etc/nginx/nginx-ssl.conf @@ -0,0 +1,54 @@ +worker_processes 1; +pid /var/run/nginx.pid; +user nginx nginx; + +events { + worker_connections 1024; +} + +http { + include mime.types; + default_type application/octet-stream; + sendfile on; + keepalive_timeout 65; + + server { + server_name hassio.local; + listen 80 default_server ssl; + listen [::]:80 default_server ssl; + root /var/www/grocy/public; + index index.php; + + ssl_certificate /ssl/%%certfile%%; + ssl_certificate_key /ssl/%%keyfile%%; + ssl_protocols TLSv1.2; + ssl_prefer_server_ciphers on; + ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA; + ssl_ecdh_curve secp384r1; + ssl_session_timeout 10m; + ssl_session_cache shared:SSL:10m; + ssl_session_tickets off; + ssl_stapling on; + ssl_stapling_verify on; + + add_header X-Content-Type-Options nosniff; + add_header X-XSS-Protection "1; mode=block"; + add_header X-Robots-Tag none; + + location /data/ { + deny all; + } + + location ~ .php$ { + fastcgi_pass 127.0.0.1:9001; + fastcgi_read_timeout 900; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + include fastcgi_params; + } + + location ~ ^(.*)\.(css|js|gif||jpe?g|png|json|cache\.json)$ { + } + } +} diff --git a/grocy/rootfs/etc/nginx/nginx.conf b/grocy/rootfs/etc/nginx/nginx.conf new file mode 100755 index 0000000..a6a7a82 --- /dev/null +++ b/grocy/rootfs/etc/nginx/nginx.conf @@ -0,0 +1,43 @@ +worker_processes 1; +pid /var/run/nginx.pid; +user nginx nginx; + +events { + worker_connections 1024; +} + +http { + include mime.types; + default_type application/octet-stream; + sendfile on; + keepalive_timeout 65; + + server { + server_name hassio.local; + listen 80 default_server; + listen [::]:80 default_server; + root /var/www/grocy/public; + index index.php; + + location / { + try_files $uri $uri/ /index.php?$query_string; + } + + location ~* .(jpg|jpeg|png|gif|ico|css|js)$ { + expires 365d; + } + + location ~ .php$ { + fastcgi_pass 127.0.0.1:9001; + fastcgi_read_timeout 900; + fastcgi_split_path_info ^(.+\.php)(/.+)$; + fastcgi_index index.php; + fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; + include fastcgi_params; + } + + location ~ /\.ht { + deny all; + } + } +} diff --git a/grocy/rootfs/etc/php7/conf.d/99-grocy.ini b/grocy/rootfs/etc/php7/conf.d/99-grocy.ini new file mode 100644 index 0000000..28f1026 --- /dev/null +++ b/grocy/rootfs/etc/php7/conf.d/99-grocy.ini @@ -0,0 +1,8 @@ +[general] +max_execution_time = 900 +opcache.enable=1 +opcache.interned_strings_buffer=8 +opcache.max_accelerated_files=4096 +opcache.memory_consumption=32 +opcache.revalidate_freq=0 +opcache.validate_timestamps=0 diff --git a/grocy/rootfs/etc/php7/php-fpm.d/www.conf b/grocy/rootfs/etc/php7/php-fpm.d/www.conf new file mode 100644 index 0000000..13c8a71 --- /dev/null +++ b/grocy/rootfs/etc/php7/php-fpm.d/www.conf @@ -0,0 +1,11 @@ +[www] +user = nginx +group = nginx +listen = 127.0.0.1:9001 +pm = dynamic +pm.max_children = 10 +pm.start_servers = 3 +pm.min_spare_servers = 2 +pm.max_spare_servers = 5 +pm.max_requests = 1024 +clear_env = yes diff --git a/grocy/rootfs/etc/services.d/nginx/finish b/grocy/rootfs/etc/services.d/nginx/finish new file mode 100755 index 0000000..079fd0e --- /dev/null +++ b/grocy/rootfs/etc/services.d/nginx/finish @@ -0,0 +1,9 @@ +#!/usr/bin/execlineb -S0 +# ============================================================================== +# Community Hass.io Add-ons: Grocy +# Take down the S6 supervision tree when Nginx fails +# ============================================================================== +if -n { s6-test $# -ne 0 } +if -n { s6-test ${1} -eq 256 } + +s6-svscanctl -t /var/run/s6/services diff --git a/grocy/rootfs/etc/services.d/nginx/run b/grocy/rootfs/etc/services.d/nginx/run new file mode 100755 index 0000000..ddb30b7 --- /dev/null +++ b/grocy/rootfs/etc/services.d/nginx/run @@ -0,0 +1,12 @@ +#!/usr/bin/with-contenv bash +# ============================================================================== +# Community Hass.io Add-ons: Grocy +# Runs the Nginx daemon +# ============================================================================== +# shellcheck disable=SC1091 +source /usr/lib/hassio-addons/base.sh + +# Wait for PHP-FPM to become available +s6-svwait -u -t 5000 /var/run/s6/services/php-fpm + +exec nginx -g "daemon off;" diff --git a/grocy/rootfs/etc/services.d/php-fpm/finish b/grocy/rootfs/etc/services.d/php-fpm/finish new file mode 100644 index 0000000..91cee15 --- /dev/null +++ b/grocy/rootfs/etc/services.d/php-fpm/finish @@ -0,0 +1,9 @@ +#!/usr/bin/execlineb -S0 +# ============================================================================== +# Community Hass.io Add-ons: Grocy +# Take down the S6 supervision tree when PHP FPM fails +# ============================================================================== +if -n { s6-test $# -ne 0 } +if -n { s6-test ${1} -eq 256 } + +s6-svscanctl -t /var/run/s6/services diff --git a/grocy/rootfs/etc/services.d/php-fpm/run b/grocy/rootfs/etc/services.d/php-fpm/run new file mode 100644 index 0000000..0d6fa53 --- /dev/null +++ b/grocy/rootfs/etc/services.d/php-fpm/run @@ -0,0 +1,9 @@ +#!/usr/bin/with-contenv bash +# ============================================================================== +# Community Hass.io Add-ons: Grocy +# Runs the PHP-FPM daemon +# ============================================================================== +# shellcheck disable=SC1091 +source /usr/lib/hassio-addons/base.sh + +exec php-fpm7 --nodaemonize diff --git a/grocy/rootfs/var/www/grocy/data/config.php b/grocy/rootfs/var/www/grocy/data/config.php new file mode 100644 index 0000000..4402f82 --- /dev/null +++ b/grocy/rootfs/var/www/grocy/data/config.php @@ -0,0 +1,69 @@ +