Skip to content
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

Add functionality to upload assets. #4

Open
2 tasks
arenoir opened this issue Dec 3, 2015 · 15 comments
Open
2 tasks

Add functionality to upload assets. #4

arenoir opened this issue Dec 3, 2015 · 15 comments

Comments

@arenoir
Copy link
Owner

arenoir commented Dec 3, 2015

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.

@Turbo87
Copy link

Turbo87 commented Feb 1, 2016

@arenoir any progress on this?

@arenoir
Copy link
Owner Author

arenoir commented Feb 1, 2016

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.

@arenoir arenoir closed this as completed Feb 1, 2016
@arenoir arenoir reopened this Feb 1, 2016
@lancedikson
Copy link

@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.

@sandstrom
Copy link

sandstrom commented May 25, 2016

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.

@miguelcobain
Copy link

@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.

@arenoir
Copy link
Owner Author

arenoir commented Jun 22, 2016

@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.

@arenoir
Copy link
Owner Author

arenoir commented Jun 22, 2016

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

@sandstrom
Copy link

@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.

@arenoir
Copy link
Owner Author

arenoir commented Jun 28, 2016

@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.

@sandstrom
Copy link

sandstrom commented Jun 28, 2016

@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.

@arenoir
Copy link
Owner Author

arenoir commented Jun 28, 2016

@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

@miguelcobain
Copy link

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

@bummzack
Copy link
Contributor

bummzack commented Sep 2, 2016

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?

@bobbus
Copy link

bobbus commented Nov 2, 2016

@bummzack : Did you find how to achieve this ?

@bummzack
Copy link
Contributor

bummzack commented Nov 3, 2016

@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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants