Closed marcbria closed 6 years ago
That's because in the compose file we have all variables that we can use, just comment the lines starting with /volumes/ojs at pkp-ojs, this two folder probably doesn't exist in your machine.
I will wait for a response. Thanks.
Em sex, 19 de jan de 2018 11:03, Marc Bria notifications@github.com escreveu:
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.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/lucasdiedrich/ojs/issues/1, or mute the thread https://github.com/notifications/unsubscribe-auth/AAx5SjjL-xC26r5ycLwR9-BYIY-2MnqTks5tMJKJgaJpZM4RkcjJ .
Sorry for the lag in this answer.
Yes... obviously, commenting the volume lines make docks started correctly. The hurry... :-)
To avoid this kind of problems, what about commenting all volume lines by default, so people can start easily... and (in case they know what they are doing) they can uncomment and fit their needs?
Indeed, I have some proposals/thoughts I like to talk with you.
If you don't mind, let's start with the docker-compose before we take a look to the Dockerfile.
In your docker-compose I suggest:
a) Add more volumes: We know it's not a good idea to keep useful data inside a container. They can fail, and lot of people learned this by the hard way... so, we agree in that we need volumes. Although they could be commented, I suggest extend your volume list with public and private files (in separate vols), a volume for mariadb and also a volume for apache logs. I also like to have control over .htaccess and php.ini.
b) Relative paths: I'm working in a script to build a "farm" of ojs based on docker and docker-compose. What I learned there is that looks like a good idea to keep the volumes and config files close to the docker-compose.yml (in same path or subfolders)... because stuff is easier to find and you keep the whole application "self-contained" (config, files, etc.)
If you apply a) and b), volumes section could look like this:
# volumes:
# - /etc/localtime:/etc/localtime # to sync the container clock with localhost.
# - ./files/private:/var/www/files # ojs' private files
# - ./files/public:/var/www/html/public # ojs' public files
# - ./files/logs:/var/log/apache2 # apache logs
# - ./config/ojs.config.inc.php:/var/www/html/config.inc.php # ojs' config
# - ./config/apache.htaccess:/var/www/html/.htaccess # ojs' htaccess
# - ./config/php.custom.ini:/usr/local/etc/php/conf.d/custom.ini # php config
Notice I suggest moving all config files to the same folder (with no subfolders).
c) ENV variables: Instead of hardcode your variables in the docker-compose, why not placing them in a .env file. I think .env file is much more versatile... for instance, you can switch between .env.prod and .env.dev, you can keep all your "secrets" in the same place and secure them, you can set the right ports... And in future it could be improved with "docker secrets" or vault... or extend config with traefik, etc. If you are concerned about security, this post worth a look: https://stackoverflow.com/questions/22651647/docker-and-securing-passwords
d) Default port: I suggest raising the container in 8080 port instead of 80 (that will usually collide with apache/nginx).
e) Naming mysql container: It's nice to see all the related containers with the same prefix.
f) MariaDB: Free software projects are progressively moving to mariadb. I need to check this, but I suspect OJS is also ready to make the jump so the docker-compose could run the stack based on mariadb image.
From now, this is what came to me. All depends if you deliver this docker-compose as a simple example to play you Dockerfile (in this case, commenting volumes will do the job) or you like this compose become something more elaborated (like in docker4drupal, or others).
What do you think?
If you want I can commit a PR with the suggested changes.
Hi, mark, awesome sugestions, i've open one new issue for this.
Also, i added two tasks to enhance the docker with supervisor and dynamic loaded variables into ojs config file.
About changing to MariaDB, i have two opinions, first of all i don't see people screaming about that anymore, and if you check it out at docker hub both have similiar number of downloads. The second one is normally the user will not use the database from docker-compose, like me, i've a database cluster stablished and all services are using that cluster, so i use docker-compose database to test only.
Anything more just open more issues, thanks for all.
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:
I did the following on a machine with docker:
And I get an error when creating the ojs container:
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.