Deploy to s3 and redis?

Hope that not a dump question but i come across a web app built with rails and ember the way this app deployed can’t really understand the developer generated the static files and pushed to s3 same time there is a CloudFront URL when i was searching i found that some files pushed to s3 and the index file gone to redis i really don’t understand how this works can somebody help me understand for ember’s sake ! cheers

example this Strategies for Deploying with Rails

Hi @almokhtar , it’s the strategy we use with my team so I can explain it (even though we don’t use Rails in our implementation).

The flow goes like this:

Step 1: We run ember build --environment=production and push the dist folder to an S3 bucket. Because the environment is production here, all files are fingerprinted and are prepended with our CDN URL (Cloudfront), but I could have been just the S3 bucket URL.

Step 2: We take the content of the generated dist/index.html (which contains the full URLs to the app.{css,js} vendor.{css,js} with fingerprinting and everything) and store it in Redis in particular key like my-app:latest

At this point, we have a Redis that content the following key stored:

key value
my-app:latest content of the index.html

Step 3: On the Rails server, on the home path (/), we fetch the latest deployed app by using redis.get('my-app:latest') and respond with it to the client (with text/html content type)

And that’s it, you now serve your app via your Rails app and Redis. This allows you to store as much versions of your app as you want and perform quick rollbacks too. With my team, we actually store both my-app:latest and my-app:<git-commit-hash keys and we have some tools to swap the content in Redis, which will always be quicker than an Ember Build. So in case of urgent rollback, we can just set my-app:latest to the content of an older/bugless commit-hash.

We also implemented a way to go back in time by passing a query parameters to the website URLs. So when we go to my-app.com?version=<commit-hash>, Redis with fetch from my-app:<commit-hash> instead of my-app:latest (it works as long as the backend API is still compatible)

Hope this was clear enough :slight_smile:

Thank you so much @phndiaye