silverstripe / sspak

Tool for managing bundles of db/assets from Silverstripe environments
http://silverstripe.github.io/sspak/
BSD 3-Clause "New" or "Revised" License
47 stars 34 forks source link

sspak load destroys assets symlink #62

Closed wernerkrauss closed 6 years ago

wernerkrauss commented 6 years ago

I deploy a capistrano style with deployer php, which symlinks assets in each release.

Using sspak load my.sspak /path/to/current destroys the assets symlink in current and generates an assets directory with the new content - which is lost in the next release.

See https://github.com/silverstripe/sspak/blob/d697d767758d713952a4e0b21c0cd3b1088462e2/src/Webroot.php#L138-L157 where that happens.

andrewandante commented 6 years ago

What does assets symlink to? I wonder if we can detect that it's a link, and act accordingly. Probably recreate the symlink is the best bet I think, but would need to do some testing.

wernerkrauss commented 6 years ago

My structure is like:

_/path/to/publichtml/: root of whole installation, contains _ssenvironment.php /path/to/publichtml/shared: contains shared stuff _/path/to/publichtml/shared/assets: assets dir _/path/to/publichtml/releases/: releases _/path/to/publichtml/releases/1234: a release _/path/to/publichtml/releases/1234/assets: symlink to /path/to/publichtml/shared/assets /path/to/publichtml/current: symlink to latest release; apache webroot

one possible solution instead of renaming old assets and deleting them later would be to clear it and extract into it using tar's --strip 1 parameter. Or just the current logic in the shared/ folder instead the webroot.

andrewandante commented 6 years ago

@wernerkrauss could you give this one a bash? I've tried it out on my Bash-on-Windows env, but it'd be great if you could test as well.

NZI commented 6 years ago

Confirmed here

uname -a
Linux saltminion 3.13.0-83-generic #127-Ubuntu SMP Fri Mar 11 00:25:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

php -v
PHP 5.5.9-1ubuntu4.22 (cli) (built: Aug  4 2017 19:40:28) 
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
    with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies

cat ~/.composer/composer.json 
{
  "repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/silverstripe/sspak"
    }
  ],
  "require": {
    "silverstripe/sspak": "dev-master"
  }
}
andrewandante commented 6 years ago

@NZI could you test using my fork? The more positive results the better :)

Then maybe I'll get @dhensby to merge it for ~me~ us 😄