Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impossible to install in Docker (PHP7 not supported, PHP8 breaking changes) #787

Open
PatrykPlewaOfficial opened this issue Dec 10, 2024 · 2 comments

Comments

@PatrykPlewaOfficial
Copy link

Bug report

Title

There is a mismatch in the repository between PHP version expected in composer.json and the one installed in Dockerfile.
Running UVDesk is no longer possible on PHP7.4.

However, after selecting the Ubuntu version manually to 20.04 and replacing all PHP packages with any version 8+ it is no longer possible to install UVDesk due to breaking changes in PHP inside the migrations files.

Issue Description

In file /var/www/uvdesk/vendor/doctrine/migrations/lib/Doctrine/Migrations/Configuration/Connection/Loader/ConnectionHelperLoader.php

 public function __construct(?HelperSet $helperSet = null, string $helperName)

the optional parameter $helperSet comes first. Since PHP8 this is no longer possible. This causes the migrations to fail.

Preconditions

Dockerfile

FROM ubuntu:20.04

ENV GOSU_VERSION 1.11

RUN adduser uvdesk -q --disabled-password --gecos ""

# Install base supplimentary packages
RUN apt-get update && apt-get -y upgrade \
    && apt-get update && apt-get install -y software-properties-common && add-apt-repository -y ppa:ondrej/php \
    && apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install \
        curl \
        wget \
        git \
        unzip \
        apache2 \
        mysql-server \
        php8.2 \
        libapache2-mod-php8.2 \
        php8.2-common \
        php8.2-xml \
        php8.2-imap \
        php8.2-mysql \
        php8.2-mailparse \
        ca-certificates; \
    if ! command -v gpg; then \
		apt-get install -y --no-install-recommends gnupg2 dirmngr; \
	elif gpg --version | grep -q '^gpg (GnuPG) 1\.'; then \
		apt-get install -y --no-install-recommends gnupg-curl; \
	fi;

COPY ./.docker/config/apache2/env /etc/apache2/envvars
COPY ./.docker/config/apache2/httpd.conf /etc/apache2/apache2.conf
COPY ./.docker/config/apache2/vhost.conf /etc/apache2/sites-available/000-default.conf
COPY ./.docker/bash/uvdesk-entrypoint.sh /usr/local/bin/
COPY . /var/www/uvdesk/

RUN \
    # Update apache configurations
    a2enmod php8.2 rewrite; \
    chmod +x /usr/local/bin/uvdesk-entrypoint.sh; \
    # Install gosu for stepping-down from root to a non-privileged user during container startup
    dpkgArch="$(dpkg --print-architecture | awk -F- '{ print $NF }')"; \
    wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch" \
    && wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$dpkgArch.asc"; \
    # Verify gosu installation
    export GNUPGHOME="$(mktemp -d)" \
    && gpg --batch --keyserver hkps://keys.openpgp.org --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
	&& gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
    && gpgconf --kill all \
    && chmod +x /usr/local/bin/gosu \
    && gosu nobody true; \
    \
    # Download and verify composer installer signature
    wget -O /usr/local/bin/composer.php "https://getcomposer.org/installer"; \
    actualSig="$(wget -q -O - https://composer.github.io/installer.sig)"; \
    currentSig="$(shasum -a 384 /usr/local/bin/composer.php | awk '{print $1}')"; \
    if [ "$currentSig" != "$actualSig" ]; then \
        echo "Warning: Failed to verify composer signature."; \
        exit 1; \
	fi; \
    # Install composer
    php /usr/local/bin/composer.php --quiet --filename=/usr/local/bin/composer \
    && chmod +x /usr/local/bin/composer; \
    # Assign user uvdesk the ownership of source directory
    chown -R uvdesk:uvdesk /var/www; \
    # Clean up files
    rm -rf \
        "$GNUPGHOME" \
        /var/lib/apt/lists/* \
        /usr/local/bin/gosu.asc \
        /usr/local/bin/composer.php \
        /var/www/bin \
        /var/www/html \
        /var/www/uvdesk/.docker;

# Change working directory to uvdesk source
WORKDIR /var/www

ENTRYPOINT ["uvdesk-entrypoint.sh"]
CMD ["/bin/bash"]

Steps to reproduce

Build new image and start the container. Proceed to install in the browser.

Expected result

Successful installation

Actual result

POST wizard/xhr/load/migrations returns

<b>Deprecated</b>:  Optional parameter $helperSet declared before required parameter $helperName is implicitly treated as a required parameter in <b>/var/www/uvdesk/vendor/doctrine/migrations/lib/Doctrine/Migrations/Configuration/Connection/Loader/ConnectionHelperLoader.php</b> on line <b>25</b><br/>[]

Installation is never completed.

@papnoisanjeev
Copy link
Collaborator

@PatrykPlewaOfficial
Try with this

@PatrykPlewaOfficial
Copy link
Author

Thank you @papnoisanjeev .

When setting up the built-in MySQL DB, there is some issue in `./docker/bash/uvdesk-entrypoint.sh.

mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'
Error: Failed to establish a connection with mysql server (localhost)

Secondly, when omitting setting up the DB (no env variables), there is still an issue. In the web browser, the container returns 500 without any specific error message. No errors in the Docker console.

Attaching the /var/log/apache2/error.log file

[mpm_prefork:notice] [pid 30] AH00163: Apache/2.4.41 (Ubuntu) configured -- resuming normal operations
[core:notice] [pid 30] AH00094: Command line: '/usr/sbin/apache2'
[php:warn] [pid 33] [client 172.23.0.1:55308] PHP Warning:  require_once(/var/www/uvdesk/vendor/autoload_runtime.php): Failed to open stream: No such file or directory in /var/www/uvdesk/public/index.php on line 5
[php:error] [pid 33] [client 172.23.0.1:55308] PHP Fatal error:  Uncaught Error: Failed opening required '/var/www/uvdesk/vendor/autoload_runtime.php' (include_path='.:/usr/share/php') in /var/www/uvdesk/public/index.php:5\nStack trace:\n#0 {main}\n  thrown in /var/www/uvdesk/public/index.php on line 5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants