What Happened?

In the past, when I was a desktop PC user, I used to record songs I played with some instruments by using a computer at home. Though I usually prefer decent sound cards, even any on-board audio interfaces were efficient enough.

However, after I switched to the laptop, as the USB audio interfaces were not efficient enough and budget point of view the devices that work on faster ports were not so accessible to me, my options ran lower.

Anyway, after tested several USB audio interfaces and struggled enough with latency, I understood that the laptop is not suitable environment…

Because libraries solve some problems in a specific area and allow making something easier, we use tons of libraries/frameworks and internal project components written by us… in order to make an application easier. However, this situation brings other complexities that we need to take care of, like relations between the components. In this article, I would like to mention how to use the technique as known as Dependency Injection in a TypeScript project.

What Is Dependency Injection?

As you know, Github allows us to execute continuous integration pipelines through Actions easily. Today, we are going to see how to deploy your code directly from Github to your server by using Ansible, Docker, and Github Actions.

What Is Challenge Here?

Ansible is an IT automation tool that communicates to servers via SSH protocol without using any agent mechanism. It allows you to execute commands on remote servers or transferring files to servers from the system where you run the Ansible playbook. So the key problem is being able to access the remote servers from a public system like Github.

How To Solve?

We can execute…

In a development environment, one of the biggest problems is finding the occurred problem between the services and it needs that you need to check too many log files in order to find the root cause. You may need to check the web, application, database, cache… etc. server logs even in a simple monolith application.

Today, we’ll see how to aggregate the application logs in one single place that we can follow easily through Docker Compose, Graylog, and Elasticsearch.

Dockerizing The Application

As a sample application, I’ve chosen Symfony Demo project written in PHP. It requires PHP, Nginx and MYSQL instances to work…

You may have an application that depends on one or more services that start slowly. So, you must put some extra controls before starting the application, in order to prevent startup errors and run the application smoothly.

Let’s take the following example:

We have an application that directly dependent on RabbitMQ and MySQL services and it connects to both services in application startup. However, the worker container constantly fails because it starts before the other services.

Let’s start first by defining the dependencies between the services in the docker-compose.yaml to start the worker container after RabbitMQ and MySQL containers.

Sometimes, a message consumer might be failed because of connection issues or other logical reasons. In this case, the application should handle the fail scenario properly and retry the failed message several times based on some rules.

Today, we are gonna see how to retry a failed message in a Symfony application through Messenger Component by referencing the previous post:


How To Retry

Messenger Component, retries a failed message through the dead letter feature of RabbitMQ in case of RabbitMQ usage. It tries by default 3 times, with 1000 ms delay, and multiplies the duration by 2 in each try.

Most of the API’s requires some authentication mechanisms in order to identify the user and allows to access some resources based on the authorization rules. Although the way of the identity declaration changes, most of the authentication mechanisms requires to perform a request to an authentication endpoint in order to obtain an identifier before going to the actual resource. However, you can’t use that identifier forever.

If you take all this information into consideration, to make even a simple API call requires the following flow:

As you know, message-based asynchronous flows are a significant part of the web applications that allow scaling backend processes. You can move all the long time processes to asynchronous flow and make your user interface faster as much as you could.

Today, we’re gonna see how to use RabbitMQ with Symfony through Messenger component with a simple use case.
I strongly recommend to check out the following document in order to understand the message bus concept and the fundamentals of each component in Messenger:

The business needs changes and sometimes even you might not reach the people’s speed. No matter how reusable code that you’ve written; all your changes may become garbage in a few days with new business needs. Until MariaBundle.

The Bundle mechanism is a way to make reusable software packages for the PHP applications that use Symfony. It’s probable that a bundle can have own dependencies and needs to be tracking under separate version control. Although Symfony bundles are independent packages, you might still need some application dependencies during the development period in order to check the integrity or simply run the code, besides the tests. So, in this article, I’m gonna try to explain step by step, how to prepare an efficient development environment in order to develop a Symfony bundle.

1. Prepare A Docker Image

Docker is the tool that gonna help…

İbrahim Gündüz

Software Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store