Table of Contents

Issue 2022 - July

Make django-q AWS Elastic Beanstalk and auto-scaling friendly

This is backposted, as always.

As I've written previously, my client has django-q deployed at AWS Elastic Beanstalk aka “boring tech”. It works, so why the hell not, except for deploys and scale up/down events. You see, despite the fact that app/VM can die anytime, despite small and idempotent tasks, we wanted to be as nice as possible and to let django-q finish whatever it was doing.

Elastic Beanstalk platform has a few hooks which allow you to execute custom scripts at various stages of application's lifecycle. Unfortunately, it doesn't have pre-delete or pre-destroy hook. I've asked in AWS forums and the answer was, if I remember correctly, somewhere between DIY and random. Disappointing, but somewhat expected. Luckily, there is a predeploy hook. And this hook, together with AWS Systems Manager Automation, will just do the trick we need.

The plan:

This sets us up for deploys. As for auto-scaling, we will need:

Now, auto-scaling documentation states that:

To signal Amazon EC2 Auto Scaling when the lifecycle action is complete, you must add the CompleteLifecycleAction API call to the script

However, I'm not sure whether this just applies to some cases or whether it's handled as part of AWS::SSM::Document. It's possible to set DefaultResult: “CONTINUE” in AWS::AutoScaling::LifecycleHook after HeartbeatTimeout is up. Also, there is action: aws:executeAwsApi as part of AWS::SSM::Document and the final script has no AWS API calls. Of course, you don't want to wait for timeout to happen, if you don't have to. Time is money in AWS.

References:

and probably some others.

Zdenek Styblik 2022/07/10 11:40

Spigen replaced by Spigen

Some (longer) time ago I've bought Spigen Rugged Armor for Google Pixel 2 XL from 2017. Sadly, it cracked couple months later. As for why it could be due to multiple reasons:

  1. Qi wireless charger receiver
  2. phone holder(“clamp”) in the car
  3. 5#17 like that just happens

It can be anything, although I've found comments which support “it just happens” theory.

Cracked Spigen Rugged Armor

Cracked Spigen Rugged Armor

Cracked Spigen Rugged Armor

It kept soldiering on until it cracked even more. Maybe phone falling on the ground had something to do with that. Thus search for replacement begun and I've settled on Spigen Thin Fit Designed for Google Pixel 2 XL Case.

Spigen Thin Fit Designed front

Spigen? Again? To be honest, there aren't that many choices for a product released 5 years ago. It probably would be easier to buy just a new phone with all “peripherals” :) Can you spot small typo on the back of the box? :)

Spigen Thin Fit Designed back

One word about protection. I don't think anything will protect phone screen from cracking and cracks when phone falls to the ground, realistically speaking. All one can do is to increase chances of survival, but that's it.

Zdenek Styblik 2022/07/14 11:06