For day to day work I wrangle containers in EKS these days. However when doing personal projects EKS is a luxury (baseline cost being $70 or so per month). So I decided to do microservice development for the rain radar project using no Docker, no Kubernetes but using:
- multiple venvs
- multiple service folders
- environments in .env files (secrets in plain text)
- web service start using @reboot in Cron
- scheduled services using ... ya Cron
The whole thing started with noble intentions to use lambda's all the way however I got stuck in using S3-SNS to trigger the lambda and decided to scan the S3 bucket using timestamps to find latest files to process. More on the pitfalls of that later.
The major microservices handle are:
- Raw radar data preparation using custom hand crafted algorithm, being ported to Rust here.
- Inserting prepared data to DynamoDB as a sparse array and serving this via Flask.
- Nowcasting using the timeseries of sparse array of rain observations also serving results via Flask.
- Capturing rain events and nowcasts and creating text and gif to send to twitter.
Each of these applications consumes the other to some extent and is sort of separated in responsibility. I decided to deploy them with basic a folder per application on the /home/ubuntu
directory, with a venv per folder.
I had it like this for a while. Then I got tired for sshing into the box and git pulling in each folder. So I decided to write a fabfile per application which would do this for me and created deployment keys which would be used to pull the code to this folder. Then I got tired of running multiple fabfiles and decided to setup a polled process which run the fabfiles and git synced the code from a master pipeline.
Eventually I got around to bootstrapping the whole VM using Packer + Ansible playbooks. The development work for it was done locally using Vagrant with Hyper-V as the VM provide to test the same Ansible playbooks. I will follow up on this with a few characters on twitter.
Wrangling VM's with Packer, Vagrant and Ansible all at the same time. Helped me figure out issues in Ansible docs and divergence between bento ubuntu box and AWS AMI. One calls ntp ntpd, the other ntp.service. pic.twitter.com/tSbaPuKtVB
— Tisham Dhar (@whatnick) July 18, 2020
Once the initial Packer AMI is established the choice is to either keep building this image or to move away from the whole VM based old-school stuff to a more modern/fun Kubernetes way.
No comments:
Post a Comment