Nginx, Php-Fpm и что это вообще?

PHP-FPM — это разновидность SAPI для PHP. Чтобы понять, что это такое, стоит рассказать о понятии SAPI. FPM SAPI, он же Server API. В php есть несколько таких API для разных вариантов его работы: CLI SAPI — в качестве консольной команды `php` для запуска наших кронов и других cli-программ (Command […]

Enable sudo without password in Ubuntu/Debian

You probably know that in Ubuntu/Debian, you should not run as the root user, but should use the sudo command instead to run commands that require root privileges. However, it can also be inconvenient to have to enter your password every time that you use sudo. Here’s a quick fix […]

Swarm secrets made easy

A recent Docker update came with a small but important change for service secrets and configs, that enables a much easier way to manage and update them when deploying Swarm stacks. TL;DR This post describes an automated way to create and update secrets or configs, when they are managed through […]

Setup Highly Available applications with Docker Swarm and Gluster

# docker run hello-worldUnable to find image ‘hello-world:latest’ locallylatest: Pulling from library/hello-world1b930d010525: Pull completeDigest: sha256:92695bc579f31df7a63da6922075d0666e565ceccad16b59c3374d2cf4e8e50eStatus: Downloaded newer image for hello-world:latestHello from Docker!This message shows that your installation appears to be working correctly. 2. Initialize Docker swarm from the swarm-manager We’ll use the swarm-manager’s private IP as the “advertised address”. swarm-manager:~# […]

Generate /etc/hosts with Ansible

inventory file [servers] master ansible_ssh_host=172.18.23.69 node1 ansible_ssh_host=172.18.23.70 node2 ansible_ssh_host=172.18.23.71 node3 ansible_ssh_host=172.18.23.72 templates/etc/hosts.j2 {% for item in ansible_play_batch %} {{ hostvars[item].ansible_ssh_host }} {{ item }}.example.com {% endfor %} playbook task — hosts: servers gather_facts: False tasks: — name: update /etc/hosts file become: true blockinfile: dest: /etc/hosts content: «{{ lookup(‘template’, ‘templates/etc/hosts.j2’) }}» […]

Aborting ansible playbook if a host is unreachable

I was about to post a question, when I saw this one. The answer Duncan suggested does not work, atleast in my case. the host is unreachable. All my playbooks specify a max_fail_percentage of 0. But ansible will happily execute all the tasks on the hosts that it is able […]

Стиль архитектуры, управляемой событиями

Управляемая событиями архитектура включает поставщики событий, которые создают потоки событий, и потребители событий, которые прослушивают эти события. События доставляются практически мгновенно, что позволяет потребителям немедленно реагировать на происходящие события. Поставщики не связаны с потребителями — ни один поставщик не знает, кто прослушивает его события. Потребители также не зависят друг от […]

How Laravel’s SerializesModels Trait Could Save Your Bacon

When a Laravel Job is dispatched that takes an Eloquent Model as an argument in the constructor, you can use the SerializesModels trait which will only serialize the model identifier. When the job is actually handled, the queue system will automatically re-retrieve the full model instance from the database (docs). […]

Event Driven Systems

Событие-это то, на что наше приложение должно реагировать. Изменение адреса клиента, покупка или расчет счета клиента-все это события. Эти события могут исходить из внешнего мира или инициироваться внутри, например, запланированное задание, которое выполняется каждый раз. И суть здесь в том, чтобы захватить эти события и затем обработать их, чтобы вызвать […]

Data Transfer Object (DTO) in Laravel with PHP7.4 typed properties

Data Transfer Objects help in «structuring» the data coming from different types of requests ( Http request, Webhook request etc. ) into single form which we can use in various parts of our application. With DTOs, we have confidence that we will not get unexpected data in our application logic. […]