tobybatch / kimai2

Docker containers for the kimai2 web application including docker-compose and kubernetes/helm deployment.
MIT License
181 stars 96 forks source link

Issue with "Easybackup" Plugin in Kimai Docker Environment #546

Closed tamenmd closed 1 year ago

tamenmd commented 1 year ago

I've been using the Kimai Docker integration, maintained by Toby, for my time tracking needs for quite some time now. However, I recently encountered an issue with the 'Easybackup' plugin that I would really love to get fixed.

Describe the bug When attempting to use the "Easybackup" plugin within the Kimai Docker environment, I consistently encounter the following error message: error message In addition to the error message, you can find the corresponding log here:

[2023-09-10 13:25:46] INFO: --- S T A R T   C R E A T I N G   B A C K U P ---
[2023-09-10 13:25:46] INFO: Creating backup dir '/opt/kimai/var/easy_backup/2023-09-10_132546/'.
[2023-09-10 13:25:46] INFO: Creating manifest file '/opt/kimai/var/easy_backup/2023-09-10_132546/manifest.json'.
[2023-09-10 13:25:46] INFO: Get files and dirs to backup.
[2023-09-10 13:25:46] INFO: Start to backup '/opt/kimai/.env'.
[2023-09-10 13:25:46] INFO: It's a file. Start to copy it to '/opt/kimai/var/easy_backup/2023-09-10_132546/.env'.
[2023-09-10 13:25:46] INFO: Start to backup '/opt/kimai/config/packages/local.yaml'.
[2023-09-10 13:25:46] WARNING: Path '/opt/kimai/config/packages/local.yaml' is not existing or not accessable.
[2023-09-10 13:25:46] INFO: Start to backup '/opt/kimai/var/data/'.
[2023-09-10 13:25:46] INFO: It's a directory. Start to mirror it to '/opt/kimai/var/easy_backup/2023-09-10_132546/var/data/'.
[2023-09-10 13:25:46] INFO: Start to backup '/opt/kimai/var/plugins/'.
[2023-09-10 13:25:46] INFO: It's a directory. Start to mirror it to '/opt/kimai/var/easy_backup/2023-09-10_132546/var/plugins/'.
[2023-09-10 13:25:47] INFO: Start to backup '/opt/kimai/var/invoices/'.
[2023-09-10 13:25:47] WARNING: Path '/opt/kimai/var/invoices/' is not existing or not accessable.
[2023-09-10 13:25:47] INFO: Start to backup '/opt/kimai/templates/invoice/'.
[2023-09-10 13:25:47] INFO: It's a directory. Start to mirror it to '/opt/kimai/var/easy_backup/2023-09-10_132546/templates/invoice/'.
[2023-09-10 13:25:47] INFO: Start to backup '/opt/kimai/var/export/'.
[2023-09-10 13:25:47] WARNING: Path '/opt/kimai/var/export/' is not existing or not accessable.
[2023-09-10 13:25:47] INFO: Start to backup '/opt/kimai/templates/export/'.
[2023-09-10 13:25:47] INFO: It's a directory. Start to mirror it to '/opt/kimai/var/easy_backup/2023-09-10_132546/templates/export/'.
[2023-09-10 13:25:47] INFO: Start database backup.
[2023-09-10 13:25:47] INFO: Used database: 'mysql'.
[2023-09-10 13:25:47] ERROR: sh: syntax error: EOF in backquote substitution
[2023-09-10 13:25:47] INFO: No git repository recognized. Expected path: /opt/kimai/var/plugins/EasyBackupBundle/.git

Desktop:

Docker compose file (with passwords redacted) I am using the Docker Compose file provided by Toby, which can be found here. You can see my configuration:

version: '3.5'
services:

  sqldb:
    image: mysql:5.7
    environment:
      - MYSQL_DATABASE=testdatabase
      - MYSQL_USER=testuser
      - MYSQL_PASSWORD=testpassword
      - MYSQL_ROOT_PASSWORD=testrootpassword
    ports:
      - 3336:3306
    volumes:
      - mysql:/var/lib/mysql
    command: --default-storage-engine innodb
    restart: unless-stopped
    healthcheck:
      test: mysqladmin -p$$MYSQL_ROOT_PASSWORD ping -h localhost
      interval: 20s
      start_period: 10s
      timeout: 10s
      retries: 3
    labels:
      - "com.centurylinklabs.watchtower.enable=true"

  nginx:
    image: tobybatch/nginx-fpm-reverse-proxy
    ports:
      - 8001:80
    volumes:
      - public:/opt/kimai/public:ro
    restart: unless-stopped
    depends_on:
      - kimai
    healthcheck:
      test:  wget --spider http://nginx/health || exit 1
      interval: 20s
      start_period: 10s
      timeout: 10s
      retries: 3
    labels:
      - "com.centurylinklabs.watchtower.enable=true"

  kimai: # This is the latest FPM image of kimai
    image: kimai/kimai2:fpm-dev
    environment:
      - ADMINMAIL=mail
      - ADMINPASS=adminpw
      - DATABASE_URL=mysql://testuser:testpassword@sqldb/testdatabse?charset=utf8&serverVersion=5.7
      - TRUSTED_HOSTS=nginx,localhost,127.0.0.1,myurl.from.nginx.reverse.proxy
      - memory_limit=500M
      - MAILER_URL=smtp://mailer:1025
      - MAILER_FROM=kimai@example.com
    volumes:
      - public:/opt/kimai/public
      - /mnt/media/docker/kimai/plugins:/opt/kimai/var/plugins
      # - var:/opt/kimai/var
      # - ./ldap.conf:/etc/openldap/ldap.conf:z
      # - ./ROOT-CA.pem:/etc/ssl/certs/ROOT-CA.pem:z
    restart: unless-stopped
    labels:
      - "com.centurylinklabs.watchtower.enable=true"

  phpmyadmin:
    image: phpmyadmin
    restart: always
    ports:
      - 8081:80
    environment:
      - PMA_ARBITRARY=1
    labels:
      - "com.centurylinklabs.watchtower.enable=true"

  swagger:
    image: swaggerapi/swagger-ui
    ports:
      - 8080:8080
    volumes:
      - ./swagger.json:/swagger.json
    environment:
      - SWAGGER_JSON=/swagger.json
    labels:
      - "com.centurylinklabs.watchtower.enable=true"

  mailer:
    image: schickling/mailcatcher
    ports:
      - "${MAILER_SMTP_PORT:-1025}:1025"
      - "${MAILER_ADMIN_PORT:-1080}:1080"
    labels:
      - "com.centurylinklabs.watchtower.enable=true"

volumes:
    var:
    public:
    mysql:

Additional context I'm seeking guidance on how to resolve this issue or how to configure the Docker container to include MySQL/mysqldump, allowing the "Easybackup" plugin to function correctly. If anyone has encountered a similar problem or has insights on how to configure the Docker environment to address this, please share your thoughts.

Best regards.

kevinpapst commented 1 year ago

How is that a bug of the Docker image?

Please include image and logs in your issue, not on some external page.

tobybatch commented 1 year ago

@tamenmd Any more info on this?

tamenmd commented 1 year ago

@tobybatch At the moment, unfortunately not. Currently, I am using Proxmox to back up the entire virtual machine, and in case of data loss, I rely on this backup for restoration. I haven't yet figured out how to integrate this plugin into my environment.

tamenmd commented 1 year ago

Hey @tobybatch and @kevinpapst,

Quick update on the 'Easybackup' issue in the Kimai Docker setup:

MySQL/mysqldump Fix: Managed to get MySQL and mysqldump into the container. Made a custom Docker image with this Dockerfile:

FROM kimai/kimai2:fpm-dev

RUN apk update && \
    apk add  mysql-client && \
    rm -rf /var/lib/apt/lists/*

Rebuilt with docker build -t custom-kimai . and switched to the custom-kimai image. This seemed to fix the red quotes in EasyBackup.

Backup Issues: Still hitting some errors when trying to backup. Here's the log:

[2023-11-02 13:17:22] INFO: --- S T A R T   C R E A T I N G   B A C K U P ---
[2023-11-02 13:17:22] INFO: Creating backup dir '/opt/kimai/var/easy_backup/2023-11-02_131722/'.
[2023-11-02 13:17:22] INFO: Creating manifest file '/opt/kimai/var/easy_backup/2023-11-02_131722/manifest.json'.
[2023-11-02 13:17:22] INFO: Get files and dirs to backup.
[2023-11-02 13:17:22] INFO: Start to backup '/opt/kimai/.env'.
[2023-11-02 13:17:22] INFO: It's a file. Start to copy it to '/opt/kimai/var/easy_backup/2023-11-02_131722/.env'.
[2023-11-02 13:17:22] INFO: Start to backup '/opt/kimai/config/packages/local.yaml'.
[2023-11-02 13:17:22] WARNING: Path '/opt/kimai/config/packages/local.yaml' is not existing or not accessable.
[2023-11-02 13:17:22] INFO: Start to backup '/opt/kimai/var/data/'.
[2023-11-02 13:17:22] INFO: It's a directory. Start to mirror it to '/opt/kimai/var/easy_backup/2023-11-02_131722/var/data/'.
[2023-11-02 13:17:22] INFO: Start to backup '/opt/kimai/var/plugins/'.
[2023-11-02 13:17:22] INFO: It's a directory. Start to mirror it to '/opt/kimai/var/easy_backup/2023-11-02_131722/var/plugins/'.
[2023-11-02 13:17:22] INFO: Start to backup '/opt/kimai/var/invoices/'.
[2023-11-02 13:17:22] WARNING: Path '/opt/kimai/var/invoices/' is not existing or not accessable.
[2023-11-02 13:17:22] INFO: Start to backup '/opt/kimai/templates/invoice/'.
[2023-11-02 13:17:22] INFO: It's a directory. Start to mirror it to '/opt/kimai/var/easy_backup/2023-11-02_131722/templates/invoice/'.
[2023-11-02 13:17:22] INFO: Start to backup '/opt/kimai/var/export/'.
[2023-11-02 13:17:22] WARNING: Path '/opt/kimai/var/export/' is not existing or not accessable.
[2023-11-02 13:17:22] INFO: Start to backup '/opt/kimai/templates/export/'.
[2023-11-02 13:17:22] INFO: It's a directory. Start to mirror it to '/opt/kimai/var/easy_backup/2023-11-02_131722/templates/export/'.
[2023-11-02 13:17:22] INFO: Start database backup.
[2023-11-02 13:17:22] INFO: Used database: 'mysql'.
[2023-11-02 13:17:22] ERROR: sh: syntax error: EOF in backquote substitution
[2023-11-02 13:17:22] INFO: No git repository recognized. Expected path: /opt/kimai/var/plugins/EasyBackupBundle/.git

Seems like there might be some file or directory issues. Also, the ERROR: sh: syntax error: EOF in backquote substitution bit is weird.

Any thoughts on these?

Thank you