exakat / exakat-docker

Docker Container for Exakat
20 stars 9 forks source link

Exakat not working through Docker 2.1.9 #22

Open NeoEGM opened 3 years ago

NeoEGM commented 3 years ago

Using guide:

https://exakat.readthedocs.io/en/stable/Tutorial.html#docker-container-within-the-code-folder

On the code folder, the following command doesn't work:

docker run -it --rm -w /src -v $(pwd):/src exakat/exakat:latest exakat project

Nor:

docker run -it --rm -w /src -v $(pwd):/src exakat/exakat:2.1.9 exakat project

It outputs:

Error : This command requires a project name. Pass the -p option, or use .exakat.yaml config file.
Aborting

on file phar:///usr/src/exakat/exakat/library/Exakat/Tasks/Project.php
on line 60

There is a .exakat.yaml file on the code dir with the following simple content as recommended in the guide:

project: "MyProject"

But it doesn't seem to be detected at all:

docker run -it --rm -w /src -v $(pwd):/src exakat/exakat:latest exakat doctor

returns:

Warning: mkdir(): File exists in phar:///usr/src/exakat/exakat/library/Exakat/Tasks/Doctor.php on line 232
exakat : 
    executable           : /usr/src/exakat//exakat
    version              : 2.1.9
    build                : 1156
    exakat.ini           : /usr./exakat/config/exakat.ini,
                           environnment
    graphdb              : gsneo4j
    reports              : 
    rulesets             : CompatibilityPHP53,
                           CompatibilityPHP54,
                           CompatibilityPHP55,
                           CompatibilityPHP56,
                           CompatibilityPHP70,
                           CompatibilityPHP71,
                           CompatibilityPHP72,
                           CompatibilityPHP73,
                           CompatibilityPHP74,
                           CompatibilityPHP80,
                           Analyze,
                           Preferences,
                           Appinfo,
                           Appcontent,
                           Dead code,
                           ClassReview,
                           Performances,
                           Security,
                           Custom,
                           Inventory,
                           Stats,
                           php-cs-fixable,
                           Rector
    extra rulesets       : 
    ignored rules        : 
    tokenslimit          : 100 000 000
    stubs                : 

PHP : 
    binary               : 7.4.11
    memory_limit         : -1
    short_open_tags      : Off
    ext/curl             : Yes
    ext/hash             : Yes
    ext/phar             : Yes
    ext/sqlite3          : Yes
    ext/tokenizer        : Yes
    ext/mbstring         : Yes
    ext/json             : Yes
    ext/xmlwriter        : Yes
    pcre.jit             : On (Must be off on PHP 7.3 and OSX)

java : 
    installed            : Yes
    type                 : OpenJDK Runtime Environment (build 11.0.8+10-post-Debian-1deb10u1)
    version              : openjdk
    $JAVA_HOME           : <none>
    $JAVA_OPTIONS        : 

tinkergraph : 
    configured           : No tinkergraph configured in config/exakat.ini.

tinkergraphv3 : 
    configured           : No tinkergraph configured in config/exakat.ini.

gsneo4j : 
    installed            : Yes (folder : /usr/src/exakat/tinkergraph)
    host                 : 127.0.0.1
    port                 : 8182
    gremlin version      : 3.4.8
    neo4j version        : 3.2.3

gsneo4jv3 : 
    configured           : No gsneo4jv3_folder configured in config/exakat.ini.

nogremlin : 
    installed            : Always

project : 
    name                 : 
    url                  : 
    phpversion           : 7.4
    reports              : "Ambassador"
    rulesets             : CompatibilityPHP53, CompatibilityPHP54, CompatibilityPHP55, CompatibilityPHP56, CompatibilityPHP70, CompatibilityPHP71, CompatibilityPHP72, CompatibilityPHP73, CompatibilityPHP74, CompatibilityPHP80, Analyze, Preferences, Appinfo, Appcontent, Dead code, ClassReview, Performances, Security, Custom, Inventory, Stats, php-cs-fixable, Rector
    included dirs        : 
    ignored dirs         : /assets, /cache, /css, /data, /doc, /docker, /docs, /example, /examples, /images, /js, /lang, /spec, /sql, /test, /tests, /tmp, /version, /var
    ignored rules        : 
    file extensions      : php, php3, inc, tpl, phtml, tmpl, phps, ctp, module

folders : 
    projects folder      : Yes

php74 : 
    configured           : Yes (/usr/local/bin/php)
    actual version       : 7.4.11
    auditing             : with this version

Specially this part:

project : 
    name                 : 
    url                  : 
[...]

folders : 
    projects folder      : Yes

And this dot in the exakat.ini part seems suspicious:

exakat : 
    executable           : /usr/src/exakat//exakat
    version              : 2.1.9
    build                : 1156
    exakat.ini           : /usr./exakat/config/exakat.ini,
                           environnment

It says: /usr./exakat/config/exakat.ini.

But running the following command, changing the working dir, also changes the path, making it look as ir replaced the working dir with a dot:

Command:

docker run -it --rm -w / -v $(pwd):/src exakat/exakat:latest exakat doctor

Returns: (notice the multiple dots on exakat.ini entry and the lack of the mkdir() error at the beginning).

exakat : 
    executable           : /usr/src/exakat//exakat
    version              : 2.1.9
    build                : 1156
    exakat.ini           : .usr.src.exakat.config.exakat.ini,
                           environnment
(...)

Running on bare metal Linux Ubuntu 18.04.5. Docker version 19.03.6, build 369ce74a3c.

Also tried the projects folder mode (with -p and symlinking at the init command (with -R .... -symlink) without results too, said it couldn't find code, but this in-code-directory setup fits much better my use case).

Thanks in advance!!

sebb commented 3 years ago

I'm having the exact same issue, but with a more recent version of Ubuntu and Docker (respectively 20.04.2 and 20.10.5). Same behaviour on my laptop and in a GitLab pipeline.

I was finding that extra . in /usr./exakat/config/exakat.ini suspicious too so I've been digging there a bit and I've found it's probably a dead end: the problem comes from the volume and working directory: I was using /src too and it's simply this line in \Exakat\Configsource\ExakatConfig::loadConfig()

        return str_replace(getcwd(), '.', $configFile);

in that case getcwd() returns /src which happens to be in the file's complete path...

Using /code instead of /src solves the path issue for /usr/src/exakat/config/exakat.ini but doesn't fix the main issue:

$ docker run -it --rm -v $(pwd):/code -w /code --entrypoint /usr/src/exakat/exakat exakat/exakat:latest project

Error : This command requires a project name. Pass the -p option, or use .exakat.yaml config file.
Aborting

on file phar:///usr/src/exakat/exakat/library/Exakat/Tasks/Project.php
on line 60
NeoEGM commented 3 years ago

Yes! I found the same replacement and did something similar to you without results either.

I've been digging a while more and found it might have to do with something on the phar architecture itself: not beeing able to change the cwd correctly and, thus, making the file_exists() call not work:

https://stackoverflow.com/a/18442941

The problem, anyway, should be addressed ideally by someone on exakat's team, which would find the main cause pretty quickly I guess!

I resigned since I was spending so much time without results. I also tried to build the Dockerfile, which in turn downloads the same phar file I would download on a real machine with the same results, so I imagine the problem doesn't have to do with that.

I didn't attempt a full installation outside docker. Perhaps the php version used has something to do; I wouldn't know. I just gave up by now.

If you realize something else or get to contact someone from the team please update us here!

El vie., 5 de mar. de 2021 20:28, Sébastien Ballangé < notifications@github.com> escribió:

I'm having the exact same issue, but with a more recent version of Ubuntu and Docker (respectively 20.04.2 and 20.10.5). Same behaviour on my laptop and in a GitLab pipeline.

I was finding that extra . in /usr./exakat/config/exakat.ini suspicious too so I've been digging there a bit and I've found it's probably a dead end: the problem comes from the volume and working directory: I was using /src too and it's simply this line in \Exakat\Configsource\ExakatConfig::loadConfig()

    return str_replace(getcwd(), '.', $configFile);

in that case getcwd() returns /src which happens to be in the file's complete path...

Using /code instead of /src solves the path issue for /usr/src/exakat/config/exakat.ini but doesn't fix the main issue:

$ docker run -it --rm -v $(pwd):/code -w /code --entrypoint /usr/src/exakat/exakat exakat/exakat:latest project

Error : This command requires a project name. Pass the -p option, or use .exakat.yaml config file.

Aborting

on file phar:///usr/src/exakat/exakat/library/Exakat/Tasks/Project.php

on line 60

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/exakat/exakat-docker/issues/22#issuecomment-791786981, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAH73HP5JRQM5SIBPO77GLTTCFSLLANCNFSM4X5FVZVA .

NeoEGM commented 3 years ago

There seems to be a problem with relative paths on Phars, perhaps Exakat not finding the .exakat.yml file is related to that.

Or perhaps using realpath() like here: https://stackoverflow.com/a/20346438

El vie., 5 de mar. de 2021 21:54, Ezequiel Miravalles neoegm@gmail.com escribió:

Yes! I found the same replacement and did something similar to you without results either.

I've been digging a while more and found it might have to do with something on the phar architecture itself: not beeing able to change the cwd correctly and, thus, making the file_exists() call not work:

https://stackoverflow.com/a/18442941

The problem, anyway, should be addressed ideally by someone on exakat's team, which would find the main cause pretty quickly I guess!

I resigned since I was spending so much time without results. I also tried to build the Dockerfile, which in turn downloads the same phar file I would download on a real machine with the same results, so I imagine the problem doesn't have to do with that.

I didn't attempt a full installation outside docker. Perhaps the php version used has something to do; I wouldn't know. I just gave up by now.

If you realize something else or get to contact someone from the team please update us here!

El vie., 5 de mar. de 2021 20:28, Sébastien Ballangé < notifications@github.com> escribió:

I'm having the exact same issue, but with a more recent version of Ubuntu and Docker (respectively 20.04.2 and 20.10.5). Same behaviour on my laptop and in a GitLab pipeline.

I was finding that extra . in /usr./exakat/config/exakat.ini suspicious too so I've been digging there a bit and I've found it's probably a dead end: the problem comes from the volume and working directory: I was using /src too and it's simply this line in \Exakat\Configsource\ExakatConfig::loadConfig()

    return str_replace(getcwd(), '.', $configFile);

in that case getcwd() returns /src which happens to be in the file's complete path...

Using /code instead of /src solves the path issue for /usr/src/exakat/config/exakat.ini but doesn't fix the main issue:

$ docker run -it --rm -v $(pwd):/code -w /code --entrypoint /usr/src/exakat/exakat exakat/exakat:latest project

Error : This command requires a project name. Pass the -p option, or use .exakat.yaml config file.

Aborting

on file phar:///usr/src/exakat/exakat/library/Exakat/Tasks/Project.php

on line 60

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/exakat/exakat-docker/issues/22#issuecomment-791786981, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAH73HP5JRQM5SIBPO77GLTTCFSLLANCNFSM4X5FVZVA .

sebb commented 3 years ago

I'm starting to doubt the in-code version of specifying the project's config actually works :/

I've tried to use Composer to install exakat (from inside the provided Docker container to avoid having to deal with the other dependencies) and I'm getting the same

 This command requires a project name. Pass the -p option, or use .exakat.yaml config file.

I get the same result with Exakat installed as global Composer dependency:

$ docker run -it --rm -v $(pwd):/code -w /code exakat/exakat:latest bash
# composer global require exakat/exakat
# php ~/.composer/vendor/bin/exakat project

outside everything in /tmp:

$ docker run -it --rm -v $(pwd):/code -w /code exakat/exakat:latest bash
# cd /tmp
# composer require exakat/exakat
# cd /code
# php /tmp/vendor/bin/exakat project

or as a dev dependency of my project:

$ docker run -it --rm -v $(pwd):/code -w /code exakat/exakat:latest bash
# cd /code
# composer require --dev exakat/exakat
# php vendor/bin/exakat project

I guess I'll revert to using Exakat outside our CI in a projects/ folder with each project cloned in its own set of folders and I'll script something to run Exakat on all our projects. I might come back later to see if I can either pinpoint the problem or better find a fix, but for now I need to move on.

NeoEGM commented 3 years ago

I couldn't make the projects version with code folder symlinked to work either. I tried the Docker version too because of the dependencies. Tell us if you find something else! Thanks!

El lun., 8 de mar. de 2021 17:22, Sébastien Ballangé < notifications@github.com> escribió:

I'm starting to doubt the in-code version of specifying the project's config actually works :/

I've tried to use Composer to install exakat (from inside the provided Docker container to avoid having to deal with the other dependencies) and I'm getting the same

This command requires a project name. Pass the -p option, or use .exakat.yaml config file.

I get the same result with Exakat installed as global Composer dependency:

$ docker run -it --rm -v $(pwd):/code -w /code exakat/exakat:latest bash

composer global require exakat/exakat

php ~/.composer/vendor/bin/exakat project

outside everything in /tmp:

$ docker run -it --rm -v $(pwd):/code -w /code exakat/exakat:latest bash

cd /tmp

composer require exakat/exakat

cd /code

php /tmp/vendor/bin/exakat project

or as a dev dependency of my project:

$ docker run -it --rm -v $(pwd):/code -w /code exakat/exakat:latest bash

cd /code

composer require --dev exakat/exakat

php vendor/bin/exakat project

I guess I'll revert to using Exakat outside our CI in a projects/ folder with each project cloned in its own set of folders and I'll script something to run Exakat on all our projects. I might come back later to see if I can either pinpoint the problem or better find a fix, but for now I need to move on.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/exakat/exakat-docker/issues/22#issuecomment-793048217, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAH73HLL23VXXLOFBVP63LDTCUWY5ANCNFSM4X5FVZVA .

shayneoneill commented 2 years ago

Was this ever solved or is this abandoned or something? The same problem is happening sept/22