WordPress.org

Ready to get started?Download WordPress

Forums

W3 Total Cache
W3TC w/CloudFront - Delete Local Files? (7 posts)

  1. Jark
    Member
    Posted 2 years ago #

    I have been faithfully using W3TC with Amazon CloudFront (origin pull) for quite some time now and it works flawlessly. However, drive space is becoming an issue now.

    Is there a way to use W3TC so once the media files are uploaded to Amazon (maybe to S3 using origin push instead?) the local files are then automagically deleted from the web server, to conserve disk space?

    It seems like it should be doable but I can't seem to wrap my head around how to make it work. I've not been able to dig up anything on the internets to help.

    Anyone have any experience with this? If so, help...please? Pretty please?

    http://wordpress.org/extend/plugins/w3-total-cache/

  2. Willie Jackson
    Member
    Posted 2 years ago #

    There's no way to configure this with W3TC, you'd be looking at some custom scripting...but I wouldn't recommend it. I'd switch hosts to one with more disk space before hacking together something that nukes my media library.

    And you wouldn't be able to use an origin pull CDN like this, because your site is the canonical source of the assets to once they expire, the image reference(s) would 404.

  3. Jark
    Member
    Posted 2 years ago #

    I was thinking that if the files were uploaded to Amazon S3 and served via CloudFront, with the origin being a cname to the S3 bucket, that it would work. This way the canonical source is the files in the S3 bucket. No?

    The problem is I cant seem to find any plug, or series of plugins, that would accomplish this.

    Unless I'm mistaken and my idea is too insane, which is absolutely possible.

  4. Willie Jackson
    Member
    Posted 2 years ago #

    So let me revise my last statement: if CloudFront is configured to pull from an S3 bucket, what you're talking about is possible.

    And yes, you'd be looking at a custom plugin/script/cron job to accomplish what you're talking about.

  5. Jark
    Member
    Posted 2 years ago #

    So let me see if you think this would work:

    1. Configure a cname for S3. Lets go with cache.site.com
    2. Configure a cname for CloudFront. Lets go with cdn.site.com
    3. Configure an Amazon S3 bucket and let it use cache.site.com
    4. Configure Amazon CloudFront with cname of cdn.site.com and origin of the S3 bucket. Do *not* configure it to use the site.
    5. Configure W3TC to use a CDN, using Origin Push, Amazon S3
    6. Configure the W3TC CDN setting for the Amazon S3 bucket so that images and other resources are uploaded to the S3 bucket.
    7. Configure the W3TC CDN "Replace site's hostname with" setting with the cname for Amazon CloudFront - cdn.site.com.

    Assuming I got all that right, as media is uploaded to WordPress, it will be pushed to the S3 bucket via the W3TC hooks. Then when the site is viewed, W3TC rewrites the images to point to cdn.site.com, which should then pull the images from S3.

    Does that make sense?

    So then the only thing I'm missing would be to write a custom script to periodically delete images from the WP upload folder (or others as well)?

    Am I totally off my rocker here or does this make some sense?

  6. Willie Jackson
    Member
    Posted 2 years ago #

    #1 isn't needed, but the other steps make sense.

    What you're talking about isn't particularly hard to do or confusing, it's just not recommended. If you insist on doing it, clone your site to a dev location to test the solution.

    My concern is that you immediately tie yourself to a solution that requires S3, CloudFront, and W3TC to work. W3TC can never be deactivated, and AWS can never have interruptions.

    Also, every subsequent iteration of your site must have the same setup or you need to re-import all the images back into WP (assuming that they're all available).

    You're just setting yourself up for headaches once your brilliant solution works wonderfully :)

  7. testlink25
    Member
    Posted 2 years ago #

    this plugin seems to do what you are asking for according to the description http://wordpress.org/extend/plugins/amazon-s3-uploads/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.