Giter Club home page Giter Club logo

ojs's Introduction

OJS (Open Journal Systems) - PKP - Container/Docker

IMPORTANT:
This repository is still beta, so it can't be used in production environments.
We are actively working to release a stable version soon. Keep tuned.

Open Journal Systems (OJS) is a journal management and publishing system that has been developed by the Public Knowledge Project through its federally funded efforts to expand and improve access to research.

The images in this repository are built on top of Alpine Linux and come in several variants (see Versions).

This repository is a fork of the work formerly done by Lucas Dietrich.

How to use

If you want to run it locally (or in your own server), first you need to install docker (docker-compose is also recommeneded).

For all available versions, we provide a docker-compose configuration file so you can start an OJS stack (web app + database containers) with a single command.

  1. Clone this repository in your machine (if you don't like git, download and unzip it):

    $ https://github.com/pkp/docker-ojs.git
  2. Go to the directory of your OJS version of your choice:

    $ cd versions/3_2_0-1/alpine/apache/php73
    TIP: Map your config
    In production sites you would like to change the default configuration.
    The recommended way is uncommenting the environment variable sections in your docker-compose.yml and set the environment variables properly.
    More info at "Easy way to change config stuff"
  3. Run the stack:

    $ docker-compose up

    Docker-compose will pull images from docker Hub and do all the hard work to rise a functional OJS stack.

  4. Access http://127.0.0.1:8080 and continue through web installation process.

    Note that the database connection needs the following options:

    • Database driver: mysqli (or "mysql" if your php is lower than 7.3)
    • Host: db (which is the name of the container in the internal Docker network)
    • Username: ojs
    • Password: ojsPwd
    • Database name: ojs
    • Uncheck "Create new database"
    • Uncheck "Beacon"
    TIP:
    To go through the OJS installation process automatically, set the environment variable OJS_CLI_INSTALL=1, and use the other .env variables to automatize the process.

Building local images

Each version folder also includes has a file called docker-compose-local.yml.

This compose won't ask dockerHub for the required images, it expects you build a docker image locally.

This is useful if you don't want external dependencies or you like to modify our offical Dockerfiles to fit your sepecific needs.

To do this...

  1. Go to your prefered version folder and and build the image as follows:

    $ docker build -t local/ojs:3_2_0-2 .

    If something goes wrong, double-check if you ran the former command with the right version number or in a folder without the local Dockerfile.

  2. Once the image is built, you can run the stack locally telling compose to use the local yaml file with the -f/--file option as follows:

    $ docker-compose --file docker-compose-local.yml up

Versions

Different OJS versions are combined with different versions of PHP (5 and 7), and different web servers (Apache HTTP Server, nginx).

Currently, not all these combinations work! We are mostly focused in Apache2. PR are welcome

All version tags can be found at Docker Hub Tags tab.

(If no webserver is mentioned in the tag, then Apache is used).

Environment Variables

The image undestand the following environment variables:

NAME Default Info
SERVERNAME localhost Used to generate httpd.conf and certificate
OJS_CLI_INSTALL 0 Used to install ojs automatically when start container
OJS_DB_HOST db Database host
OJS_DB_USER ojs Database
OJS_DB_PASSWORD ojs Database password
OJS_DB_NAME ojs Database name

Note: OJS_CLI_INSTALL and certificate features are underconstruction.

Special Volumes

Docker content is efimerous by design, but in some situations you would like to keep some stuff persistent between docker falls (ie: database content, upload files, plugin development...)

By default we include an structure of directories in the version folders (see ./volumes), but they are empty and disabled by default in your compose. To enable them, you only need to uncomment the volume lines in your docker-compose.yml and fill the folders properly.

When you run the docker-compose it will mount the volumes with persistent data and will let you share files from your host with the container.

Host Container Volume Description
./volumes/public ojs /var/www/html/public All public files
./volumes/private ojs /srv/files All private files (uploads)
./volumes/config/db.charset.conf db /etc/mysql/conf.d/charset.cnf mariaDB config file
./volumes/config/ojs.config.inc.php ojs /var/www/html/config.inc.php OJS config file
./volumes/config/php.custom.ini ojs /usr/local/etc/php/conf.d/custom.ini PHP custom.init
./volumes/config/apache.htaccess ojs /var/www/html/.htaccess Apache2 htaccess
./volumes/logs/app ojs /var/log/apache2 Apache2 Logs
./volumes/logs/db db /var/log/mysql mariaDB Logs
./volumes/db db /var/lib/mysql mariaDB database content
./volumes/migration db /docker-entrypoint-initdb.d DB init folder (with SQLs)
/etc/localtime ojs /etc/localtime Sync clock with the host one.
TBD ojs /etc/ssl/apache2/server.pem SSL crt certificate
TBD ojs /etc/ssl/apache2/server.key SSL key certificate

You can add your own volumes. For instance, make sense for a plugin developer or a themer to create a volume with his/her work, to keep a persistent copy in the host of the new plugin or theme.

An alternative way of working for developers is working with his/her own local Dockerfile that will be build to pull the plugin for his/her own repository... but this will be significantly slower than the volume method.

Upgrading OJS

The update process is easy and straightforward.

  1. Stop the stack with the old OJS version (for instance "pkpofficial/ojs:2_4_8-5").

    $ docker-compose stop
  2. Set the new version in docker-compose.yml.

    Replace the old version: image: pkpofficial/ojs:2_4_5-2

    with the new one: image: pkpofficial/ojs:3_2_0-2

  3. Start the container with the new OJS version. It will pull a new image of your OJS scripts.

    $ docker-compose up
  4. Run the upgrade script to upgrade the OJS database and files. Easiest was is connecting to your OJS container with docker exec and run ojs-upgrade with this single line:

    $ docker exec -it ojs_app_journalname /usr/local/bin/ojs-upgrade
    TIP: Discover your container name?
    You can see the name of all your containers with docker ps -a. The ones related with OJS will be something like ojs_app_journalname.
    Use grep to filter as follows: `$ docker ps -a

Before the upgrade you will like to diff your config.inc.php with the version of the new OJS version to learn about new configuration variables. Be specialy carefully with the charsets.

Apache2

As said, right now the only avaliable stack is Apache2, so configuration files and volumes are thought you will work over an apache.

If you want to know the fastest method to set your own config jump to the next section "Easy way to change config stuff".

For those who like to understand what happens behind the courtains, you need to know that during the image building we ask the Dockerfile to copy the content of ./templates/webServers/apache/phpVersion/root folder in the root of your container.

It means, if you like to add your specific php settings you can do it creating a PHP configuration in ./templates/webServers/php{5,7,73}/conf.d/0-ojs.ini and build you own image locally.

There are some optimized variables already, you can check them within each version directory, e.g. /root/etc/apache2/conf.d/ojs.conf with your virtualhost or /etc/supervisor.conf... or, now you know what Dockerfile will do, you can add your own.

Again: Note that template's /root folder is copied into the Docker image at build time so, if you change it, you must rebuild the image for changes to take effect.

Easy way to change config stuff

If you don't want to keep you own local images, you can use the ones we build in dockerHub and map your config files in your docker-compose.yml.

So if you like to change something in (for instance) your php settings, you only need to created create a ./volumes/config/php.custom.ini outside your container and uncomment the volume in your docker-compose.yml.

Check the volumes section for a list of folders and files we think could be useful to overwrite or extend to fit your needs.

Restful URLs (aka. clean URLs)

By default the restful_url are enabled and Apache is already configured, so there is no need to use index.php over url.

SSL

By default at the start of Apache one script will check if the SSL certificate is valid and its CN matches your SERVERNAME, if don't it will generate a new one. The certificate can be overwritten using a volume mount (see docker-compose.yml file).

Note: This feature is under reveiw and could change in future.

How could I help?

Update the compose configurations and Dockerfiles

If you want to join the docker-ojs (aka. docker4ojs) team you will like to contribute with new Dockerfiles or docker-composes. To do this, you will need to clone this project and send us a PR with your contributions.

Before we follow, let us clarify something: Versions of this project fit with OJS tag versions, BUT... if you take a look to PKP's repositories, you will notice the tag naming syntax changed at version 3.1.2-0. We moved from "ojs-3_1_2-0" to "3_1_2-0".

So, to avoid keeping in mind at what momment we changed the syntax, in this project we only use the modern syntax, so you cant/must refer every version with the same notation.

Said this, let's talk about how we generate all this versions:

The files for the different OJS versions and software stacks are generated based on a number of template files, see directory templates.

You can re-generate all Dockerfile, docker-compose(-local).yml, configuration files, etc. calling the build.sh script.

# generate a specific version
$ ./build.sh 3_1_2-4

# generate _all_ versions
$ ./build.sh

Add a new stack to the list

Let's say we like us to distribute a "nginx" stack. We have our hands full but you know docker and nginx so... ¿how could you contribute?

  1. Be sure the version number is in the versions.list file (ie: 3_2_1-0).
  2. Create the required files and folders in the templates folder.

Basically you will need: - A Dockerfile template for each php version you publish (ie: dockerfile-alpine-nginx-php73.template) - A generic docker-compose.yml template (templates/dockerComposes/docker-compose-nginx.template) - A folder with all the specific configurations (templates/webServers/nginx/php73/root) - Extend exclude.list with the stuff you want to be removed.

This is the hard work. Take apache as a reference and contact us if you need indications.

  1. Edit build.sh to add your version to the proper variables. For the nginx exemple (over alpine) it should be enough extending the webServers array:

    webServers=(  'apache' 'nginx' )
    

    Modify the script if you need it to be smarter.

  2. Run build script to generate all versions again:

    $ ./build.sh
  3. Test your work running docker-compose with local dockerfiles.

  4. Commit a PR with your new build.sh and templates (ignore the versions folder).

License

GPL3 © PKP

ojs's People

Contributors

cormier avatar lucasdiedrich avatar marcbria avatar nuest avatar robsalasco avatar withanage avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ojs's Issues

Can not upload image in an email form creation

Hello

@lucasdiedrich @marcbria ,

I notice a bug when we want to send an email with OJS 3.1.2, if I want to insert an image inside the email, with the "upload image" button, then the upload fails

bug_plugin_upload_image

the name of the image plugin seems to be "JustBoil.me images plugin", when the bug occurs I can see this error message in apache log :

HTTP/1.1" 500 - "http://localhost:8085/plugins/generic/tinymce/plugins/justboil.me/dialog-v4.htm" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:66.0) Gecko/20100101 Firefox/66.0"

Add support for multiple OJS versions

First of all, thank you for your great work!

I tried the image and saw that it was not building the OJS version that I needed to test, so I parametrized the Dockerfile to make it build my version (#32).

That works for now, but I believe that it would be easier to support different OJS versions with an an organised set of Dockerfiles.

Would you be interested in a PR that enables:

  1. Supporting multiple OJS versions and structuring this repo by version and flavour. We could take example from the php docker project and use something like:
/ 3.1.2 / php5 / apache / alpine 

If someone prefers to use nginx and would like to contribute a PR for this it could be accepted in: 3.1.2 / nginx / alpine. Same thing if we decide to use debian stretch down later on.

I believe that this could help with some of the issues that were discussed in #13. By having multiple Dockerfile for multiple cases we would be able to separate upgrading the OJS version from testing issues related to a php upgrade, for example.

Thanks again for the great work!

Unable to install OJS with latest tag (ojs-3_1_1-4)

Hi Lucas,
today I got some time to test your work. Sorry for the delay.

To start, I tried a simple clean deploy with:
$ docker run --name ojs -p 8087:80 -p 8448:443 -v /etc/localtime:/etc/localtime -d lucasdiedrich/ojs

It rises a ojs-3_1_1-4 (that is good because 3.1.2-0 is still ongoing work) and initially looks like it's working. I can reach the first install screen, but after that I got a WSOD. Apache/php logs don't say much... plenty of messages like this:

[Wed Mar 27 22:41:25.873409 2019] [core:warn] [pid 10] (99)Address not available: AH00056: connect to listener on [::]:80

But second install page is redirected to "/index/install/install", that it's a suspicious url.

According to this thread it happens when the web server don't have support for PATHINFO.

Does it make sense?

I will try now with 3.1.2-0 (tagged as php7-test) to see what happens.

Avoid the error "checkstart entered FATAL state, too many start retries too quickly"

@lucasdiedrich @marcbria

It seems that supervisord is not correctly configured for running ojs-pre-start script, in the console I can see these 2 errors messages :

  • INFO exited: checkstart (exit status 0; not expected)
  • INFO gave up: checkstart entered FATAL state, too many start retries too quickly

one solution is to use the options "startsecs" and "exitcodes" in /etc/supervisord.conf

[program:checkstart]
command=/usr/local/bin/ojs-pre-start
startsecs=0
exitcodes=0

http://supervisord.org/configuration.html

after these modifications the new output of supervisord about checkstart process, no errors like "fatal state" :

  • INFO spawned: 'checkstart' with pid 11
  • INFO success: checkstart entered RUNNING state, process has stayed up for > than 0 seconds (startsecs)
  • INFO exited: checkstart (exit status 0; expected)
  • INFO success: apache entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

Is "file" utility present in php:7.3-alpine image ?

Hello,

@lucasdiedrich @marcbria

I need a confirmation : can you tell me if the "file" utility is present in the php:7.3-alpine image used by OJS docker image ?

My colleague notices a problem when he wants to upload an image file (as a submission) in OJS 3.1.2 docker image, he told me that he saw these messages in the console :

sh: file: not found
[Tue Apr 09 13:13:38.938899 2019] [php7:warn] [pid 248] [client 10.0.0.7:58398] PHP Warning:  Declaration of IssueForm::fetch($request) should be compatible with Form::fetch($request, $template = NULL, $display = false) in /var/www/html/controllers/grid/issues/form/IssueForm.inc.php on line 23

I am not at work and I don't have a docker installation, so I can not reproduce the problem, can you confirm me that the file utility is not present in the alpine image used by ojs docker ?

"sh:file:not found" error message means that the system doesn't find "file" software in /usr/bin,

one solution is to install the package which provides file utility :
https://pkgs.alpinelinux.org/package/edge/main/x86_64/file

Enhance docker-compose

After some sugestions by we've fix docker-compose file to be an example that can be run anywere without needing to comment any lines or creating folders.

We should:

  1. Add more volumes.
  2. Use relative paths.
  3. Use ENV variables.
  4. Changing default local port to 8080.
  5. Naming mysql container. (docker.io/mysql)

OJS installed by default or better not?

In last releases, OJS_CLI_INSTALL variable is set to 1 by default.
README.md says it's 0.

I'm unsure if need to be 1 or 0 by default... I don't have an strong opinion about this. :-(

With a preinstalled image you don't need to worry about database configuration and you can start playing with the tool in seconds. In the other hand, your site will be installed with default info (insecure) and you will have the blur sensation you missed something. It's nice for developing or demo sites, but not for production.

With a non-installed image you will need to deal with the installation form (set db/usr/pwd/driver correctly), that it's not obvious for newcomers and make repetitive tasks, but you have more control about the process. It's good production, but not for developers.

Probably it's better going conservative here and set it to 0, to avoid facilitate people go to production without changing pwds and so on? It's up to you @lucasdiedrich

I'm thinking here that would be nice a third status... a "demo mode" with a jounral and articles preinstalled. It will be really useful for testing and those who like tot test ojs. If you like the idea I can ask for a "demo" database dump (please, open a new issue to keep things sorted :-D)

Any way, we need to ensure:

  • The OJS_CLI_INSTALL variable could be overwritten in .ENV file. Somethink like this?
    OJS_CLI_INSTALL: ${OJS_CLI_INSTALL:-0}
  • README.md is updated according to the decision taken.

If you want a PR, you only need to ask.

Docker-compose not working out of the box

I may be missing something. But I basically cloned this repo, changed .env and ran docker-compose up.

This is the error I get:

ERROR: for pkp_ojs  Cannot start service ojs: OCI runtime create failed: container_linux.go:344: starting container process caused "process_linux.go:424: container init caused \"rootfs_linux.go:58: mounting \\\"/root/ojs/config/ojs.config.inc.php\\\" to rootfs \\\"/var/lib/docker/overlay2/2fb8a4479786e9ceb0bf5304a2154f9967c7f6ea5ae0888f1eadb7e67ff7e4e1/merged\\\" at \\\"/var/lib/docker/overlay2/2fb8a4479786e9ceb0bf5304a2154f9967c7f6ea5ae0888f1eadb7e67ff7e4e1/merged/var/www/html/config.inc.php\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

ERROR: for ojs  Cannot start service ojs: OCI runtime create failed: container_linux.go:344: starting container process caused "process_linux.go:424: container init caused \"rootfs_linux.go:58: mounting \\\"/root/ojs/config/ojs.config.inc.php\\\" to rootfs \\\"/var/lib/docker/overlay2/2fb8a4479786e9ceb0bf5304a2154f9967c7f6ea5ae0888f1eadb7e67ff7e4e1/merged\\\" at \\\"/var/lib/docker/overlay2/2fb8a4479786e9ceb0bf5304a2154f9967c7f6ea5ae0888f1eadb7e67ff7e4e1/merged/var/www/html/config.inc.php\\\" caused \\\"not a directory\\\"\"": unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
ERROR: Encountered errors while bringing up the project.

Any tips on how to get this working? Am I missing something?

Cheers!

problem when the server is running with https

Hello,

Do you know if OJS 3.x can work with secure connections ? (https mode)

I tried to run the image with a server configured to https, and there are problems, css files are not used, I get a raw display (just text),

according to this old thread in the forum I am not alone with this problem :
https://forum.pkp.sfu.ca/t/ojs-https-configuration/6679

I tried to set "force_ssl" to on in the config.inc.php file, but it doesn't fix the problem, it makes worse with a redirect loop,

is it a problem with the apache config file provided with the image ?
https://github.com/lucasdiedrich/ojs/blob/master/files/etc/apache2/conf.d/ojs.conf

thanks

Unknown charset error

Lucas, congratulations for the work you have done!

I'm trying to run ojs for the first time and found this docker repository. I getting the following error and would be very grateful if you can help me because I'm trying to get this software running locally for all day long.

Errors occurred during installation
A database error has occurred: Server sent charset unknown to the client. Please, report to the developers

First I kept only - /etc/localtime:/etc/localtime volume of pkp-ojs service, and it was my only modification. Second, I create the file config/ojs.config.inc.php based on the default template and changed only these configs bellow:

client_charset = utf-8
connection_charset = uft8
database_charset = uft8

but the same error still happening.

On the installation page I choose 'Unicode (UTF-8)' on all charset configs and on the database section I defined:

Drive: MySQL
Host: mysql-ojs (the mysql' container name)
Username: ojs
Password: ojs
Database name: ojs
Unchecked 'create new database' (before I checked the mysql container and the database exists as expected)

Do you have some clue on what is the problema and how can I fix that?

Feature request : re-create automatically the database if there are no tables

Hello,

Currently we use an environment variable for forcing the installation : OJS_CLI_INSTALL,
when this environment variable is set to 1 then ojs-cli-install is called,

but in fact we can fully automate this process without using an environment variable, by adding some logic in ojs-pre-start script :

  • at first (and everytime OJS image is running) : create dynamically the config.inc.php with supervisord (see my other feature request : #17 )

  • then add a call to a php script, which purpose will be to check if tables are present in the database,

  • if there are no tables : with a sed command : set to "Off" the line "installed=On" in config.inc.php (if it was set to On), and run the curl command (ojs-cli-install) in order to create tables in database

  • final step : with a sed command : set to "On" the line "installed=Off" in the config.inc.php

Lost dashboard

I follow instruction, start docker
install ask basics fields, user,password, database host, ..
I filled, send, and installation complete.

after Login, did not show dashboard.

This is a bug in last version of OJS or something in this docker?

ojs-cli-install doesn't work as expected

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 ?

New release (and a proposal)

Hi Lucas,

New release is out:
https://pkp.sfu.ca/2019/03/01/ojs-3-1-2-released

If you update the Dockerfile I promise I will make the testing ;-)


I hate mechanical tasks. If a work can be done by a machine, need to be done by a machine.
And I also hate annoying you asking for mechanical tasks. :-)

So... if we find time, what do you think about an script in crontab checking for new OJS versions and updating the tag in github and let dockerhub trigger the build automatically?

  1. GitHub has atom for tags: https://github.com/{:user}/{:repository}/tags.atom
    Example: https://github.com/pkp/ojs/tags.atom
  2. Dockerfile can be sed/awk to replace the OJS_VERSION variable.
  3. New tag can be easily scripted and pushed to the gitHub repo.
  4. dockerHub offers automatic builds

What do you think?

Testing master branch

As in php7-test, master branch docker-compose.yml refers "latest" instead of "master".
I'm unsure about those changes because it's probably beter have more control and refer always specific tag versions. Please @lucasdiedrich review and set it what you think is better.

Changed variables to guarantee .env and docker-compose.yml were consistent and this time I also added OJS* variables to the .env file. Do you think is a good idea to keep all the vars in .env?

In this image I found a new issue, related with the private upload folder:
Dockerfile sets it to /var/www/html/files buit it's not a good idea to keep it exposed.

Changes included in PR #26 .

After those changes, I made some basic testing and looks like "master" branch is working fine.

Testing latest branch

Hi @lucasdiedrich

First, thanks a lot for your time and work and sorry if I'm slow with the feedback or trying to understand how all it works. Beginnings are hard, so please, be patient because we are close to got the "machine greased" ;-)

Today I got time to work on this. Let me say that PKP team is really interested in this work and they like somebody outside their core is taking the lead on this. They usually have their hands full, but we can get full support if we need it.

So... let's work:

Following your request in #14 I ignore the "tags version" (although is something to talk in future, don't we?) and I started testing the "php7-test" branch.

To make it run I just made the following:

$ git clone https://github.com/lucasdiedrich/ojs.git
$ cd ojs
$ git fetch
$ git checkout php7-test
$ docker-compose up 

Good news are that now you get a full functional and pre-installed OJS 3.1.1-4 in your 8085 port.
Bad news we have a few inconsistencies to be addressed (OJS 3.1.1.4, php5, variables ...).

  • docker-compose.yml refers to "latest":
    • Need to be "php7-test"... or we will test the wrong image.
    • Why not refering the local dockerfile instead of dockerhub's?
  • Consistent variables between .env and docker-compose:
    • SERVERNAME: ${PROJECT_DOMAIN:-pkp.ojs.localhost}
    • "${HTTP_PORT:-8085}:80"
    • "${HTTPS_PORT:-8445}:443"

PR with those changes here: #23

About the rest...

I have doubts about some points. I will open a different issue for each case (with a PR) so we can discuss them separately and you can accept refuse the PR, but in short:

  • Commenting volumes by default is good , thanks! but I have an improvement proposal:
    • What about a different folder structure to distinguish between "volumes", "config files" and "scripts" (let's talk in the new issue).
    • What about naming volumes? Otherwise, when you have some ojs, it's a mess.
  • Do we need an "ENVIRONMENT" section if we have an ENV file?
  • I'm unsure if OJS_CLI_INSTALL need to be 1 or 0 by default.
  • Minor README.md fixings.

If is ok for you I will close former discussions to keep the issue tracker clean.

Thanks again for your time,
m.

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

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.

New release 3.1.2-1

Hi Lucas,

Sorry for the long silence. Overwhelmed with other stuff. :-(

Yesterday PKP released a new stable version (3.1.2-1) so I was wondering if you have time to update the docker.

Cheers,
m.

Feature request : generate dynamically config.inc.php inside the container

Hello,

currently the config.inc.php is persistent and comes from the user, with a docker volume, see the docker-compose.yml :

volumes:

  • ./config/ojs.config.inc.php:/var/www/html/config.inc.php

but we don't really need to use a volume, because a better solution is to generate dynamically the config.inc.php file from the config.TEMPLATE.inc.php provided in OJS source code, this generation will be done with the help of supervisord,

Just use sed commands to replace default settings in config.TEMPLATE.inc.php, by some settings defined in docker environment variables (from the Dockerfile) :

    SERVERNAME="localhost"      \
    OJS_BASE_URL="http://localhost/ojs"    \    
    OJS_DB_HOST="db"     \
    OJS_DB_USER="ojs"           \
    OJS_DB_PASSWORD="ojs"       \
    OJS_DB_NAME="ojs"           \
    OJS_SMTP_SERVER="personal.smpt.org" \
    OJS_SMTP_PORT="587" \
    OJS_SMTP_AUTH="tls" \
    OJS_SMTP_USER="my_login" \
    OJS_SMTP_PASSWORD="my_password" \
    OJS_ADMIN_NAME="admin" \
    OJS_ADMIN_PASSWORD="admin" \
    OJS_ADMIN_EMAIL="[email protected]" \

etc...

then create a bash script which purposes is to create dynamically config.inc.php, by using docker environment variables, this script will be launched from ojs-pre-start script, each time the OJS image is running :

cp /var/www/html/config.TEMPLATE.inc.php /var/www/html/config.inc.php
chown apache:apache /var/www/html/config.inc.php

#sed operations
# set driver, host, username, password, database name in config.inc.php  
sed -i "s/driver = mysql/driver = mysqli/g" /var/www/html/config.inc.php
sed -i "s/host = localhost/host = ${OJS_DB_HOST}/g" /var/www/html/config.inc.php   
sed -i "s/username = ojs/username = ${OJS_DB_USER}/g" /var/www/html/config.inc.php
sed -i "s/password = ojs/password = ${OJS_DB_PASSWORD}/g" /var/www/html/config.inc.php
sed -i "s/name = ojs/name = ${OJS_DB_NAME}/g" /var/www/html/config.inc.php

# database charset
sed -i "s/database_charset = Off/database_charset = utf8/g" /var/www/html/config.inc.php

etc... (for each important option you have to do a sed command, with the appropriate docker environment variable)

and at the end, when all sed commands are done :
#set installation on
sed -i "s/installed = Off/installed = On/g" /var/www/html/config.inc.php

We don't need to have a persistent config.inc.php file (because these settings will never change after a successful installation of OJS), all we need is to define environment variables related to OJS config options in Dockerfile, in order to create dynamically the config.inc.php at each run of OJS image, by using supervisord (ojs-pre-start script)

A clean docker-compose up fails

Hi,

Thanks for your work Lucas. I wanted to take a deeper look to your container but docker-compose fails to rise the stuff.

My local machine is a linux with:

  • Docker version 17.09.0-ce, build afdb6d4
  • docker-compose version 1.15.0, build e12f3b9

I did the following on a machine with docker:

$ git clone https://github.com/lucasdiedrich/ojs.git
$ cd ojs
$ docker-compose up

And I get an error when creating the ojs container:

Creating ojs ... error

ERROR: for ojs  Cannot start service pkp-ojs: oci runtime error: container_linux.go:265: starting container process caused "process_linux.go:368: container init caused \"rootfs_linux.go:57: mounting \\\"/volumes/ojs/config.inc.php\\\" to rootfs \\\"/var/lib/docker/overlay2/49bc7f73ad9909a201c2330e3ac1445978c54c88a93e2a3c5057d3b7becaa6e6/merged\\\" at \\\"/var/lib/docker/overlay2/49bc7f73ad9909a201c2330e3ac1445978c54c88a93e2a3c5057d3b7becaa6e6/merged/var/www/html/config.inc.php\\\" caused \\\"not a directory\\\"\""
: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

ERROR: for pkp-ojs  Cannot start service pkp-ojs: oci runtime error: container_linux.go:265: starting container process caused "process_linux.go:368: container init caused \"rootfs_linux.go:57: mounting \\\"/volumes/ojs/config.inc.php\\\" to rootfs \\\"/var/lib/docker/overlay2/49bc7f73ad9909a201c2330e3ac1445978c54c88a93e2a3c5057d3b7becaa6e6/merged\\\" at \\\"/var/lib/docker/overlay2/49bc7f73ad9909a201c2330e3ac1445978c54c88a93e2a3c5057d3b7becaa6e6/merged/var/www/html/config.inc.php\\\" caused \\\"not a directory\\\"\""
: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type
ERROR: Encountered errors while bringing up the project."`

Then I tried checking out the 3.1.0-1 tag, but the problem is the same.

Looks like is not able to find folders and the config.inc.php file... but it is supossed to work out of the box, isn't it?

Any idea about what am I missing?

Cheers,
m.

Private folder is wrong in autoinstallation querystring

Hi,

Private folder need to be set correctly when pre-installing at:

https://github.com/lucasdiedrich/ojs/blob/0677582ff8817ab1ca3a34ee777bfe37b93144a1/files/usr/local/bin/ojs-cli-install#L7
Now is:
filesDir=%2Fvar%2Fwww%2Fhtml%2Ffiles

But need to be:
filesDir=%2Fvar%2Fwww%2Ffiles
This happens in every branch.

Cheers,
m.

Feature request: Make it run over play-with-docker

As you know, play-with-docker (PWD) is a great platform to make software demos.

Some projects include a button to build a full stack and test before create your own infrastructure:
https://hub.docker.com/r/hackmdio/hackmd/

I think it could be a great addition to you README.md and I wanted to send you a PR to your documentation but I tested and it's not working.

It's supposed to be as easy as a link to your docker-compose.yml file in raw format, as follows:
https://labs.play-with-docker.com/?stack=https://raw.githubusercontent.com/lucasdiedrich/ojs/3.1.1-4/docker-compose.yml

Any clue about this is not working?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.