In this series, we will create a basic static HTTP 1.0 server with Rust. At the end of Part 1 of this tutorial, our server will do the following:
- Listen for and handle TCP connections on a specific port
- Accept HTTP 1.0 GET requests
- Parse and validate requests for further use
- Log incoming requests
We will avoid using libraries that make this trivial (i.e. the
Continue reading Creating a Static HTTP Server with Rust – Part 1
http crate) and focus on the fundamentals of how a server works. Let’s get started.
Docker Compose facilitates the deployment of Dockerized applications. A series of Docker commands and arguments to start your application become a single command;
Continue reading Docker Compose in Production
docker-compose up. Such an invaluable tool makes deploying in both development and production environments a breeze. However, applications are generally run and configured much differently in production than in development. In this post, we will explore ways to separate your development and production configurations while keeping things DRY and maintaining the simplicity of Docker Compose commands.
When inserting a large number of objects into the database with Django, your first thought should be to use
Continue reading Avoid Memory Issues with Django’s bulk_create
bulk_create. It is much more efficient than calling
create for each object, and it generally only results in a single query. However, when dealing with tens of thousands, hundreds of thousands, or even more objects, you may run into out of memory errors.
Writing unit tests is not just a formality. Unit tests are as important to an application as the code that runs it. Without them, code is fragile. A twentieth parameter is added to a common function, with yet another conditional added to the end, as backwards compatibility must be maintained and regressions must be avoided. The same bug is fixed for the fifth time this month. The codebase devolves into a house of cards, where even senior developers can’t make significant changes with confidence. To avoid this dystopian future, start writing unit tests for your code with diligence. In this post, we will outline a basic set of guidelines for writing them that will allow you to improve the stability, reliability, and maintainability of your application.
Continue reading Write Better Unit Tests
Views are probably the most essential part of a Django application. They provide an interface to your application for users or other external applications. It only makes sense that these need to be well-tested. At first, it can seem difficult and/or tedious to write unit tests for them. However, by decoupling your business logic from your views, testing business logic and view logic separately, and tracking code coverage, you can be confident in the reliability and accuracy of your application’s views.
Continue reading Tips for Testing Django Views
This past week, I started learning Rust. While I have enjoyed learning about Rust’s clever approach to system programming, I have to say that I found its dependency management a bit confusing at first. Today, I will share my new understanding of this with you, whether you are a new, experienced, or aspiring Rustacean.
Continue reading Rust Dependency Management with Cargo
Versioning your Docker images is a good practice that will make them easier to deal with, whether they are used only privately or are offered to the public. With each iteration of an image, regression is always a possibility. To prevent the disruption of services for yourself and others, it is always a good idea to maintain a stable versioning system. By using semantic versioning, we are able to categorize our iterations clearly and allow the subscriber to choose which they want.
Continue reading Automate Docker Image Versioning with Jenkins
Dockerizing your application makes things like development, deployment, distribution, and continuous integration much simpler. Today, we will look at how to run your Node.js application in a Docker container, using Docker Compose to further facilitate the process. See last week’s post, How to Dockerize Django and Postgres, if you are interested in doing the same for your Django application.
Continue reading How to Dockerize Node.js
Docker is an invaluable tool that makes things like setting up your local development environment, continuous integration, and deployment a breeze. Docker is good to set up early on for any application, but it is never too late. With the help of Docker Compose, we are going to set up a Django application to install and deploy itself on any machine with only one command.
Continue reading How to Dockerize Django and Postgres