kservices / gBridge-docker

Docker images for gBridge
https://about.gbridge.kappelt.net
MIT License
6 stars 21 forks source link

Is there a arm32v6 container? #1

Open peterkappelt opened 6 years ago

peterkappelt commented 6 years ago

@GAZ082 wrote in the gBridge repository (moved):

Hi there. Is there one container for that arch? Thanks!

peterkappelt commented 6 years ago

Hi Gabriel,

no - not yet.

Are you sure you mean ARM32V2? I've never seen that architecture before, was it just a typo and you need ARM32V7/ ARM32V6 (e.g. for the Raspberry Pi)?

However, gBridge images are based on the "alpine" and "php" docker images. Both of them should be available for ARM32V6, I'm unsure about ARM32V7. If you tell me what (exact) architecture you need, I could provide images for them.

GAZ082 commented 6 years ago

Armv6, 32 bit would be nice! So i can try this out in a Raspberry Pi Zero.

Thanks!

peterkappelt commented 6 years ago

ARM32V6 images are now available, though I couldn't test them, because I currently don't have a RPi with Docker running available.

https://hub.docker.com/r/pkap/gbridge-redis-worker-arm32v6/ https://hub.docker.com/r/pkap/gbridge-web-arm32v6/

After creating your docker compose file (https://about.gbridge.kappelt.net/dockergen/), you need to substitute package names by hand:

If you are using Redis and/ or MySQL in the docker container too, you need to replace them too:

GAZ082 commented 6 years ago

Thanks! I have to solve first the fact docker-compose > 1.13 does not work in Pi and then will test this and report back.

peterkappelt commented 6 years ago

Hi,

let me know when you made any progress or I can help you.

If you want to get quick results in the meantime: I'd like to invite you to the beta test of the hosted gBridge: https://about.gbridge.kappelt.net

GAZ082 commented 6 years ago

Thanks Peter! I'm having trouble finding an arm32v6 version of docker compose. There is one version in the official repo but it's old and does not support composer 3 specification. Is there an alternative to composer to get all running?

peterkappelt commented 6 years ago

It is possible to run it without compose, but I wouldn't recommend it. You basically need to "translate" the compose file to plain docker commands, but you have to care about network creation and startup order then.

After a quick search, I couldn't find current docker-compose-files for your architecture either. However, since you've docker installed on your system, it should be straightforward to build the current docker-compose on your own: https://www.berthon.eu/2017/getting-docker-compose-on-raspberry-pi-arm-the-easy-way/

The simplest way would be to just change to compose file version. Just change version: '3' to version: '2'. It seems to work, since currently no features of version 3 are used. Version 2 is compatible with your compose version, isn't it?

peterkappelt commented 6 years ago

As ist seems, you could install a new compose version with the Python package manager, too:

apt-get remove docker-compose
pip install docker-compose

(You might need to install pip, I think the apt-package is called "python-pip")

GAZ082 commented 6 years ago

Thanks! I succesfully installed docker via pip in a virtualenv but decided to try the available docker-compose (1.8) that is in the official reppo by changing the version file to 2. Looks like this is not liked by it: services.web.ports is invalid: Invalid port ":80", should be [[remote_ip:]remote_port[-remote_port]:]port[/protocol]

In the config file the port web line is: ports:

peterkappelt commented 6 years ago

Diy you fill in the field "Webserver Port" in the "App Settings" while generating the docker file?

GAZ082 commented 6 years ago

Nice catch!

GAZ082 commented 6 years ago

Pulling database (mysql:5)... 5: Pulling from library/mysql ERROR: no matching manifest for unknown in the manifest list entries

:O

peterkappelt commented 6 years ago

Did you swap out the docker image names, too? It tries to pull the official mysql package, that is not available for ARM.

Try replacing mysql:5 with hypriot/rpi-mysql:latest

GAZ082 commented 6 years ago

Took my time and started from scratch. Made a new Google Action project and changed the containers in the composer file.

That MYSQL container asks for a MYSQL_ROOT_PASSWORD, added that env variable to the file and stopped whinning.

Now i get constantly this: redis-worker_1 | MQTT client reconnected!

redis-worker_1 | > gbridge-redis-worker@1.0.0 start /usr/src/gbridge-redis-worker redis-worker_1 | > node index.js redis-worker_1 | redis-worker_1 | Redis client (subscribe) connected redis-worker_1 | Redis client (cache) connected redis-worker_1 | MQTT client offline! redis-worker_1 | Redis client (subscribe) successful subscribe to gbridge:u:d:* redis-worker_1 | MQTT client reconnected! redis-worker_1 | MQTT client reconnected! gbridge_web_1 exited with code 139 redis-worker_1 | MQTT client reconnected! redis-worker_1 | MQTT client reconnected! redis-worker_1 | MQTT client reconnected! redis-worker_1 | MQTT client reconnected! redis-worker_1 | MQTT client reconnected! redis-worker_1 | MQTT client reconnected! redis-worker_1 | MQTT client reconnected!

What can it be? I already tried running the docker as super user.

Thanks!

PS: does all the logging happens in ram? Because running in a sdcard, i need to minimize the writing.

GAZ082 commented 6 years ago

Hello? 😊

peterkappelt commented 6 years ago

Sorry, I've been on abroad the last couple of days.

This message basically means, that the script inside of one of the docker containers is unable to connect to your MQTT server.

Could you please double check and show the config of the mqtt broker in the docker-compose.yml file?

What MQTT broker have you running (Mosquitto, HiveMQ, ...)? Which version?

GAZ082 commented 6 years ago

GBRIDGE_REDISWORKER_MQTT: 'mqtt://localhost:51883' mosquitto version 1.5.1 mosquitto is an MQTT v3.1.1 broker.

Tried setting up a mqtt user just in case there was some kind of conflict with other device connected to the broker and also had this issue.

Also tried removing the mqtt:// and same issue.

In mosquitto's config the port is 51883 and the protocol mqtt. Had no issues connecting with other google bridge but externally, not in the localhost.

peterkappelt commented 6 years ago

Local host points to the docker container, not the docker host.

Try to use the external IP of the docker host (e.g. 192.x.x.x or 172.x.x.x) instead of localhost

GAZ082 commented 6 years ago

Yeah! It worked. But now i get:

gbridge_web_1 exited with code 139

peterkappelt commented 6 years ago

The gbridge_web-Container is based on the armhf/php:7.0-apache which is known to be buggy and is now deprecated.

However, I (currently) can't find another docker container that contains Apache and PHP for arm32v6. It would be great if you could do a quick search too, in case I'm missing something.

It might be possible to use Nginx with PHP, but I haven't worked with Nginx in the last year. So it'll take some time for me to implement.

GAZ082 commented 6 years ago

I'll look into it, but I think Apache is very bloated for what is needed, NGINX is more lightweight.

peterkappelt commented 6 years ago

Yeah - totally true. But I know how Apache works and needs to by configured, so it is my first choice here ;)

Nginx would probably be way better as a long term solution.

GAZ082 commented 6 years ago

And what are your requirements for the web side of your application? I may help you out to make the transition.

peterkappelt commented 6 years ago

I've tried to convert it to NGINX. It works, at least on x86.

The new NGINX version is not yet supported by the Web-Docker-Generator, since I've not yet tested this new version thoroughly.

Please modify your docker-compose-file as shown:

version: '3'
networks:
  backend:
    driver: bridge
  web_frontend:
    driver: bridge

services:
  database:
    #!!! leave as it is
  cache:
    #!!! leave as it is
  web:
    image: pkap/gbridge-web-nginx:arm32v6-latest
    restart: always
    ports:
     #!!! leave as it is
    environment: &webapp-environment
      #!!! leave environment keys as they are
    links:
      - database
      - cache
      - web-fpm
    depends_on: 
      - database
      - cache
      - web-fpm
    networks:
      - web_frontend
      - backend
    volumes:
      - websrc:/var/www
  web-fpm:
    image: pkap/gbridge-web-fpm:arm32v6-latest
    restart: always
    networks:
      - backend
    volumes:
      - websrc:/var/www
    environment: *webapp-environment
  redis-worker:
    image: pkap/gbridge-redis-worker:arm32v6-latest
    restart: always
    environment:
      #!!! leave environment keys as they are
    networks:
      - backend
    links:
      - cache
    depends_on:
      - cache
volumes:
  websrc:

Have a good one!

GAZ082 commented 6 years ago

Dang:

ERROR: yaml.parser.ParserError: while parsing a block mapping
  in "./docker-compose.yml", line 1, column 1
expected <block end>, but found '<block mapping start>'
  in "./docker-compose.yml", line 29, column 3
version: '2' //so i can work with my version of composer, but also if change back to 3 i get the same error
networks:
  backend:
    driver: bridge
  web_frontend:
    driver: bridge

services:
   database:
      image: 'hypriot/rpi-mysql:latest'
      restart: always
      environment:
         MYSQL_RANDOM_ROOT_PASSWORD: 'true'
         MYSQL_DATABASE: gbridge_db
         MYSQL_USER: gbridge_db
         MYSQL_PASSWORD: xx
         MYSQL_ROOT_PASSWORD: xx
      expose:
         - '3306'
      networks:
         - backend
   cache:
      image: 'arm32v6/redis:4-alpine'
      restart: always
      expose:
         - '6379'
      networks:
         - backend
  web:
    image: pkap/gbridge-web-nginx:arm32v6-latest
    restart: always
      ports:
         - '50080:80'
    environment: &webapp-environment
         APP_ENV: production
         APP_KEY: 'base64:xxx='
         APP_DEBUG: 'false'
         APP_LOG_LEVEL: warning
         APP_URL: 'http://localhost'
         DB_CONNECTION: mysql
         DB_HOST: database
         DB_PORT: 3306
         DB_DATABASE: gbridge_db
         DB_USERNAME: gbridge_db
         DB_PASSWORD: xx
         BROADCAST_DRIVER: log
         CACHE_DRIVER: file
         SESSION_DRIVER: file
         SESSION_LIFETIME: 120
         QUEUE_DRIVER: sync
         REDIS_HOST: cache
         REDIS_PASSWORD: 'null'
         REDIS_PORT: '6379'
         MAIL_DRIVER: smtp
         MAIL_HOST: ERROR
         MAIL_PORT: ERROR
         MAIL_USERNAME: ERROR
         MAIL_PASSWORD: ERROR
         MAIL_ENCRYPTION: ERROR
         GOOGLE_CLIENTID: xxx
         GOOGLE_PROJECTID: xxx
    links:
      - database
      - cache
      - web-fpm
    depends_on: 
      - database
      - cache
      - web-fpm
    networks:
      - web_frontend
      - backend
    volumes:
      - websrc:/var/www
  web-fpm:
    image: pkap/gbridge-web-fpm:arm32v6-latest
    restart: always
    networks:
      - backend
    volumes:
      - websrc:/var/www
    environment: *webapp-environment
  redis-worker:
    image: pkap/gbridge-redis-worker:arm32v6-latest
    restart: always
    environment:
         GBRIDGE_REDISWORKER_REDIS: 'redis://cache:6379'
         GBRIDGE_REDISWORKER_MQTT: 'mqtt://192.168.1.3:51883'
         GBRIDGE_REDISWORKER_MQTTUSER: "xx"
         GBRIDGE_REDISWORKER_MQTTPASSWORD: "xx"
         GBRIDGE_REDISWORKER_HOMEGRAPHKEY: xx-xx
    networks:
      - backend
    links:
      - cache
    depends_on:
      - cache
volumes:
  websrc:
peterkappelt commented 6 years ago

There were a couple of indentation mistakes in your config file, I've fixed them for you.

Please try this one (https://filebin.net/ta8xs2n0m0fchyby/gaz082-config.yaml?t=b3bf2xqb) and just fill in your information

halinet commented 5 years ago

The docker hypriot/rpi-mysql:latest is old version of mySql. When i execute docker-compose exec web-fpm php artisan migrate ERROR : docker SQLSTATE[42000]: Syntax error or access violation json null.

It`s be solved by replacing hypriot/rpi-mysql:latest to williamdes/docker-mariadb-debian:10.2.10-armhf

gosuto-inzasheru commented 5 years ago

ARM32V6 images are now available, though I couldn't test them, because I currently don't have a RPi with Docker running available.

https://hub.docker.com/r/pkap/gbridge-redis-worker-arm32v6/ https://hub.docker.com/r/pkap/gbridge-web-arm32v6/

After creating your docker compose file (https://about.gbridge.kappelt.net/dockergen/), you need to substitute package names by hand:

  • 'pkap/gbridge-web:latest' -> 'pkap/gbridge-web-arm32v6:latest'
  • 'pkap/gbridge-redis-worker:latest' -> 'pkap/gbridge-redis-worker-arm32v6:latest'

If you are using Redis and/ or MySQL in the docker container too, you need to replace them too:

  • 'redis:4' -> 'arm32v6/redis:4-alpine'
  • 'mysql:5' -> 'hypriot/rpi-mysql:latest'; I didn't find an official MySQL container for ARM, don't know whether this one is ok

Please note the correct package names are:

gosuto-inzasheru commented 5 years ago

Furthermore;

lbascones commented 4 years ago

Hello all. It's been quiet around here, but perhaps someone can give me an idea of what I may be doing wrong with my setup.

I'm hosting my own gBridge in an rPi 3 exposed via duckDns. Pretty good so far. I was able to follow the instructions in this discussion, and substitute packages as necessary with arm32 equivalents. When I run 'docker-compose up', it all seems to work fine. But when I try to go into production mode via 'docker-compose exec web php artisan migrate' I get an error that makes little sense to me:

master@gbridge:/opt/gbridge $ docker-compose exec web php artisan migrate OCI runtime exec failed: exec failed: container_linux.go:346: starting container process caused "exec: \"php\": executable file not found in $PATH": unknown

It would suggest that the PATH inside the container is not set up correctly, and therefore it can't find PHP (??).

My docker-compose.yml is as follows (changed the extension to "txt" to make the editor happy):

docker-compose.txt

Can someone help me shed some light on the cause of the error?

Thanks!

-LuisB

dony71 commented 4 years ago

Hello all. It's been quiet around here, but perhaps someone can give me an idea of what I may be doing wrong with my setup.

I'm hosting my own gBridge in an rPi 3 exposed via duckDns. Pretty good so far. I was able to follow the instructions in this discussion, and substitute packages as necessary with arm32 equivalents. When I run 'docker-compose up', it all seems to work fine. But when I try to go into production mode via 'docker-compose exec web php artisan migrate' I get an error that makes little sense to me:

master@gbridge:/opt/gbridge $ docker-compose exec web php artisan migrate OCI runtime exec failed: exec failed: container_linux.go:346: starting container process caused "exec: "php": executable file not found in $PATH": unknown

It would suggest that the PATH inside the container is not set up correctly, and therefore it can't find PHP (??).

My docker-compose.yml is as follows (changed the extension to "txt" to make the editor happy):

docker-compose.txt

Can someone help me shed some light on the cause of the error?

Thanks!

-LuisB

you need to run sudo docker-compose exec web-fpm php artisan migrate