Skip to content

Commit

Permalink
Run migrations on boot, improve config, update base image, 0.3.0 rele…
Browse files Browse the repository at this point in the history
…ase (#27)

* Run migrations

* Rework

* rework

* Add back image

* ws

* Fix ws

* Workaround for non-published  10.4.1
  • Loading branch information
inverse authored May 20, 2021
1 parent dded059 commit 274271e
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 21 deletions.
28 changes: 14 additions & 14 deletions emoncms/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG BUILD_FROM=ghcr.io/hassio-addons/base/amd64:9.1.5
ARG BUILD_FROM=ghcr.io/hassio-addons/base/amd64:9.2.0
# hadolint ignore=DL3006
FROM ${BUILD_FROM}

Expand All @@ -10,23 +10,23 @@ RUN \
apk add --no-cache \
nginx=1.18.0-r13 \
mariadb-client=10.5.9-r0 \
php7-ctype=7.4.15-r0 \
php7-curl=7.4.15-r0 \
php7-fpm=7.4.15-r0 \
php7-gettext=7.4.15-r0 \
php7-json=7.4.15-r0 \
php7-mbstring=7.4.15-r0 \
php7-mysqli=7.4.15-r0 \
php7-opcache=7.4.15-r00 \
php7-session=7.4.15-r0 \
php7-zip=7.4.15-r0 \
php7=7.4.15-r0 \
php7-ctype=7.4.19-r0 \
php7-curl=7.4.19-r0 \
php7-fpm=7.4.19-r0 \
php7-gettext=7.4.19-r0 \
php7-json=7.4.19-r0 \
php7-mbstring=7.4.19-r0 \
php7-mysqli=7.4.19-r0 \
php7-opcache=7.4.19-r00 \
php7-session=7.4.19-r0 \
php7-zip=7.4.19-r0 \
php7=7.4.19-r0 \
\
&& apk add --no-cache --virtual .build-dependencies \
git=2.30.2-r0 \
\
&& git clone --branch 10.2.7 --depth=1 \
https://github.com/emoncms/emoncms.git /var/www/emoncms \
&& git clone --branch master \
https://github.com/emoncms/emoncms.git /var/www/emoncms ; cd /var/www/emoncms ; git checkout 94a3f222cda2dcdf8a4b3ca6275108eca4549aec \
&& git clone --branch 2.0.8 --depth=1 \
https://github.com/emoncms/dashboard.git /var/www/emoncms/Modules/dashboard \
&& git clone --branch 2.0.10 --depth=1 \
Expand Down
8 changes: 1 addition & 7 deletions emoncms/config.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,13 @@
{
"name": "Emoncms",
"version": "0.2.1",
"version": "0.3.0",
"slug": "emoncms",
"description": "Emoncms is a powerful open-source web-app for processing, logging and visualising energy, temperature and other environmental data.",
"url": "https://github.com/inverse/hassio-addon-emoncms",
"webui": "[PROTO:ssl]://[HOST]:[PORT:9541]",
"panel_icon": "mdi:chart-arc",
"panel_title": "Emoncms",
"panel_admin": true,
"startup": "system",
"init": false,
"arch": ["aarch64", "amd64", "armhf", "armv7", "i386"],
"boot": "auto",
"hassio_api": true,
"hassio_role": "default",
"services": ["mysql:want"],
"map": ["ssl"],
"ports": {
Expand Down
26 changes: 26 additions & 0 deletions emoncms/rootfs/etc/cont-init.d/emoncms.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,29 @@ if ! bashio::fs.directory_exists "/data/emoncms"; then
find /data/emoncms -not -perm 0644 -type f -exec chmod 0644 {} \;
find /data/emoncms -not -perm 0755 -type d -exec chmod 0755 {} \;
fi

# Run migrations

bashio::log.info "Running migrations if needed"

export MYSQL_HOST
export MYSQL_NAME
export MYSQL_USERNAME
export MYSQL_PASSWORD
export MYSQL_PORT

if bashio::config.has_value 'remote_mysql_host';then
MYSQL_HOST=$(bashio::config "remote_mysql_host")
MYSQL_NAME=$(bashio::config "remote_mysql_database")
MYSQL_USERNAME=$(bashio::config "remote_mysql_username")
MYSQL_PASSWORD=$(bashio::config "remote_mysql_password")
MYSQL_PORT=$(bashio::config "remote_mysql_port")
else
MYSQL_HOST=$(bashio::services "mysql" "host")
MYSQL_NAME=emoncms
MYSQL_USERNAME=$(bashio::services "mysql" "username")
MYSQL_PASSWORD=$(bashio::services "mysql" "password")
MYSQL_PORT=$(bashio::services "mysql" "port")
fi

php scripts/emoncms-cli admin:dbupdate

0 comments on commit 274271e

Please sign in to comment.