kcal-app / kcal

the personal food nutrition journal
Mozilla Public License 2.0
295 stars 27 forks source link

Unable to build on raspberry pi #36

Open kdheepak opened 2 years ago

kdheepak commented 2 years ago

Hi, thanks for making this service. I'm looking forward to using it. Has anyone built this on a raspberry pi? I'm unable to get it to work. The app container keeps crashes immediately after boot. I'm assuming it has something to do with the binary that's being run not being arm compatible.

I also had other issues getting redis, elasticsearch and mysql running on the raspberry pi, but I've been able to slowly work through them by using various different images. Here is the docker compose file that I'm currently using:

  kcal-app:
    image: kcalapp/kcal
    container_name: kcal-app
    restart: unless-stopped
    security_opt:
      - no-new-privileges:true
    tty: true
    working_dir: /app
    env_file: ./kcal/.env
    volumes:
      - './kcal/app/public:/app/public/'
      - './kcal/etc/php/php.ini:/usr/local/etc/php/conf.d/local.ini'
    networks:
      - net
    depends_on:
      - kcal-db

  kcal-db:
    image: hypriot/rpi-mysql
    container_name: kcal-db
    restart: unless-stopped
    tty: true
    privileged: true
    security_opt:
      - no-new-privileges:true
    ports:
      - '${DB_PORT:-3306}:3306'
    environment:
      MYSQL_ROOT_PASSWORD: '${DB_PASSWORD:-kcal}'
      MYSQL_DATABASE: '${DB_DATABASE:-kcal}'
      MYSQL_USER: '${DB_USERNAME:-kcal}'
      MYSQL_PASSWORD: '${DB_PASSWORD:-kcal}'
      MYSQL_ALLOW_EMPTY_PASSWORD: 'yes'
    volumes:
      - './kcal/db/data:/var/lib/mysql/'
      - './kcal/etc/mysql/my.cnf:/etc/mysql/my.cnf'
    networks:
      - net

  kcal-web:
    image: nginx:alpine
    container_name: kcal-web
    security_opt:
      - no-new-privileges:true
    restart: unless-stopped
    tty: true
    working_dir: /app
    volumes:
      - './kcal/app/public:/app/public/'
      - './kcal/etc/nginx/conf.d/:/etc/nginx/conf.d/'
    networks:
      - net
    depends_on:
      - kcal-app
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.kcal-web.rule=Host(`kcal.$DOMAIN`)"
      - "traefik.http.routers.kcal-web.entrypoints=https"

  kcal-elasticsearch:
    image: 'ind3x/rpi-elasticsearch'
    container_name: kcal-elasticsearch
    security_opt:
      - no-new-privileges:true
    environment:
      - xpack.security.enabled=false
      - discovery.type=single-node
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536
        hard: 65536
    cap_add:
      - IPC_LOCK
    volumes:
      - './kcal/elasticsearch/data:/usr/share/elasticsearch/data'
    ports:
      - '${ELASTIC_PORT:-9200}:9200'
    networks:
      - net

  kcal-redis:
    image: 'redis:latest'
    container_name: kcal-redis
    privileged: true
    security_opt:
      - no-new-privileges:true
    ports:
      - '${REDIS_PORT:-6379}:6379'
    volumes:
      - './kcal/redis/data:/data'
    networks:
      - net

I also tried cloning the kcal repo and building an image using the Dockerfile, but changing the php image, but I had no luck. The Dockerfile uses apk, so I had to use the alpine image specified in the file, however I ran into various issues with that while building.

cdubz commented 2 years ago

I’ll give this a try on one of my pis to see if I can get it to work. Docker architectures always confuse me.

kdheepak commented 2 years ago

I'm happy to help too, although I'm fairly new to Docker too. I have a couple of pis that I can test on.