Skip to content

Add functionality to upload assets. #4

Open

Description

@arenoir

If assetsDestination present upload assets to specified destination.

  • upload to assetDestination using tar and sftp Note assetDestination is relative to revision folder
  • prepend revision + assetDestination to all asset references similar to how the fingerprint functionality of ember-cli works.

Note. instead of uploading all files one at a time and creating directories use tar.

Activity

  1. Turbo87 commented on Feb 1, 2016

    @Turbo87

    @arenoir any progress on this?

  2. arenoir commented on Feb 1, 2016

    @arenoir
    OwnerAuthor

    Turbo87 not yet. I am unsure if scp is the way to go anyway. It works well for single files but not so much for recursive directories. I am thinking of placing assets in a version_id subfolder. So assets can be easily managed. I am open to ideas.

    For now I am using the ember-cli-deploy-rsync addon for assets.

  3. reopened this on Feb 1, 2016
  4. lancedikson commented on Feb 8, 2016

    @lancedikson

    @arenoir, I think that placing assens in a version_id subfolder is a great idea. Do you have any progress for the task? I can help if you share your progress. It's very important thing for me.

  5. sandstrom commented on May 25, 2016

    @sandstrom

    Agree, assets support would be great. ⛵

    The capistrano flow for something similar is to:

    1. tar the files
    2. sftp to host (https://en.wikipedia.org/wiki/SSH_File_Transfer_Protocol)
    3. unpack and move into revision-keyed directory
    4. symlink old release/revision to new release/revision

    Another one would be support for multiple machines, i.e. an array of IP's to connect to (for upload), whilst only building once.

  6. miguelcobain commented on Jun 22, 2016

    @miguelcobain

    @arenoir any reason in favor of ssh+tar instead of rsync?

    Or is your reasoning that since all assets are fingerprinted we need to deploy them again anyway?
    Rsync is nice because it uploads the difference.

  7. arenoir commented on Jun 22, 2016

    @arenoir
    OwnerAuthor

    @miguelcobain Rsync makes sense when the assets are uploaded to a common assets directory. I am proposing keeping a folder of assets for each revision. The downside is each revision will certainly have duplicate assets but I feel the benefit of having a complete package of the the revision out ways that.

  8. arenoir commented on Jun 22, 2016

    @arenoir
    OwnerAuthor

    The other disadvantage of versioned asset folders is the browser will have to recache assets that may not have really changed between deploys.

  9. sandstrom commented on Jun 28, 2016

    @sandstrom

    @arenoir if the fingerprint (and hence the filename) hasn't changed the browser won't re-cache even though the files may reside in multiple directories (multiple copies) on the server.

    Multiple directories (plus symlink to target current) makes rolling back to a previous version easier.

  10. arenoir commented on Jun 28, 2016

    @arenoir
    OwnerAuthor

    @sandstrom I am proposing referencing the assets by their versioned path.

    The link to the asset would look like.

    /revisions/{revisionId}/assets/application-{md5}.js
    

    Even if the file name is the same I don't think the browser will cache it because the path will have changed between versions.

  11. sandstrom commented on Jun 28, 2016

    @sandstrom

    @arenoir I see, what you propose is one way of doing it.

    Another one is something like this:

    /revisions/{revisionId}/assets/application-{md5}.js # file
    www.example.com/assets/application-{md5}.js # external path
    

    Which one of these two would be entirely configurable, i.e. depend on webserver configuration.

  12. arenoir commented on Jun 28, 2016

    @arenoir
    OwnerAuthor

    @sandstrom having the external path always resolve to the current revision directory would work but prevent previewing other revisions. So perhaps a config option not to change the asset paths is also needed.

    Here is how I configured nginx to work with revisioned assets. https://gist.github.com/arenoir/ab00ef67f2b2838f78ea950675e1a8bf

  13. miguelcobain commented on Jul 4, 2016

    @miguelcobain

    Idea: copy the assets folder from the previous revision and then rsync to that new directory?

  14. bummzack commented on Sep 2, 2016

    @bummzack
    Contributor

    I'm currently trying to figure out how to deploy assets using this plugin. Is there a way to also invoke the ember-cli-deploy-rsync plugin to copy the assets?

    Ideally, everything would be deployed to the same revision… eg:

    /app
        active
        revisions
            <revision-hash>
                index.html
                assets/
                    …all assets here
    

    Is that possible currently? Can I somehow pass the revision-hash to the ember-cli-deploy-rsync plugin as target-folder?

  15. bobbus commented on Nov 2, 2016

    @bobbus

    @bummzack : Did you find how to achieve this ?

  16. bummzack commented on Nov 3, 2016

    @bummzack
    Contributor

    @bobbus Not really, I wrote my own deployment plugin (as in-repo addon) to achieve what I need. Other than using rsync to copy files, I also needed to create some custom symlinks, so the custom plugin was pretty much the only option.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions