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. […]

PHP basic auth file_get_contents()

You will need to add a stream context to get the extra data in your request. Try something like the following untested code. It’s based on one of the examples on the PHP documentation for file_get_contents(): $auth = base64_encode(«username:password»); $context = stream_context_create([ «http» => [ «header» => «Authorization: Basic $auth» […]

Traefik not issuing certs in HA cluster

Traefik eventually started working on it’s own. Might have been a lingering lock that needed to expire or something. I added the following to the Traefik Consul policy key_prefix «traefik/» { policy = «write» } session «» { policy = «write» } session_prefix «» { policy = «write» } I’ll […]

Настройка Преобразования DNS с Помощью «resolv.conf» в Примерах

Файл настроек /etc/resolv.conf содержит информацию, которая позволяет компьютеру преобразовывать буквенно-цифровые доменные имена в цифровые IP адреса. При использовании DHCP, dhclient обычно перезаписывает resolv.conf информацией полученной от DHCP сервера. Как редактировать файл «/etc/resolv.conf»? Используйте текстовые редакторы, такие как vi или gedit, в Linux: # vi /etc/resolv.conf В /etc/resolv.conf настраиваются три основные […]

Микросервисная архитектура в разрезе

Использовать микросервисную архитектуру или нет? Разбираемся с плюсами и минусами, внутренней коммуникацией, принципами и заблуждениями. Виды архитектуры Простейший и популярный вариант архитектуры – монолитная. Каждый начинал с неё, и здесь нет никакой изоляции и распределённости: один монолит обрабатывает все запросы. Отчего возникают следующие проблемы: отказоустойчивость; горизонтальное масштабирование; применение одной технологии или языка […]

Composer/PSR — How to autoload functions?

After some tests, I have came to the conclusions that adding a namespace to a file that contains functions, and setting up composer to autoload this file seems to not load this function across all the files that require the autoload path. To synthesize, this will autoload your function everywhere: […]