Day 16 – Deploy This Baby (go to project overview)
And, it is a baby. The app is so simple and easy. It doesn’t even have any great Javascript library in front of it. It just uses Django and Jquery. Ha! Is Jquery not a great Javascript library? I think it is. I need to learn and use React and I’m sure the things you can do with React will astound me and the users of any code I write. But, the front-end of this app is so simple that we don’t need all that fluff.
Bootstrap always helps!
Shout out for Bootstrap! Really, the app looks professional even though I don’t have a design skill bone in my body. Just put some gosh dang Bootstrap in there and viola! (before typing viola, I seriously considered typing waalaa…because I only just learned that they sound the same…we have stuff to learn every day of our lives, I tell ya).
Yes, she’s still very, very cheap!
As I’m thinking about how much it may cost me to have this app in AWS for even a day, I’m concerned. This is really a demo app. I’ve decided to use the sqlite db in the demo version just because I don’t want to pay for another server to host Postgresql. Seriously working for a company with money has some advantages. These are not shoes we’re talking about! I don’t want to pay so much!
As I’m looking at tutorials for deploying your web app with Docker, Terraform, etc., I’m getting a bunch of side ads from Digital Ocean. Terraform and Docker both use Digital Ocean (at least that’s how I’m interpreting this advertisement). So, why wouldn’t I, a cheap developer, use Digital Ocean? Well, that line of thought made me think a bit about my goal for this whole production. The truth is, it’s not a goal. It is goalS. There are two:
- Learn how to build and deploy stuff that may eventually make money.
- Show any person or company that would like to pay me for these skills that I do, indeed, have these skills.
Those two goals are compatible. Probably, with Terraform, I can build something that can be deployed to AWS and Digital Ocean with pretty much the same code. For now, I have to use AWS. Anyone paying me money will be using AWS, Google Cloud or Azure. But, I can keep my work viewable perpetually (hopefully…I haven’t checked into pricing) by using Digital Ocean. That’s what I’m talkin’ bout.
As I’m reviewing all of the Terraform, Docker, AWS info, I’m getting caught up in other stuff. Elastic Beanstalk, for instance. I think I should just not go there. It sounds great and probably makes the whole thing easier. But, it allows Amazon to do all the set up. It sounds like it could be more expensive than just setting up everything for myself.
It helps me to list steps a few times
I think I need to move forward with these steps:
- Set up my app to use a local Postgresql database
- Build a production database with RDS in AWS
- Build a docker container (even though it’s on my list of goals, I don’t have to do this to get the app out there, so I’ll consider this optional)
- Set up the TLS requirements …I’ve read a little and I think AWS’s Route 53 is what I need to use here.
- Use Terraform the basic set-up I acquired from the Pluralsight Terraform course to deploy to AWS.
Again with the cheapness!
This one cannot stop thinking about how much this is going to cost in AWS. I’ve had my AWS account for over a year and I have only started using it recently. Nothing is free, now. It seems a bit shady to set up a new account so I can get free stuff, so I’m going to suck it up and do it. Opening a ticket with AWS to ask if I could have my free period extended ended with them saying no.
They mentioned that I could just open a different account. I have other emails I could use, but it seems shady. Plus, digital ocean offers $100 free. I really, really don’t like the way AWS bills. You just have no idea how much stuff is going to cost. I’m spending money as we speak because I have something allocated that I’m not using but I’m not sure I can remove it without repercussions.
Just say yes to Digital Ocean!
So, you can use Terraform just fine to set up your digital ocean environment. I’m using this tutorial to get started. As with setting up AWS servers, the initial setting up a load balancer and services is easy as pie. The complications are setting up a certificate, etc. Maybe these things aren’t complicated for people who’ve done them a few times, I have not!
Anyway, I’m getting hung up by reading everything and doing nothing.
Watch out, she needs another list!
- Build a local Postgresql db. This brings up the question: Can I have a Vagrant instance that houses all of my PostGresql db’s so that I don’t have to have a separate db for each Vagrant instance. A little reading tells me this is probably not necessary. Just install postgresql on any instance that needs it. I keep going back to…I don’t need a local db I have sqlite for that. Done with this step.
- Build a Cloud (Using DigitalOcean rather than AWS for price predictability) Postgresql db. Done.
That was pretty easy. I’m using pgadmin to connect. It knows what to do so I don’t have to. I’m going to connect to my “Prod” db from my local django app and migrate everything, or, maybe I should read a bit about best practices?
Side Trip here
During this process, I had to make a side-trip to get dev set up. I removed the settings.py file and created a “settings” directory with two settings files…base.py and dev.py. Base is pretty much the same as the file I’ve been testing with all along. Dev has the connection to the posgresql version of the db instead of my local sqlite db. Something that surprised me is that Django didn’t create the db when I migrated. But, once I created the db, the migrations worked.
- Set up TLS requirements. In between the writing of the earlier list and the writing of this list, I’ve made the decision to use Digital Ocean rather than AWS for my development work. It just seems way more predictable. Digital Ocean isn’t exactly like AWS. In fact, it seems way less complex than AWS. But, for now, I’m going to use it because the cost is predictable. AWS is fine for resources I’m going to play with because I can tear them down quickly so they won’t cost that much. But, the Tweet Analysis site I’m working on needs to be available all of the time. So, I need to be able to predict the cost.
This decision makes me want to add a TLS certificate before the docker container since the test site load balancer and servers are up and running. I can get to them with the ip address, but not with www.susanenneking.dev. I read a Digital Ocean forum post that made me think the problem is not having a certificate. We’ll see. - Set up docker container based on the info in this article. The docker stuff is pretty foreign to me, but it’s pretty cool. It works as expected. It seems like something I have to do to deploy correctly. I am not doing the part in the article to get the db out there. My db is hosted on DigitalOcean, so no need.
Not ending the day with another list. You’re welcome!