Skip to content

reimannf/hubic2swiftgate4docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hubic2swiftgate4docker

Provides the functionality from https://github.com/oderwat/hubic2swiftgate in dockerized fashion. Inspired by https://github.com/jkaberg/docker-hubic2swiftgate.

All configuration can be passed via a docker volume. That volume is also used to store the cache file. So a restart of the docker container image does not require a new registration.

Patched hubic2swiftgate

The original hubic2swiftgate code is pathched to read the config.php and get the cache folder from the docker volume. It should always be mounted to /config.

Config structure

The Repo contains a config-sample folder, which can be used as copy template. The structure is as follows:

  • apache: Contains the vhost conf for apache. The file 001-hubic2swiftgate.conf will be linked to /etc/apache2/sites-enabled. If you are using ssl ensure proper certificates in folder ssl, otherwise apache will not start.
  • cache: Folder where hubic2swiftgate will store access token and endpoint url.
  • ssl: Put your server.crt and server.key here. Check that the vhost conf 001-hubic2swiftgate.conf will use it accordingly.
  • config.php: Put you HubiC client_id, client_secret and password here. The password is bound to the fixed user hubic which is used from hubic2swiftgate.

If you are facing issues with permissions from the container to host directory, change the ownership of that files: chown -R 33:33 /path/to/config

Alternatively you can specify a user PUID and group id PGID via the environment. In that case the www-data user and group will get this ids.

Setup

The main documentation can be found on hubic2swiftgate

  • Setup HubiC

  • Setup hubic2swiftgate

    Put the values to /path/to/config/config.php

  • Starting the container image

    docker run -d --restart always -p 8443:443 -v </path/to/config>:/config reimannf/hubic2swiftgate4docker

  • Or starting the container image with user and group id

    docker run -d --restart always -p 8443:443 -v </path/to/config>:/config -e PGID=<gid> -e PUID=<uid> reimannf/hubic2swiftgate4docker

  • Register client

    http[s]://yourserver.com:8443/register/?client=hubic&password=pwd_from_config.php

  • Check Usage

    http[s]://yourserver.com:8443/usage

Info

  • Why a docker volume?

    I prefer to have such configurations not baked into the docker image. Now the docker container image can run multiple configurations and the externalised cache folder allows that the app registrations on HubiC survives a restart.

  • Why Apache?

    nginx with php-fhm would require additional orchestration effort to run more than 1 process in one container.