-
-
Notifications
You must be signed in to change notification settings - Fork 271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Permission denied error when shlink tries to download same GeoLite db more than once #899
Comments
Related to #621 |
Thanks for reporting. I did that command in a way that it sets up a lock that prevents multiple executions in parallel, but I never considered having multiple instances of shlink where each one of them will have it's own lock, but a shared filesystem. I think this should be easy to fix, by either using a more randomized temp name, or by using some folder inside shlink's instance dir. Any is those approaches would prevent this collision. |
Thanks for the quick reply! To use the instance directory is a good idea. I updated the config in /home/user2/htdocs/config/params/generated_config.php and added: 'geolite2' => array(
'license_key' => 'somelicense',
'temp_dir' => '/home/user2/htdocs/data',
), This solves the shared filesystem problem. |
Yep. I actually didn't remember that config option even existed, haha. It's probably as easy as that. |
Ok, good. For me this issue is solved with the configuration change. Thank you!
I had a look at the repos and the code you implemented for this project... quite impressive. |
Thanks for the kind words 🙂 |
I have just merged a PR changing the default value for The fix will be part of the upcoming v2.4.2 |
How Shlink is set-up
Summary
We have setup multiple installations on one server each served by a different vhost.
For geolocation we have configured cronjobs which run in the context of the user/group of the corresponding vhost.
Current behavior
When a Geolite2 database download is available and needs to be downloaded there is a conflict extracting the file Geolite2-City.mmdb file into the temporary directory. The first run of the task ./cli visit:locate creates a directory in the configured temp_dir "GeoLite2-City_[timestamp]" owned by the corresponding user. The second run of the task, started by another user, cannot extract the file to the already existing directory because of the directory ownership.
Expected behavior
I would expect multiple runs of the task visit:locate to be independent of each other, not conflicting in the described way.
How to reproduce
Just run the task ./cli visit:locate for two different installations with two different users.
Make sure there is no GeoLite2-City.mmdb file in the corresponding data-directory.
The first run succeeds, the second run fails with:
The text was updated successfully, but these errors were encountered: