jethro-pmm icon indicating copy to clipboard operation
jethro-pmm copied to clipboard

Database migration to new server

Open dragonwocky opened this issue 7 months ago • 3 comments

Hi there,

I'm in the process of moving our Jethro install onto a new server and run into a couple of challenges:

  • With PHP 8.3.9, I get "An error occurred. Please contact your system administrator for help." and this in the logs whenever I perform a search:

    NOTICE: PHP message: Creation of dynamic property View__Mixed_Search::$_search_params is deprecated - Line 12 of /var/www/html/jethro/views/view_0_mixed_search.class.php
    127.0.0.1 -  11/Jul/2024:03:37:23 +0000 "GET /jethro/index.php" 200
    NOTICE: PHP message: Cannot modify header information - headers already sent by (output started at /var/www/html/jethro/include/system_controller.class.php:313) - Line 168 of /var/www/html/jethro/include/general.php
    

    After downgrading to PHP 8.0.30, search works fine again. I can live with that, but figured it might be a bug worth reporting.

  • Profile images don't seem to have come across along with the rest of the data. When heading to any profile that has a picture set on the old server, it fails to load on the new server: image I can confirm that there's data in the person_photo table, and if I upload a new image as the profile it will display. This I'm stumped on, and would appreciate some help with.

Potentially relevant infomation:

  • I have define('SQL_MODE', 'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'); in my conf.php.

  • I did the data import by doing a mysqldump on both installs, then combining the table initialisations from the new server with the insert statements from the old server and then running that on the new server. I didn't have any success running the dump from the old server directly/unmodified on the new server.

  • The old server is running on a Raspberry Pi. The new server is running in a container with the configuration below. Both are using Jethro 2.35.1.

    Dockerfile

    FROM caddy:2.8.4-builder AS caddy
    RUN xcaddy build \
      --with github.com/baldinof/caddy-supervisor \
      --with github.com/caddyserver/replace-response
    
    FROM php:8.0.30-fpm
    COPY --from=caddy /usr/bin/caddy /usr/bin/caddy
    
    RUN apt-get update \
      && apt-get install -y curl unzip libcurl4-openssl-dev libfreetype-dev libjpeg62-turbo-dev libpng-dev \
      && docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ \
      && docker-php-ext-install gd pdo pdo_mysql mysqli gettext exif
    
    RUN mkdir -p /var/www/html/jethro && cd /var/www/html/jethro \
      && curl -LO https://github.com/tbar0970/jethro-pmm/releases/download/v2.35.1/jethro-2.35.1.zip \
      && unzip jethro-*.zip && chown -R www-data:www-data .
    
    CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile"]
    

    docker-compose.yaml

    services:
      jethro:
        build: ./jethro
        restart: always
        volumes:
          - ./jethro/files:/var/www/html/jethro/files
          - ./jethro/conf.php:/var/www/html/jethro/conf.php
          - ./jethro/jethro-white.png:/var/www/html/jethro/resources/img/jethro-white.png
          - ./jethro/iphone-icon.png:/var/www/html/jethro/resources/img/iphone-icon.png
          - ./jethro/terms.html:/var/www/html/jethro/terms/index.html
          - ./jethro/Caddyfile:/etc/caddy/Caddyfile
        environment:
          - DB_TYPE=mysql
          - DB_HOST=jethro_db
          - DB_USERNAME=root
          - DB_PASSWORD=realpasswordhere
          - DB_DATABASE=jethro
          - BASE_URL=https://example.com/jethro/
        depends_on: [jethro_db]
      jethro_db:
        image: mysql:8.4.1
        restart: always
        volumes: [jethro_db:/var/lib/mysql]
        environment:
          - MYSQL_ROOT_PASSWORD=realpasswordhere
          - MYSQL_DATABASE=jethro
    volumes:
      jethro_db:
    

    Caddyfile

    {
        supervisor {
      	  php-fpm
        }
    }
    
    root * /var/www/html
    php_fastcgi 127.0.0.1:9000
    file_server
    

Thanks!

dragonwocky avatar Jul 11 '24 04:07 dragonwocky