container_commands: | |
01setup_swap: | |
command: "bash .ebextensions/setup_swap.sh" |
This comment has been minimized.
This comment has been minimized.
@samzilverberg thank you to the comment, it helped me a lot, also thanks to steinnes :) As a suggestion, you can also setup a "post hook" to turn of the swap and remove the swap file, after the deploy: .ebextensions/setup_swap.config
|
This comment has been minimized.
This comment has been minimized.
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 @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 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 |
This comment has been minimized.
This comment has been minimized.
I tested @lucasdavila 's config and it worked. Please update your blog post. Thanks! |
This comment has been minimized.
ty your article at http://steinn.org/post/elasticbeanstalk-swap/ was helpful.
some thoughts:
container_commands run after your source bundle has been zipped and before your container has been built (for docker for example), and before the actual deploy takes place.
i found it more useful to setup the swap before everything takes place.
im my case the build process takes extra memory that my app doesnt need and that my instance type on aws (small) doesnt have.
so i setup the swap logic to run as part of the Elastic Beanstalk hooks flow:
setup_swap.config
you might find it useful as well, enjoy and thanks for the article again!