Welcome!

I'm a full stack web developer and here is the place, where I collect useful information about developing cool web services and sites.

My favorite technologies are:

  • PHP: Drupal Content Management Framework, Symfony Framework.
  • JavaScript: TypeScript, Keystone Node.js framework, Strapi framework, Vue.js frontend, Quasar.
  • System administration & DevOps: Kubernetes, Docker, Debian/Ubuntu Linux, SaltStack.

More about me »

Recent posts:

Configure kind cluster with wildcard domains on Ubuntu

Installing the kind cluster with an Ingress Controller is pretty easy task for Ubuntu. But configuring opening Ingress domains by wildcard locally - already not so easy! So, let's describe the steps on how to do this! It's tested by me on Ubuntu 22.04 and 23.10, but should work well for other versions too.

Fortunately, modern Ubuntu versions use systemd-resolved for DNS resolving, that have the dnsmasq feature built-in, so you don't need to install the dnsmasq as a separate package.

Workaround to make a Drupal module compatible with D9 and D10 together

The Drupal 10 release, as described, is mostly about deprecations and removing old code. So it's pretty easy to port your modules to Drupal 10, they said!

But actually - not!

Together with deprecations, we have some libraries updated to the new major versions too, and this can bring you little unexpected surprises when you try to make your module compatible with both Drupal 9 and 10 versions together.

Tags

Launch VS Code IDE inside a Docker container

Benefits:

  • You don’t even need to install the language package (PHP, Node.js, Go, etc) and all other tools locally on your host system, you only need to have the VS Code app (or even Free/Libre Open Source VS Codium app).
  • You'll got a native app experience with local graphical interface, but all operations are performed inside the container.
  • You'll use for development the same versions of language compiler (php or other) and tools (composer, phpcs and others) as installed in th

How to create a custom Drupal Entity Type in a single PHP file

Most of instructions about creating a new custom Drupal Entity Type describes that you need to create a lot of files: routing, links, form, list builder, interfaces, etc.

But if you need to create just a simple custom Content Entity Type for your own needs and with mostly default functionality, you can simply describe it in a one PHP file, with reuse of Drupal Core classes for all other functionality (User Interface, Permissions, List Builder, etc)!

Here is the example:

Tags

Quick way to create an own patch for composer package of Drupal module and other projects

Very often we need to quickly change something in source files of composer package (for example some Drupal module), and generate a patch with those changes.

This can be done via those steps, using drupal/search_api_solr composer package as example :

Using systemd as user service manager with systemctl and journalctl in userspace

Common systemd usage is to manage global linux services, that can be created/modified only with root/sudo credentials.

But systemd have the great user mode, that allow to create and control any services without sudo permissions, that runs as user owner, we simply need to add the `--user` argument.

For allow to start user services on system boot, you must one-time launch the command for needed user: sudo loginctl enable-linger LOGIN

Tags

Delete all available tables on PostgreSQL database without schema permissions

DO $$ DECLARE
    r RECORD;
BEGIN
    FOR r IN (SELECT tablename FROM pg_tables WHERE schemaname = current_schema()) LOOP
        EXECUTE 'DROP TABLE IF EXISTS ' || quote_ident(r.tablename) || ' CASCADE';
    END LOOP;
END $$;

This query will delete all available tables for current user and schema, without needs to have SCHEMA privileges.

The most popular solution via:

DROP SCHEMA public CASCADE;
CREATE SCHEMA public;

Often shows the error, because of missing owner permissions or other restrictions:

Tags

How to eval PHP code via drush without escaping quotes routine

Very often there is a need to execute via drush eval command the PHP code with both single and double quotes, something like this:

<?php
echo "Hello, '$username'!"; 
?>

This can be quickly done without manually adding slashes to each quote in PHP code via this bash trick:

PHP=`cat <<'EOF'
echo "Hello, '$username'!"; 
EOF`; drush ev "$PHP"

Instead of single line of PHP code, you can insert long multi-line part of code, without carrying about escaping quotes.

Tags

Quick way to install SaltStack minion on Debian / Ubuntu Linux

Here is bash commands to quickly install salt-minion to Ubuntu / Debian systems:

MASTER=salt.SERVER.COM
BRAND=PROJECTNAME
HOSTNAME=hostname.SERVER.COM

hostnamectl set-hostname $HOSTNAME

cd /tmp && wget -O - https://bootstrap.saltproject.io | bash && rm ./bootstrap-salt.log

echo "master: $MASTER
" > /etc/salt/minion.d/$BRAND.conf

echo "$HOSTNAME" > /etc/salt/minion_id

service salt-minion restart