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

Actually fix PHP extensions #829

Merged
merged 5 commits into from
Mar 15, 2023

Conversation

aleksrutins
Copy link
Contributor

@aleksrutins aleksrutins mentioned this pull request Mar 10, 2023
1 task
@Milo123459 Milo123459 added the release/patch Author patch release label Mar 10, 2023
Copy link

@berksmbl berksmbl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not working

╔═══════════════════════════════ Nixpacks v1.5.0 ══════════════════════════════╗
║ setup      │ (php81.withExtensions (pe: pe.enabled ++ [pe.all.imagick        ║
║            │ pe.all.mongodb pe.all.redis])), perl, nginx, libmysqlclient,    ║
║            │ php81Packages.composer, nodejs-16_x, npm-8_x,                   ║
║            │ php81Extensions.imagick, php81Extensions.mongodb,               ║
║            │ php81Extensions.redis                                           ║
║──────────────────────────────────────────────────────────────────────────────║
║ install    │ mkdir -p /var/log/nginx && mkdir -p /var/cache/nginx            ║
║            │ composer install                                                ║
║            │ npm i                                                           ║
║──────────────────────────────────────────────────────────────────────────────║
║ build      │ npm run build                                                   ║
║──────────────────────────────────────────────────────────────────────────────║
║ start      │ perl /assets/prestart.pl /assets/nginx.template.conf            ║
║            │ /nginx.conf && (php-fpm -y /assets/php-fpm.conf & nginx -c      ║
║            │ /nginx.conf)                                                    ║
╚══════════════════════════════════════════════════════════════════════════════╝

[+] Building 125.5s (12/16)
 => [internal] load build definition from Dockerfile                                                               0.1s
 => => transferring dockerfile: 940B                                                                               0.0s
 => [internal] load .dockerignore                                                                                  0.1s
 => => transferring context: 2B                                                                                    0.0s
 => [internal] load metadata for ghcr.io/railwayapp/nixpacks:ubuntu-1678147396                                     0.9s
 => [internal] load build context                                                                                  0.1s
 => => transferring context: 130.79kB                                                                              0.0s
 => [ 1/12] FROM ghcr.io/railwayapp/nixpacks:ubuntu-1678147396@sha256:a46cc178c389afffab235c1bf5d6dbc52ca9daf6945  0.0s
 => CACHED [ 2/12] WORKDIR /app/                                                                                   0.0s
 => [ 3/12] COPY .nixpacks/nixpkgs-293a28df6d7ff3dec1e61e37cc4ee6e6c0fb0847.nix .nixpacks/nixpkgs-293a28df6d7ff3d  0.1s
 => [ 4/12] RUN nix-env -if .nixpacks/nixpkgs-293a28df6d7ff3dec1e61e37cc4ee6e6c0fb0847.nix && nix-collect-garba  118.4s
 => [ 5/12] COPY .nixpacks/assets /assets/                                                                         0.1s
 => [ 6/12] COPY . /app/.                                                                                          0.1s
 => [ 7/12] RUN  mkdir -p /var/log/nginx && mkdir -p /var/cache/nginx                                              0.6s
 => ERROR [ 8/12] RUN  composer install                                                                            5.1s
------
 > [ 8/12] RUN  composer install:
#12 0.561 Composer plugins have been disabled for safety in this non-interactive session. Set COMPOSER_ALLOW_SUPERUSER=1 if you want to allow plugins to run as root/super user.
#12 0.561 Do not run Composer as root/super user! See https://getcomposer.org/root for details
#12 0.623 No composer.lock file present. Updating dependencies to latest instead of installing from lock file. See https://getcomposer.org/install for more information.
#12 0.624 Loading composer repositories with package information
#12 1.256 Info from https://repo.packagist.org: #StandWithUkraine
#12 5.018 Updating dependencies
#12 5.050 Your requirements could not be resolved to an installable set of packages.
#12 5.050
#12 5.050   Problem 1
#12 5.050     - Root composer.json requires PHP extension ext-mongodb * but it is missing from your system. Install or enable PHP's mongodb extension.
#12 5.050   Problem 2
#12 5.050     - Root composer.json requires PHP extension ext-redis * but it is missing from your system. Install or enable PHP's redis extension.
#12 5.050   Problem 3
#12 5.050     - Root composer.json requires PHP extension ext-imagick * but it is missing from your system. Install or enable PHP's imagick extension.
#12 5.050
#12 5.050 To enable extensions, verify that they are enabled in your .ini files:
#12 5.050     - /nix/store/ikyni8lpwm0zzfi8nrx8a8izy5ivwz6i-php-with-extensions-8.1.13/lib/php.ini
#12 5.050 You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.
#12 5.050 Alternatively, you can run Composer with `--ignore-platform-req=ext-mongodb --ignore-platform-req=ext-redis --ignore-platform-req=ext-imagick` to temporarily ignore these required extensions.
------
executor failed running [/bin/bash -ol pipefail -c composer install]: exit code: 2
Error: Docker build failed

Test Environment
Clean Laravel 9 project with extensions added to composer.json file

{
    "require": {
        "php": "^8.1",
        "ext-mongodb": "*",
        "ext-redis": "*",
        "ext-imagick": "*",
        ...
    }
}

@aleksrutins
Copy link
Contributor Author

@berksmbl: that's very strange; could you try running the php-laravel-ext-mongodb example with cargo run -- build examples/php-laravel-ext-mongodb? That one works on my computer.

@berksmbl
Copy link

@berksmbl: that's very strange; could you try running the php-laravel-ext-mongodb example with cargo run -- build examples/php-laravel-ext-mongodb? That one works on my computer.

╔═══════════════════════════════ Nixpacks v1.5.0 ══════════════════════════════╗
║ setup      │ (php81.withExtensions (pe: pe.enabled ++ [pe.all.mongodb])),    ║
║            │ perl, nginx, libmysqlclient, php81Packages.composer, nodejs-    ║
║            │ 16_x, npm-8_x, php81Extensions.mongodb                          ║
║──────────────────────────────────────────────────────────────────────────────║
║ install    │ mkdir -p /var/log/nginx && mkdir -p /var/cache/nginx            ║
║            │ composer install                                                ║
║            │ npm i                                                           ║
║──────────────────────────────────────────────────────────────────────────────║
║ build      │ npm run prod                                                    ║
║──────────────────────────────────────────────────────────────────────────────║
║ start      │ perl /assets/prestart.pl /assets/nginx.template.conf            ║
║            │ /nginx.conf && (php-fpm -y /assets/php-fpm.conf & nginx -c      ║
║            │ /nginx.conf)                                                    ║
╚══════════════════════════════════════════════════════════════════════════════╝

[+] Building 103.3s (17/17) FINISHED
 => [internal] load build definition from Dockerfile                                                               0.1s
 => => transferring dockerfile: 939B                                                                               0.0s
 => [internal] load .dockerignore                                                                                  0.1s
 => => transferring context: 2B                                                                                    0.0s
 => [internal] load metadata for ghcr.io/railwayapp/nixpacks:ubuntu-1678147396                                     2.1s
 => [ 1/12] FROM ghcr.io/railwayapp/nixpacks:ubuntu-1678147396@sha256:a46cc178c389afffab235c1bf5d6dbc52ca9daf6945  0.0s
 => [internal] load build context                                                                                  0.1s
 => => transferring context: 415.81kB                                                                              0.0s
 => CACHED [ 2/12] WORKDIR /app/                                                                                   0.0s
 => CACHED [ 3/12] COPY .nixpacks/nixpkgs-293a28df6d7ff3dec1e61e37cc4ee6e6c0fb0847.nix .nixpacks/nixpkgs-293a28df  0.0s
 => CACHED [ 4/12] RUN nix-env -if .nixpacks/nixpkgs-293a28df6d7ff3dec1e61e37cc4ee6e6c0fb0847.nix && nix-collect-  0.0s
 => CACHED [ 5/12] COPY .nixpacks/assets /assets/                                                                  0.0s
 => [ 6/12] COPY . /app/.                                                                                          0.1s
 => [ 7/12] RUN  mkdir -p /var/log/nginx && mkdir -p /var/cache/nginx                                              0.6s
 => [ 8/12] RUN  composer install                                                                                 11.0s
 => [ 9/12] RUN  npm i                                                                                            65.5s
 => [10/12] COPY . /app/.                                                                                          0.1s
 => [11/12] RUN  npm run prod                                                                                      5.9s
 => [12/12] COPY . /app                                                                                            0.1s
 => exporting to image                                                                                            17.5s
 => => exporting layers                                                                                           17.5s
 => => writing image sha256:c16cb374cebca65c79207d10971ed33831506732e18c1faa8cfd439804ed4ed9                       0.0s
 => => naming to docker.io/library/9dbcc3f4-c00e-403e-a537-c4d037cf2f4b                                            0.0s
=== Successfully Built! ===

Run:
  docker run -it 9dbcc3f4-c00e-403e-a537-c4d037cf2f4b

It worked very interestingly, but when I point to my own repo or another repo, it doesn't work that way.

@Milo123459
Copy link
Collaborator

Can you send your composer files?

@aleksrutins
Copy link
Contributor Author

He did above; I'm currently trying something, we'll see if it works.

@aleksrutins
Copy link
Contributor Author

Could you try now and see if it works?

@berksmbl
Copy link

Can you send your composer files?

composer.json

Copy link

@berksmbl berksmbl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not a fix, it just ignores errors. The plugin will still not work functionally.

@aleksrutins
Copy link
Contributor Author

Did you test it? I think the problem may be Composer. The extensions are definitely installed in the container.

@berksmbl
Copy link

berksmbl commented Mar 10, 2023

Did you test it? I think the problem may be Composer. The extensions are definitely installed in the container.

Before I start the installation, I look at the installed extensions with a simple php -m command and they still don't seem to be installed.

@coffee-cup coffee-cup merged commit 93cb958 into railwayapp:main Mar 15, 2023
@valehasadli
Copy link

is there any way to add redis extension to the system without composer ext-redis installation?

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

Successfully merging this pull request may close these issues.

None yet

5 participants