Skip to content

Conversation

jonhattan
Copy link
Contributor

It is usual to use deployment layout based on symlinks for some code or content files not managed in the app repository.

For example, this is the Ansistrano's layout I usually set up:

root@stc22:/var/www/demo1.d8.stc/releases/20241111074554Z/web# ls -lh sites/default/
total 108K
-rw-r----- 1 deploy www-data 9.6K Oct  9 17:07 default.services.yml
-rw-r----- 1 deploy www-data  36K Oct  9 17:07 default.settings.php
-rw-r----- 1 deploy www-data   50 Nov  5 09:24 example.local.drush.yml
-rw-r----- 1 deploy www-data 3.8K Nov  5 09:24 example.settings.local.php
lrwxrwxrwx 1 deploy deploy     45 Nov 11 08:46 files -> ../../../../../shared/web/sites/default/files
-rw-r----- 1 deploy www-data   55 Nov 11 19:16 local.drush.yml
lrwxrwxrwx 1 deploy deploy     47 Nov 11 08:46 private -> ../../../../../shared/web/sites/default/private
-rw-r----- 1 deploy www-data 6.7K Nov  5 09:24 services.yml
-rw-r----- 1 deploy www-data 2.4K Nov  5 09:24 settings.ddev.redis.php
lrwxrwxrwx 1 deploy deploy     58 Nov 11 08:46 settings.infra.php -> ../../../../../shared/web/sites/default/settings.infra.php
lrwxrwxrwx 1 deploy deploy     58 Nov 11 08:46 settings.local.php -> ../../../../../shared/web/sites/default/settings.local.php
-rw-r----- 1 deploy www-data  32K Nov  7 14:35 settings.php

In this layout, both content folders (files/ and private/) and code files (settings.local.php and settings.infra.php) are symlinked.

I propose for drupal_fix_permissions.sh to follow symlinks.

@rsanzante
Copy link
Member

I have some doubts about this. While I think the use case is legit and it would be great if the script can handle it, I'm not sure about the safety. Not following symlinks means there's no way to inadvertently impact files and folders outside the target Drupal root folder (well, and any additional content folders provided). With this change, a wrong symlink could lead to a disaster(for example, a symlink to /).

It is not usual, but sometimes wrong symlinks happen.

How to solve this and cover the use case? I see two options that may work:

  • Provide a flag to follow or not symlinks, not completely safe but safer.
  • Use the additional content folder param for files/ and private/ and add a new param for settings.local.php and settings.infra.php (additional code paths?)

What you think?

@jonhattan
Copy link
Contributor Author

I prefer a flag to follow symlinks. It keeps things simple for the user and also works as a do it if you know what your doing flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants