This past summer I set up a little 6-dollar-a-month Ditigal Ocean linux server to run crons jobs for different coding projects like my Plug-N-Play Twitter Engager and some stock analyzer scripts. It was a pretty barebones server instance so it took a bit of work to get into production-ready state. I've tried to compile the steps here so others (and future me) can reference it for a quicker setup. ?
0 Comments
Good old AWS, the mercedes benz of cloud server hosts. I was at AWS today, and I got a better understanding of how to best run Ec2 servers to save in costs. ;)
Although I am a huge fan of lambda functions and s3 + cloudfront deployment stacks, in this current project I was using the botkit framework to make a slack chatbot. The framework is awesome, but the only catch was that it needs to be actually deployed on a real server so I had to put on my sys admin hat and fire up some ec2's. I ran into an interesting challenge in that the botkit server wants to run on localhost:3000, but in order to run it securely I need to use port 443. After unsuccessfully trying a few simpler hacks I bit the bullet and chose to use nginx as a reverse proxy here. I hadn't had much hands-on experience with nginx before this project so it was definitely a learning experience for me, and this post will be basically a walkthrough of the things I did to get it up and running.
Once upon a time I was the serverless guy at a startup company building lambda functions. My function went into production at 128mb of memory and a timeout of 3 seconds. Because of game had "live races" we would see big spikes in traffic at certain times of the day, and unfortunately I would also see big spikes in the number of errors in the CloudWatch metrics charts... My boss even opened the website during the high volume event and noticed requests to the lambda returning 400 error. In the cloudwatch logs I could norrow down the logs to just the high volume time and see many timeout errors happening during this period. Needless to say, this is not a good look, and you don't want it to happen to you (especially you, future Jim)!
If you are new to Docker or want a refresher on the key concepts of Docker, Jake Wright has a great video on youtube going over the topic called "Learn Docker in 12 Minutes".
|
AuthorThe posts on this site are written and maintained by Jim Lynch. About Jim...
Categories
All
Archives
March 2023
|