mirror of
https://github.com/hassio-addons/addon-grocy.git
synced 2025-05-04 19:21:24 +00:00
✨ Initial add-on code
This commit is contained in:
parent
e6c5686328
commit
6028377d5e
20 changed files with 715 additions and 0 deletions
216
README.md
Executable file
216
README.md
Executable file
|
@ -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
|
73
grocy/.README.j2
Normal file
73
grocy/.README.j2
Normal file
|
@ -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:
|
||||||
|
|
||||||
|
<https://github.com/hassio-addons/repository>
|
||||||
|
|
||||||
|
{% 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:
|
||||||
|
|
||||||
|
<https://github.com/hassio-addons/repository>
|
||||||
|
|
||||||
|
{% 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
|
83
grocy/Dockerfile
Executable file
83
grocy/Dockerfile
Executable file
|
@ -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 <frenck@addons.community>" \
|
||||||
|
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"
|
10
grocy/build.json
Executable file
10
grocy/build.json
Executable file
|
@ -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": {}
|
||||||
|
}
|
38
grocy/config.json
Executable file
38
grocy/config.json
Executable file
|
@ -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}"
|
||||||
|
}
|
||||||
|
}
|
BIN
grocy/icon.png
Normal file
BIN
grocy/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8 KiB |
BIN
grocy/logo.png
Normal file
BIN
grocy/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.4 KiB |
26
grocy/rootfs/etc/cont-init.d/10-requirements.sh
Executable file
26
grocy/rootfs/etc/cont-init.d/10-requirements.sh
Executable file
|
@ -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
|
21
grocy/rootfs/etc/cont-init.d/11-nginx.sh
Executable file
21
grocy/rootfs/etc/cont-init.d/11-nginx.sh
Executable file
|
@ -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
|
23
grocy/rootfs/etc/cont-init.d/13-persistent-data.sh
Normal file
23
grocy/rootfs/etc/cont-init.d/13-persistent-data.sh
Normal file
|
@ -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
|
1
grocy/rootfs/etc/fix-attrs.d/01-grocy
Normal file
1
grocy/rootfs/etc/fix-attrs.d/01-grocy
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/data/grocy true nginx 0644 0755
|
54
grocy/rootfs/etc/nginx/nginx-ssl.conf
Executable file
54
grocy/rootfs/etc/nginx/nginx-ssl.conf
Executable file
|
@ -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)$ {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
43
grocy/rootfs/etc/nginx/nginx.conf
Executable file
43
grocy/rootfs/etc/nginx/nginx.conf
Executable file
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
8
grocy/rootfs/etc/php7/conf.d/99-grocy.ini
Normal file
8
grocy/rootfs/etc/php7/conf.d/99-grocy.ini
Normal file
|
@ -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
|
11
grocy/rootfs/etc/php7/php-fpm.d/www.conf
Normal file
11
grocy/rootfs/etc/php7/php-fpm.d/www.conf
Normal file
|
@ -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
|
9
grocy/rootfs/etc/services.d/nginx/finish
Executable file
9
grocy/rootfs/etc/services.d/nginx/finish
Executable file
|
@ -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
|
12
grocy/rootfs/etc/services.d/nginx/run
Executable file
12
grocy/rootfs/etc/services.d/nginx/run
Executable file
|
@ -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;"
|
9
grocy/rootfs/etc/services.d/php-fpm/finish
Normal file
9
grocy/rootfs/etc/services.d/php-fpm/finish
Normal file
|
@ -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
|
9
grocy/rootfs/etc/services.d/php-fpm/run
Normal file
9
grocy/rootfs/etc/services.d/php-fpm/run
Normal file
|
@ -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
|
69
grocy/rootfs/var/www/grocy/data/config.php
Normal file
69
grocy/rootfs/var/www/grocy/data/config.php
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
# Settings can also be overwritten in two ways
|
||||||
|
#
|
||||||
|
# First priority
|
||||||
|
# A .txt file with the same name as the setting in /data/settingoverrides
|
||||||
|
# the content of the file is used as the setting value
|
||||||
|
#
|
||||||
|
# Second priority
|
||||||
|
# An environment variable with the same name as the setting and prefix "GROCY_"
|
||||||
|
# so for example "GROCY_BASE_URL"
|
||||||
|
#
|
||||||
|
# Third priority
|
||||||
|
# The settings defined here below
|
||||||
|
|
||||||
|
|
||||||
|
# Either "production", "dev" or "prerelease"
|
||||||
|
Setting('MODE', 'production');
|
||||||
|
|
||||||
|
# Either "en" or "de" or the filename (without extension) of
|
||||||
|
# one of the other available localization files in the "/localization" directory
|
||||||
|
Setting('CULTURE', 'en');
|
||||||
|
|
||||||
|
# To keep it simple: grocy does not handle any currency conversions,
|
||||||
|
# this here is used to format all money values,
|
||||||
|
# so can be anything (e. g. "USD" OR "$", doesn't matter...)
|
||||||
|
Setting('CURRENCY', '$');
|
||||||
|
|
||||||
|
# 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', '/');
|
||||||
|
|
||||||
|
# The plugin to use for external barcode lookups,
|
||||||
|
# must be the filename without .php extension and must be located in /data/plugins,
|
||||||
|
# see /data/plugins/DemoBarcodeLookupPlugin.php for an example implementation
|
||||||
|
Setting('STOCK_BARCODE_LOOKUP_PLUGIN', 'DemoBarcodeLookupPlugin');
|
||||||
|
|
||||||
|
# If, however, your webserver does not support URL rewriting,
|
||||||
|
# set this to true
|
||||||
|
Setting('DISABLE_URL_REWRITING', false);
|
||||||
|
|
||||||
|
|
||||||
|
# Default user settings
|
||||||
|
# These settings can be changed per user, here the defaults
|
||||||
|
# are defined which are used when the user has not changed the setting so far
|
||||||
|
|
||||||
|
# Night mode related
|
||||||
|
DefaultUserSetting('night_mode_enabled', false); // If night mode is enabled always
|
||||||
|
DefaultUserSetting('auto_night_mode_enabled', false); // If night mode is enabled automatically when inside a given time range (see the two settings below)
|
||||||
|
DefaultUserSetting('auto_night_mode_time_range_from', "20:00"); // Format HH:mm
|
||||||
|
DefaultUserSetting('auto_night_mode_time_range_to', "07:00"); // Format HH:mm
|
||||||
|
DefaultUserSetting('auto_night_mode_time_range_goes_over_midnight', true); // If the time range above goes over midnight
|
||||||
|
DefaultUserSetting('currently_inside_night_mode_range', false); // If we're currently inside of night mode time range (this is not user configurable, but stored as a user setting because it's evaluated client side to be able to use the client time instead of the maybe different server time)
|
||||||
|
DefaultUserSetting('product_presets_location_id', -1); // Default location id for new products (-1 means no location is preset)
|
||||||
|
DefaultUserSetting('product_presets_product_group_id', -1); // Default product group id for new products (-1 means no product group is preset)
|
||||||
|
DefaultUserSetting('product_presets_qu_id', -1); // Default quantity unit id for new products (-1 means no quantity unit is preset)
|
||||||
|
|
||||||
|
# If the page should be automatically reloaded when there was
|
||||||
|
# an external change
|
||||||
|
DefaultUserSetting('auto_reload_on_db_change', true);
|
||||||
|
|
||||||
|
# Show a clock in the header next to the logo or not
|
||||||
|
DefaultUserSetting('show_clock_in_header', false);
|
||||||
|
|
||||||
|
# Shopping list to stock workflow:
|
||||||
|
# Automatically do the booking using the last price and the amount
|
||||||
|
# of the shopping list item, if the product has "Default best before days" set
|
||||||
|
DefaultUserSetting('shopping_list_to_stock_workflow_auto_submit_when_prefilled', false);
|
Loading…
Add table
Add a link
Reference in a new issue