Describe the issue or problem
We want to have test installation for our OJS and OMP, in the same server. We use sub-folders to accomplish this.
Since we have a suitable NFS filesystem where we can put our data (/var/www/htmt/data), we want to use that filesystem for storing all /uploads and /public sub-folders in it. The objective is to have:
OJS 3.2 uploads => data/ojs/uploads; OJS 3.2 public => data/ojs/public;
OMP 3.1 uploads => data/omp/uploads; OMP 3.1 public => data/omp/public;
When we install OJS and OMP at versione 3.3, we would also like to share /data/ojs/uploads and /data/omp/uploads between versions.
Is it possible? What is you suggestion, should we use .htaccess directives or other tools?
What application are you using?
OJS 3.2 & OMP 3.1 (OJS 3.3 & OMP 3.3 in the future).
You should never put the files_dir (which I think you’re referring to here as data; see config.inc.php) inside the web root! That’s a dangerous configuration.
OJS/OMP/OPS don’t care overmuch what kind of filesystem you’re using, and while I haven’t tried it, symbolic links should also be fine. So you could either mount NFS filesystems for the files_dir (placed wherever you like) and public directory (which is always inside the web root), or you could mount an NFS filesystem anywhere on the system and use symbolic links to point there for public.
(You haven’t proposed this, but just in case, I don’t recommend using NFS for other parts of the system like the codebase or the cache directory. It’ll perform slowly.)
Regards,
Alec Smecher
Public Knowledge Project Team
Thank you Alec, this is precious.
You’re right about NFS, not the fastest filesystem.
Simbolic links are a good solution, but their limit is that they can only apply to one instance, so they can address data/ojs/public or data/omp/public. I cannot use the symbolic links if I want 2 (OMP & OJS) in the same system.
So I think I must use .htaccess resolution, if possible.
Any other option?
Thx again, Alec.
To be more specific, I have to differentiate 2 main folders:
uploads
public
I know I can solve for the uploads folder, just setting the “files_dir” directive differently for OJS and OMP:
files_dir = /var/www/html/data/ojs/uploads/ for OJS
files_dir = /var/www/html/data/omp/uploads/ for OMP
but I cannot change the public folder.
The public folder is set in “public_files_dir” directive, but how can I set this to point to /var/www/html/data filesystem?
Again, never put the files_dir inside the web root (/var/www/html)! You’ll get hacked that way.
I’m not sure I understand the limit you’re describing for symbolic links in the public directory, but let’s see if this makes sense. Let’s say you mounted your NFS filesystem in /home/pkp_data (safely outside the web root):
home
└──pkp_data
├── ojs
│ ├── files
│ └── public
└── omp
├── files
└── public
You can configure the files directories directly in config.inc.php in the files_dir setting.
Then for the public part you could… (commands are example only, I haven’t tested these!)
# Move the public contents into the NFS filesystem
mv /var/www/html/ojs/public/* /home/pkp_data/ojs/public/
mv /var/www/html/omp/public/* /home/pkp_data/omp/public/
# Remove the old public directories now that they're empty
rmdir /var/www/html/ojs/public
rmdir /var/www/html/omp/public
# Create symlinks pointing the public/ part of OJS and OMP to the NFS filesystem
ln -s /home/pkp_data/ojs/public /var/www/html/ojs/public
ln -s /home/pkp_data/omp/public /var/www/html/omp/public
Regards,
Alec Smecher
Public Knowledge Project Team
Almost done. No problem with the uploads folder, it is in the NFS filesystem and it works correctly. We just have problems with the public folder, which we moved to the NFS filesystem as you suggested. We have moved it and created the link with the command ln -s /home/pkp_data/ojs/public /var/www/html/ojs/public but this will not work. In fact, when we load a try to load a new image the system replies “the public files directory was not found” (see screenshot)
.
When we instead use ln -s /home/pkp_data/ojs/public /var/www/html/public, it works, but this will forbid us to use two different links, one for OJS and one for OMP.
Can I share the same “public” and “files_dir” between different version also? I mean, I would like to have OJS3.3 and OJS3.2 that share “public” and “files_dir”, and also OMP3.3 and OMP3.1 that share their “public” and “files_dir”. Is it possible?
I don’t recommend using the same public and files_dir for two installations (of different apps, or different versions, etc); you’ll be playing roulette with potential duplicate filenames, and it’ll be impossible to later separate the two if you want to.
Did you configure something other than public for the public_files_dir in config.inc.php?
Regards,
Alec Smecher
Public Knowledge Project Team
It is always safer to create a new subdomain for the test installation with separate package, files and public folders with a separate copy of the production database. That is how I do my upgrade tests.
Not sure if that works for public. Please follow the advice by asmecher having separate public and files directories for both applications. I assume that OJS and OMP would create the same site subdirectory within public and therefore mess up the files within this.
We have installated our test environments for OJS and OMP.
Great.
The sub-folder mechanism is unfortunately causing the pictures’ path imported from the production environment not to work. The production system has no sub-folder. The test system has sub-folders (/ojstest and /omptest). The pictures’ path that we got from production is referring to:
Now the problem is how can we change all paths. Should we go through all images and change the path? I do not understand why it is not managed automatically by the system.
Is this something that we can automatically fix (even in 3.4 version)?
Or do you have a sql query to fix it?