Tinyblog is LIVE

It’s not much, but it’s mine. After struggling a bit with Docker in the testing environment, I managed to get everything running on an old laptop, and it worked great! Moving the app to production was a little more involved, but the containerization procedure I had set up mostly worked, and I learned a lot.

I went with a cloud-hosted virtual machine running Ubuntu Server with three Docker containers: 1) the Nginx reverse proxy, 2) the PostgreSQL database, and 3) the Django app itself. All three containers are running with Docker Compose, making it a **lot** easier to spin things up and change configs. I am a convert.

Getting the reverse proxy to work on HTTP was no problem, but the HTTPS certificate was a pain in the ass. I never could figure out how to get Certbot to fetch the SSL certificates through the proxy server, so I ended up just turning off the site for a second and fetching them manually through port 80. High on my to-do list is figuring out how to automate this process so I don’t have to remember to do it manually every three months.

Once I had the site running on HTTPS, the only other snag was that Django was throwing a CSRF error every time I tried to do something involving a POST request. Turns out, running a proxy server, I needed to add https://tinyblog.website/ to my trusted origins in my production settings:

CSRF_TRUSTED_ORIGINS = ['https://tinyblog.website']

And that’s it?? The site is up and running, with no real hiccups. I write posts, it saves them to the database, it serves them to the public web when asked. OK. Although my reverse proxy was getting a concerning number of sketchy requests from bots, so I installed Fail2Ban and configured it to use UFW to keep the burglars out.

For the moment, Tinyblog is very tiny: It’s a Django app with two methods and two views. Extremely basic. My idea is to add new features every so often, testing and updating as I go, keeping it live, learning some lessons, hopefully not breaking anything too catastrophically.

Next up on my to-do list: a “like” button for the posts. This may involve JavaScript. Oh, and I should probably add a static “About” page. Let’s go!

Leave a Reply

Your email address will not be published. Required fields are marked *