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

ojs-cli-install doesn't work as expected #16

Closed Potomac54 closed 5 years ago

Potomac54 commented 5 years ago

Hello,

the script ojs-cli-install called by the supersvisor daemon (at the start of the container, when OJS_CLI_INSTALL=1) doesn't work as expected,

when this script is called I notice that no database is created, no tables in "db" database, in fact no automatic installation of OJS is done by this script, which is not normal,

If I go to "localhost:8085/" it brings me to the install page, I expected to have a ready OJS configured site, what is the real purpose of the script ojs-cli-install ?

something seems wrong in this script : https://github.com/lucasdiedrich/ojs/blob/master/files/usr/local/bin/ojs-cli-install

according to the official documentation of OJS if we want an automatic installation then we shoud call "php tools/install.php" script, and pass arguments, but in ojs-cli-install file I don't see the call of "php tools/install.php", instead I see this :

curl "http://${SERVERNAME}/index/install/install"

why ?

lucasdiedrich commented 5 years ago

This was taken from pkp/ojs forum before, as at the time i didn't exist this kind of cli install. Going to review this.

tools/install.php https://github.com/pkp/ojs/blob/master/tools/install.php

lucasdiedrich commented 5 years ago

@Potomac54 as you told over #4, the script works asking questions which is not recommended over docker environment where sometimes we will never have access to bash prompt. The idea at the time was just to POST the necessary variables to conclude the installation, this worked at 2.x version and for lack of time was never reviewe 3.x version.

lucasdiedrich commented 5 years ago

We take a a look at this project to change the post URL and make it work: https://github.com/pkp/vagrant/blob/321f22c7ea03b1adf19041b86b6c27089d33b67d/scripts/ojs.sh#L26

Potomac commented 5 years ago

I tried also the wget command of the vagrant github, it doesn't work, still no tables in the database

wget -O - --post-data="adminUsername=admin&adminPassword=ojsadmin&adminPassword2=ojsadmin&adminEmail=ojs@mailinator.com&locale=en_US&additionalLocales[]=en_US&clientCharset=utf-8&connectionCharset=utf8&databaseCharset=utf8&filesDir=%2fhome%2fojs%2ffiles&encryption=sha1&databaseDriver=mysql&databaseHost=localhost&databaseUsername=ojs&databasePassword=ojs&databaseName=ojs&oaiRepositoryId=ojs2.localhost" "http://localhost/ojs/index.php/index/install/install"

I think we can capture the complete http post request with the developer tools of firefox (CTRL + Shift + I, and "network tab"), when using the install page of OJS manually, then we will have the right OJS 3.x url parameters for the http post request

lucasdiedrich commented 5 years ago

@Potomac the url informed by you is wrong, it should be "http://localhost/index/install/install", there is no need for the index.php reference and the OJS path doesn't exist in this environment, can you please download the latest master branch and test again, i've made some changes.

And yes, using developer tools was and excelente idea on how to catch the post request, but as i mentioned, using my docker-compose at master branch worked. Going to continue the tests.

lucasdiedrich commented 5 years ago

I think that i maybe fixed this over the last patches because i'm not able to reproduce. Below are the page after an complete docker-compose, the system goes directly to login screen and with default admin working.

Please, at the docker-compose change the ojs container to lucasdiedrich/ojs:master.

image

Potomac commented 5 years ago

@lucasdiedrich : I found the cause of the error, in your curl command the adminEmail parameter is not correct (bad syntax), check here :

&adminEmail=admin%40${SERVERNAME}&locale=en_US

for example if $SERVERNAME=localhost then the email will be : admin@localhost, but the install form (OJS 3.1.1.1-4) will refuse this kind of email adress,

because install form will expect this syntax for email adress : xxxx@xxxx.xx (for example admin@localhost.fr)

the fix is very simple, just add ".org" :

&adminEmail=admin%40${SERVERNAME}.org&locale=en_US

or set a fake address :

&adminEmail=admin%40example.org&locale=en_US

lucasdiedrich commented 5 years ago

Thanks @Potomac, the thing is that the servername should always be an FQDN name, and that why never was able to reproduce the error, and this is the default installation i'm going to adopt your sugestion and auto-add and .org to prevent that.

Thanks a lot.

Potomac commented 5 years ago

Or you can do a check in ojs-cli-install :

if SERVERNAME = localhost then add a ".org" (&adminEmail=admin%40${SERVERNAME}.org)

if SERVERNAME is a FQDN name (foo.fr) then keep the current code (&adminEmail=admin%40${SERVERNAME})

lucasdiedrich commented 5 years ago

I really doesn't think we need add some logic as this script will be ran just the first time when starting the container.

Thanks a lot for your help @Potomac .