lucasdiedrich / ojs

Open Journal Systems (OJS) is a journal management and publishing system.
GNU General Public License v3.0
19 stars 64 forks source link

Unable to install OJS with php7-test tag (ojs-3_1_2-0) #15

Closed marcbria closed 5 years ago

marcbria commented 5 years ago

When deploying with:

docker run --name ojs -p 8087:80 -p 8448:443 -v /etc/localtime:/etc/localtime -d lucasdiedrich/ojs:php7-test

First install screen is shown, but is not possible to jump to the second screen and OJS reports error:

Errors occurred during installation A database error has occurred: No such file or directory

And /var/log/apache/error.log shows:

[Wed Mar 27 23:12:12.657315 2019] [php7:warn] [pid 21] [client 172.17.0.1:36360] PHP Warning: Declaration of InstallHandler::validate($request) should be compatible withPKPHandler::validate($requiredContexts = NULL, $request = NULL) in /var/www/html/lib/pkp/pages/install/InstallHandler.inc.php on line 118, referer: http://localhost:8087/index/install/install [Wed Mar 27 23:12:12.737118 2019] [php7:notice] [pid 21] [client 172.17.0.1:36360] No such file or directory, referer: http://localhost:8087/index/install/install [Wed Mar 27 23:12:13.579254 2019] [php7:warn] [pid 22] [client 172.17.0.1:36364] PHP Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/html/cache/t_compile/e8ea13aa559bf8604ca823015b397a28d8666486^28682bb3d6b6e750ebd3d458abc8f92b4da9ea9f_0.app.headerusernav.tpl.php on line 136, referer: http://localhost:8087/index/install/install

Looking into the dockerfile, I can't figure out where or when is mysql/mariadb installed in localhost.

Let me know if you need more testing.

I will try with docker-compose where the full statck is created.

Thanks for your work, m.

lucasdiedrich commented 5 years ago

Hey @marcbria , you can check the php7 mysql lib here. Have you confirmed that the container tried to contact the database? As i was fixing the 3.1.1.4 version i didn't had time to check this out yet, going to look further tomorrow.

Thanks

lucasdiedrich commented 5 years ago

@marcbria , i was able to reproduce the error, the problem is that i saw somewhere over pkp forum that the recommend driver is the mysqli now, and i forgot to change over ojs-cli-install. After changing there i get blank pages now and new error.

bash ==> /var/log/apache2/error.log <== [Thu Mar 28 17:31:31.713931 2019] [php7:error] [pid 26] [client 172.19.0.1:49354] PHP Fatal error: Uncaught Error: Call to undefined function session_set_save_handler() in /var/www/html/lib/pkp/classes/session/SessionManager.inc.php:47\nStack trace:\n#0 /var/www/html/lib/pkp/classes/session/SessionManager.inc.php(129): SessionManager->__construct(Object(SessionDAO), Object(Request))\n#1 /var/www/html/lib/pkp/classes/security/Validation.inc.php(371): SessionManager::getManager()\n#2 /var/www/html/lib/pkp/classes/core/PKPPageRouter.inc.php(66): Validation::isLoggedIn()\n#3 /var/www/html/lib/pkp/classes/core/Dispatcher.inc.php(117): PKPPageRouter->isCacheable(Object(Request))\n#4 /var/www/html/lib/pkp/classes/core/PKPApplication.inc.php(252): Dispatcher->dispatch(Object(Request))\n#5 /var/www/html/index.php(68): PKPApplication->execute()\n#6 {main}\n thrown in /var/www/html/lib/pkp/classes/session/SessionManager.inc.php on line 47

lucasdiedrich commented 5 years ago

@marcbria i found out that we were missing an php7 lib, we need to look if we are missing more libs. Can you please check the new version out?

Thanks.

marcbria commented 5 years ago

Thanks a lot @lucasdiedrich

I need to leave now. If you don't mind, I will test this on Monday (or during the weekend if I find time).

BTW, do you want me to test the "single" dockerfile as this: $ docker run --name ojs -p 8087:80 -p 8448:443 -v /etc/localtime:/etc/localtime -d lucasdiedrich/ojs:php7-test

Or the docker-compose (or both).

Cheers, m.

lucasdiedrich commented 5 years ago

Both would be great, i've teste with the docker-compose file because of the database settings, and it seems to work very whell now.

Actually what i need first is to test the #14, so i can replace the actual container image that is in production over dockerhub.

Thanks.

Potomac54 commented 5 years ago

I tested the Dockerfile from the php7-test git branch, and I notice a problem : mysqli extension is not built and enabled,

the fix is easy : just add at the end of Dockerfile these commands, before the launch of supervisord :

RUN docker-php-ext-install mysqli && docker-php-ext-enable mysqli

CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]

marcbria commented 5 years ago

Yep. I confirm @Potomac54 feedback.

Although "mysqli" is shown in the dropdown installation list, the installation fails. When the module is enabled, it works like a charm.

Now I remember I found the same problem with my local OMP dockerfiles. Probably with php 7.3 we will get trouble with some other modules (gd...). ¿What about going with php7.2 till 7.3 is consolidated?

Sorry, today I got a crazy day. I will test it deeper and go with docker-compose tomorrow tomorrow.

Thanks for your work, m.

lucasdiedrich commented 5 years ago

Actually i can fallback the php version without a problem, and than i will join @Potomac54 recommendations.

Thanks,

lucasdiedrich commented 5 years ago

One new version is available over dockerhub, please feel free to test @Potomac54 @marcbria

marcbria commented 5 years ago

I'm still getting installation errors on a single-clean docker run, but I arrive to the conclusion that it's me.

Let me 5 minutes to show my testing workflow, to let you show me what I'm doing wrong.

To upgrade the image and containers I did this:

$ docker stop ojs-php7
$ docker rm ojs-php7
$ docker rmi lucasdiedrich/ojs:php7-test
$ docker run --name ojs-php7 -p 8093:80  -v /etc/localtime:/etc/localtime -d lucasdiedrich/ojs:php7-test

After this, would is wonderful, and when I visit the site at http://web.foo.org:8093 I can see the installation wizard, BUT...

When I will the installation fields as follows (jumping the obvious):

and then I submit the form, OJS reports:

"Errors occurred during installation A database error has occurred: No such file or directory"

Then I log into the container and PHP's log don't add more light (IPs and urls anonymized):

[Wed Apr 03 16:48:55.443032 2019] [php7:warn] [pid 46] [client 158.109.x.x:41896] PHP Warning: Declaration of InstallHandler::validate($request) should be compatible with PKPHandler::validate($requiredContexts = NULL, $request = NULL) in /var/www/html/lib/pkp/pages/install/InstallHandler.inc.php on line 118, referer:http://web.foo.org:8093/index/install/install [Wed Apr 03 16:48:55.517637 2019] [php7:notice] [pid 46] [client 158.109.x.x:41896] No such file or directory, referer: http://web.foo.org:8093/index/install/install [Wed Apr 03 16:48:56.519112 2019] [php7:warn] [pid 32] [client 158.109.x.x:41900] PHP Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/html/cache/t_compile/e8ea13aa559bf8604ca823015b397a28d8666486^28682bb3d6b6e750ebd3d458abc8f92b4da9ea9f_0.app.headerusernav.tpl.php on line 136, referer: http://web.foo.org:8093/index/install/install

The errors are just warnings and notice level and the only clue is a "No such file or directory" without telling what directory. Log also talks about "cache" folder (where I found some files with root permission) so I chown and chmod to be very permissive with apache user... but didn't help.

Then I installed mysql-client to log into the mysql... but no mysql answers on localhost.

So I checked if mysql was installed as follows: $ apk add openrc --no-cache $ rc-service --list

An there is no mysql at all. And here I started discovering how much stupid am I... Yesterday I tested the "latest" branch and I got similar issues (not published because I didn't got a solution).

So... her I arrive to the conclusion that I completely misunderstand the docker model and I was testing it incorrectly. Sorry for this. As I said, I'm new to docker.

I mean, I was expecting to have a running/operative docker even when we rise it alone, is this right? If yes, we need to add database layer (mysql) in the dockerfile, don't we?

But from your dockerfile I understand docker model is keep it very simple (only rise OJS) and delegate the complexity to docker-compose.yml.

A simple dockerfile is good for those scenarios where they rise ojs and have a single mysql server, and also useful as a basis for those who like to build a full stack.

I need to leave now. I will try to test the docker-compose version between this week, that probably will work like a charm. :-)

Please @lucasdiedrich confirm that I'm now in the right way, and sorry for the misunderstanding (and the long mail). :-)

Cheers, m.

Potomac54 commented 5 years ago

@marcbria

Try to run the image with docker-compose.yml and the appropriate environment variables, I run OJS image by typing this in a console :

docker-compose up

it will work if all environment variables are correctly set (.env file, and in the Dockerfile), check also the path for the volumes in docker-compose.yml : for the database, for the config.inc.php file, for the "files" and "public" directories, these 2 directories should have read-write wrights for all users, otherwise the installation (curl command in ojs-cli-install) will fail,

I don't know if the docker-compose.yml provided by the project is correct for the indentations, last time I checked there were indentations errors (in the master branch)

lucasdiedrich commented 5 years ago

@marcbria , actually i thought that you were missing something... hahahha. The main perception of using container is delegation of responsibility, a container should only run a process about its own escope, in OJS container it his own code, i don't know if i'm crystal clear about this, but any doubts just ask.

The database should always run in a separate env, or container. That why Docker enables one thing called Service. In this (docker-compose file) we can declare every container and process needed to ran and intire service. So when docker start in cluster mode it can manage and replicate things correctly, but we can enter matter on other time.

And yes, you're now on the right path. @marcbria , please feel free to add me over gmail, than we can talk better about this.

@Potomac54 before we release the final version we're going to fix the identation of codes, and move it to another folder called examples.

Thanks guys.

marcbria commented 5 years ago

The database should always run in a separate env, or container. That why Docker enables one thing called Service. In this (docker-compose file) we can declare every container and process needed to ran and intire service. So when docker start in cluster mode it can manage and replicate things correctly, but we can enter matter on other time.

Thanks for the explanation. All clear now.

About the final structure, I like the idea of an examples folder with different docker-compose.yml but we can keep a "default" one close to the Dockerfile.

Too much conversations mixed in this post. I will close it and, if is ok for you, open an issue to only talk about the final structure.