In this series, we are creating a basic static HTTP 1.0 server with Rust. If you haven’t seen Part 1 yet, go do that first. At the end of Part 2, our server will do the following:
Continue reading Creating a Static HTTP Server with Rust – Part 2
- Read and serve files from a predefined directory on the host server
- Generate appropriate HTTP responses to incoming requests
- Log information about the response to standard output
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