Skip to content

Instantly share code, notes, and snippets.

@steinnes
Last active October 30, 2019 17:32
Show Gist options
  • Save steinnes/1f8a1b44fed4b136005f to your computer and use it in GitHub Desktop.
Save steinnes/1f8a1b44fed4b136005f to your computer and use it in GitHub Desktop.
EB config file which executes setup_swap.sh
container_commands:
01setup_swap:
command: "bash .ebextensions/setup_swap.sh"
@steinnes
Copy link
Author

Wow, I just noticed these comments on my gist, I'm flattered! Perhaps I should enable comments on my blog :-)

@samzilverberg: The reason I chose container_commands was to be able to include the swap setup script as a separate file, but your implementation of inlining inside the config yaml works fine as well, and I guess some will feel that it's more elegant (also it does not suffer from a mistake I made in cleaning up the path). I am curious how you learned to write files into /opt/elasticbeanstalk/hooks/appdeploy/pre/, is this something the AWS docs recommend or something you figured out by reverse engineering Elastic Beanstalk internals? :-)

@lucasdavila: Out of curiosity, why would you disable the swap after the deployment? To me the only upside would be to save some disk space, but offset that against performing extra swap-creation work with every deployment (thus making them slower). If you're worried about the kernel using the swap space and the node performance deteriorating due to unnecessary swapping, that should be avoidable by setting vm.swappiness = 0 (see: https://en.wikipedia.org/wiki/Swappiness)

I'm (perhaps sadly) not going to update the blog post because I've switched to kubernetes for my app deployments, and thus can't easily test your methods, but I did update the gist to remove the erroneous /swap/.. path to setup_swap.sh.

@rokumatsumoto
Copy link

@steinnes

I'm (perhaps sadly) not going to update the blog post because I've switched to kubernetes for my app deployments, and thus can't easily test your methods

I tested @lucasdavila 's config and it worked.

Please update your blog post.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment