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

Travis CD to AWS S3 - Versioning and Old File Cleanup #22

Open
kirlat opened this issue Jan 10, 2020 · 4 comments
Open

Travis CD to AWS S3 - Versioning and Old File Cleanup #22

kirlat opened this issue Jan 10, 2020 · 4 comments

Comments

@kirlat
Copy link
Member

kirlat commented Jan 10, 2020

Currently, Travis CD configuration does not provide any way to remove obsolete files from an AWS S3 bucket. From the Travis S3 docs:

Note that deploying to S3 only adds files to your bucket, it does not remove them. If you need to remove deprecated files you can do that manually in your Amazon S3 console.

Because of this we have to establish a process that will clean older files from the S3 bucket on its own, not relying on Travis CD.

@kirlat
Copy link
Member Author

kirlat commented Jan 22, 2020

Placing releases to the versioned folders (i.e. cedict-1.0.1, cedict-1.0.2, etc.) would make this simpler, I think. We can then have a script that will scan folders and read a version. Based on that it can decide whether a folder be removed or not.

We can use Amazon API Gateway to hide those versioned folders from the outside world. Here is what Even Financing is using:

We use Amazon API Gateway as a simple proxy in front of our Amazon S3 bucket. We set up our API to have 3 main resources:
/snapshot/{s3path+}
/v/{s3path+}
/{s3path+}

All of the resources are configured as HTTP proxies, with s3path mapped from method.request.path.s3path. /v, and /snapshot point to their corresponding https://s3.amazonaws.com/<bucket name>/<snapshot|version>/{s3path}. The remaining non-versioned resource, points to https://s3.amazonaws.com/<bucket name>/{version}/{s3path}, with version mapped from stageVariables.version.

The piece above is taken from Continuous Release Pipeline with Travis CI.

@balmas, what do you think?

@balmas
Copy link
Member

balmas commented Jan 22, 2020

In general, I am okay with using versioned folders, but I would like to avoid introducing another AWS dependency if we can help it (as we pay for API gateway usage)

Since the buckets are already served by a cloudfront distribution, perhaps we could figure out how to handle pointing at the right versioned folder via the cloudfront configuration?

@kirlat
Copy link
Member Author

kirlat commented Jan 22, 2020

Thanks, I will check it out

@balmas balmas changed the title Travis CD to AWS S3 Travis CD to AWS S3 - Versioning and Old File Cleanup Jun 24, 2020
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

2 participants