danielbrendel / hortusfox-web

Self-hosted collaborative plant management and tracking system for plant enthusiasts
https://www.hortusfox.com
MIT License
674 stars 34 forks source link

Having trouble deploying from portainer #194

Closed MazenS closed 5 months ago

MazenS commented 6 months ago

Hello - having trouble deploying Hortusfox from Portainer. I'm sure I've missed something obvious. Thanks in advance for the help

Yaml

version: "3.8"

services:
  app:
    image: ghcr.io/danielbrendel/hortusfox-web:latest
    ports:
      - "1983:80"
    volumes:
      - app_images:/var/www/html/public/img
      - app_logs:/var/www/html/app/logs
      - app_backup:/var/www/html/public/backup
      - app_themes:/var/www/html/public/themes
      - app_migrate:/var/www/html/app/migrations
    environment:
      APP_ADMIN_EMAIL: "myemail"
      APP_ADMIN_PASSWORD: "password"
      DB_HOST: db
      DB_PORT: 3306
      DB_DATABASE: hortusfox
      DB_USERNAME: user
      DB_PASSWORD: password
      DB_CHARSET: "utf8mb4"
    depends_on:
      - db

  db:
    image: mariadb
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: my-secret-pw
      MYSQL_DATABASE: hortusfox
      MYSQL_USER: user
      MYSQL_PASSWORD: password
    ports:
      - "3306:3306"
    volumes:
      - db_data:/var/lib/mysql

volumes:
  db_data:
  app_images:
  app_logs:
  app_backup:
  app_themes:
  app_migrate:

Log from db-1

2024-05-07 13:07:50 0 [Note] InnoDB: log sequence number 47629; transaction id 14
2024-05-07 13:07:50 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2024-05-07 13:07:50 0 [Note] Plugin 'FEEDBACK' is disabled.
2024-05-07 13:07:50 0 [Note] Plugin 'wsrep-provider' is disabled.
2024-05-07 13:07:50 0 [Note] InnoDB: Buffer pool(s) load completed at 240507 13:07:50
2024-05-07 13:07:50 0 [Note] Server socket created on IP: '0.0.0.0'.
2024-05-07 13:07:50 0 [Note] Server socket created on IP: '::'.
2024-05-07 13:07:50 0 [Warning] 'user' entry 'root@2e9f80032ecf' ignored in --skip-name-resolve mode.
2024-05-07 13:07:50 0 [Warning] 'proxies_priv' entry '@% root@2e9f80032ecf' ignored in --skip-name-resolve mode.
2024-05-07 13:07:50 0 [Note] mariadbd: Event Scheduler: Loaded 0 events
2024-05-07 13:07:50 0 [Note] mariadbd: ready for connections.
Version: '11.3.2-MariaDB-1:11.3.2+maria~ubu2204'  socket: '/run/mysqld/mysqld.sock'  port: 3306  mariadb.org binary distribution
2024-05-07 13:07:55 3 [Warning] Aborted connection 3 to db: 'unconnected' user: 'unauthenticated' host: '172.20.0.3' (This connection closed normally without authentication)

Log from app-1 Waiting for database to be available... Attempt 1

MazenS commented 6 months ago

I think you can close the issue - not sure what happened but after redeploying the stack everything looks to be working.

Super pleased though!

image

Meddrin commented 6 months ago

I have the same issue. Redeploying the stack did not solve it for me. Tried running your code with no luck.

MazenS commented 6 months ago

Ok when I get home il double check and repost my configuration. There may have been some drunken tinkering. I'm not sure though

MazenS commented 6 months ago

Ah yeah so it looks like the only change I made was to create the storage volumes outside of where docker usually saves them. Maybe Portainer doesn't have the correct rights there.

version: "3.8"

services:
  app:
    image: ghcr.io/danielbrendel/hortusfox-web:latest
    ports:
      - "1983:80"
    volumes:
      - /home/USER/Documents/Docker/hortusfox/images:/var/www/html/public/img
      - /home/USER/Documents/Docker/hortusfox/logs:/var/www/html/app/logs
      - /home/USER/Documents/Docker/hortusfox/backup:/var/www/html/public/backup
      - /home/USER/Documents/Docker/hortusfox/themes:/var/www/html/public/themes
      - /home/USER/Documents/Docker/hortusfox/migrate:/var/www/html/app/migrations
    environment:
      APP_ADMIN_EMAIL: "myemail"
      APP_ADMIN_PASSWORD: "mypassword"
      DB_HOST: db
      DB_PORT: 3306
      DB_DATABASE: hortusfox
      DB_USERNAME: user
      DB_PASSWORD: password
      DB_CHARSET: "utf8mb4"
    depends_on:
      - db

  db:
    image: mariadb
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: my-secret-pw
      MYSQL_DATABASE: hortusfox
      MYSQL_USER: user
      MYSQL_PASSWORD: password
    ports:
      - "3306:3306"
    volumes:
      - /home/USER/Documents/Docker/hortusfox/db_data:/var/lib/mysql

volumes:
  db_data:
  app_images:
  app_logs:
  app_backup:
  app_themes:
  app_migrate:
danielbrendel commented 5 months ago

Resolved due to found workaround/fix.