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

Install script fails on alpine 3.20 for official php docker images #905

Closed
mvanduijker opened this issue May 23, 2024 · 5 comments · Fixed by #913
Closed

Install script fails on alpine 3.20 for official php docker images #905

mvanduijker opened this issue May 23, 2024 · 5 comments · Fixed by #913
Labels
bug Something isn't working
Milestone

Comments

@mvanduijker
Copy link

Install script fails on alpine 3.20 for official docker image tags

Description

Yesterday official docker images are released with alpine 3.20. The "naked" (like php:8.3-fpm-alpine) alpine tags are upgraded to this version but the install script fails with this error:

FATAL: failed to copy daemon init script to /etc/init.d/newrelic-daemon
FATAL: New Relic agent installation failed.
        Please contact https://support.newrelic.com/
        and report the above error. We have also created a tar file with
        log files and other system info that can help solve the problem.
        If the file /tmp/nrinstall-20240523-054511-10.tar exists please attach it to your bug report.
        We apologize for the inconvenience.

Steps to Reproduce

build this dockerfile

FROM docker.io/library/php:8.3-fpm-alpine

ENV NEWRELIC_VERSION=10.21.0.11
ARG TARGETPLATFORM

# this directory needs to exist for the copy command in the production stage to not fail
RUN mkdir -p /extension

RUN set -eux ; \
    curl \
      --silent \
      --fail \
      --location \
      --user-agent Dockerfile \
      --url https://download.newrelic.com/php_agent/archive/${NEWRELIC_VERSION}/newrelic-php5-${NEWRELIC_VERSION}-linux-musl.tar.gz \
      --output - \
      | tar --directory /tmp --extract --gzip --file - ; \
    export NR_INSTALL_USE_CP_NOT_LN=1 NR_INSTALL_SILENT=1 ; \
    /tmp/newrelic-php5-*/newrelic-install install ; \
    cp "$(php -r "echo ini_get ('extension_dir');")/newrelic.so" /extension/ ; \
    rm -rf /tmp/*;

Expected Behavior

Relevant Logs / Console output

FATAL: failed to copy daemon init script to /etc/init.d/newrelic-daemon
FATAL: New Relic agent installation failed.
        Please contact https://support.newrelic.com/
        and report the above error. We have also created a tar file with
        log files and other system info that can help solve the problem.
        If the file /tmp/nrinstall-20240523-054511-10.tar exists please attach it to your bug report.
        We apologize for the inconvenience.

Your Environment

Additional context

Building the docker container with alpine 3.19 works. So if you have this issue, set docker tag to something like php:8.3-fpm-alpine3.19

@mvanduijker mvanduijker added the bug Something isn't working label May 23, 2024
@workato-integration
Copy link

@Jimbolino
Copy link

possible workaround for the bugged install script:

mkdir /etc/conf.d && mkdir /etc/init.d

Alpine 3.20 removed these empty directories, and the install script expects these directories to be present.
I'm not sure where the newrelic-install script source is located, but reading it i found another bug:

In the doc it says NR_INSTALL_INITSCRIPT, but later on NR_INSTALL_INITFILE is used. You could set this to a temp folder, so you dont need to create the /etc/init.d/ folder.
But no such mechanism exists for the /etc/conf.d problem, because the path is hardcoded:

    elif [ "${ostype}" = "alpine" ]; then
      sysconf=/etc/conf.d/newrelic-daemon
    fi

@workato-integration
Copy link

Work has been completed on this issue.

@workato-integration
Copy link

Work has been completed on this issue.

@bilal-07
Copy link

Below is the commands that works for me in php:8.1-fpm-alpine

RUN mkdir -p /etc/conf.d && mkdir -p /etc/init.d
#Install Newrelic Agent
ENV NEW_RELIC_AGENT_VERSION=10.12.0.1
RUN curl -L https://download.newrelic.com/php_agent/archive/${NEW_RELIC_AGENT_VERSION}/newrelic-php5-${NEW_RELIC_AGENT_VERSION}-linux-musl.tar.gz | tar -C /tmp -zx \
    && export NR_INSTALL_USE_CP_NOT_LN=1 \
    && export NR_INSTALL_SILENT=1 \
    && export NR_INSTALL_INITFILE=/tmp/newrelic-daemon \
    && /tmp/newrelic-php5-*/newrelic-install install \
    && rm -rf /tmp/newrelic-php5-* /tmp/nrinstall* 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants