Skip to content
This repository has been archived by the owner on Dec 31, 2022. It is now read-only.

public/assets always purged #224

Closed
toreym opened this issue Oct 4, 2019 · 1 comment
Closed

public/assets always purged #224

toreym opened this issue Oct 4, 2019 · 1 comment

Comments

@toreym
Copy link

toreym commented Oct 4, 2019

Expected Behavior

When setting

                "purge_before_symlink": [
                    "log",
                    "tmp/cache",
                    "tmp/pids",
                    "public/system"
                ]

public/assets should not be purged. right?

the sprockets manifest file in this directory needs to stay in place for our deploy.

Actual Behavior

This directory is getting purged no matter what we do. The following line in the log from opsworks.

purged directories in checkout log, tmp/cache, tmp/pids, public/system, public/assets

Custom JSON

{
    "deploy": {
        "ourapp": {
            "source": {
                "remove_scm_files": false
            },
            "global": {
                "logrotate_rotate": 14,
                "purge_before_symlink": [
                    "log",
                    "tmp/cache",
                    "tmp/pids",
                    "public/system"
                ]
            },
            "appserver": {
                "application_yml": true,
                "adapter": "unicorn"
            },
            "framework": {
                "migrate": false,
                "assets_precompile": false
            }
        }
    },
    "ruby-version": "2.3"
}

notes

We've tried to find the issue, but cannot track down where this directory is being purged from and why.

@toreym
Copy link
Author

toreym commented Oct 4, 2019

The enhancement above will keep existing functionality however, it also allows a user to remove a directory from the list of defaults. This is useful for example when you precompile before a deploy and keep the public/assets/.sprockets.manifest.json file in source control.

ajgon added a commit that referenced this issue Nov 23, 2019
Before this patch, global options `symlinks`,
`create_dirs_before_symlink` and `purge_before_symlink` were appending
new entries to existing defaults, instead of replacing them. This was
counter-intuitive as all other options override existing ones and there
is no reason that there should be an exception.

Fixes #224

BREAKING CHANGE: `app['global']['create_dirs_before_symlink']`,
`app['global']['purge_before_symlink']` and `app['global']['symlinks']`
now overrides defaults instead of appending them. If you were relying on
those options in your Custom JSON, you need to add missing defaults
manually.

For example given:

```json
{
  "deploy": {
    "myapp": {
      "global": {
        "create_dirs_before_symlink": ["test/create"],
        "purge_before_symlink": ["test/purge"],
        "symlinks": {
          "test": "test/symlinks"
        }
      }
    }
  }
}
```

you need to replace it to:

```json
{
  "deploy": {
    "myapp": {
      "global": {
        "create_dirs_before_symlink": ["tmp", "public", "config", "../../shared/cache", "../../shared/assets", "test/create"],
        "purge_before_symlink": ["log", "tmp/cache", "tmp/pids", "public/system", "public/assets", "test/purge"],
        "symlinks": {
          "system": "public/system",
          "assets": "public/assets",
          "cache": "tmp/cache",
          "pids": "tmp/pids",
          "log": "log",
          "test": "test/symlinks"
        }
      }
    }
  }
}
```
@ajgon ajgon closed this as completed in b2650fb Nov 23, 2019
dotnofoolin pushed a commit to dotnofoolin/opsworks_ruby that referenced this issue Nov 23, 2021
Before this patch, global options `symlinks`,
`create_dirs_before_symlink` and `purge_before_symlink` were appending
new entries to existing defaults, instead of replacing them. This was
counter-intuitive as all other options override existing ones and there
is no reason that there should be an exception.

Fixes ajgon#224

BREAKING CHANGE: `app['global']['create_dirs_before_symlink']`,
`app['global']['purge_before_symlink']` and `app['global']['symlinks']`
now overrides defaults instead of appending them. If you were relying on
those options in your Custom JSON, you need to add missing defaults
manually.

For example given:

```json
{
  "deploy": {
    "myapp": {
      "global": {
        "create_dirs_before_symlink": ["test/create"],
        "purge_before_symlink": ["test/purge"],
        "symlinks": {
          "test": "test/symlinks"
        }
      }
    }
  }
}
```

you need to replace it to:

```json
{
  "deploy": {
    "myapp": {
      "global": {
        "create_dirs_before_symlink": ["tmp", "public", "config", "../../shared/cache", "../../shared/assets", "test/create"],
        "purge_before_symlink": ["log", "tmp/cache", "tmp/pids", "public/system", "public/assets", "test/purge"],
        "symlinks": {
          "system": "public/system",
          "assets": "public/assets",
          "cache": "tmp/cache",
          "pids": "tmp/pids",
          "log": "log",
          "test": "test/symlinks"
        }
      }
    }
  }
}
```
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant