Dev Blog

After migrating the preloading of JavaScript and CSS resources from inserting preload tags to sending headers, I've encountered a critical and initially perplexing issue when users attempted to log in. Upon successful authentication, the system initiated the preloading of additional JavaScript and CSS resources, leading to a notable increase in total header size. This surge in header size eventually triggered a 502 error, indicating that the headers sent by PHP exceeded the NGINX allowed total size of headers.

Setting up Galera Cluster is somewhat tricky at first, however there are many tutorials describing the process. Minimum cluster size size is two, so we need at least two servers running MariaDB instances, configured to interchange data with each other.

Cluster Configuration

In this example configuration of two nodes, we assume that the servers are connected over private network. This allows direct connections without requiring SSH tunnels. The most important parts is to enable listening on IP protocol and to configure addresses and names of the cluster nodes. The config files are similar for each nodes. To avoid editing distribution provided configuration files, the new files are added to /etc/mysql/mariadb.conf.d directory, and on both servers are named 70-cluster.cnf. This layout is provided on Ubuntu system, different operating system or other Linux distributions might have different layout. The number 70 at the beginning ensures, that the file will be included last. In fact configuration files could be split into even more chunks, as only last three lines differ.

One of the tasks I've stumbled upon was to generate a set of Word documents based on template. The template itself was a Microsoft Word document with special tokens enclosed with curly braces. These were added just in word processor by inserting some word wrapped with said braces, for example {address}, which later were replaced with proper address en-masse from CSV data. For each row of CSV data, the tokens were replaced with corresponding value and one document was created. This article is mostly based on DOCX format, however similar technique can be used to process ODT format as well similar ones.

Normally, when you use computer, there are numerous background processes which allows you to use them as a services. That is, these processes are always ready to be used. Most obvious examples for web applications are HTTP Server, Database servers - MySQL, PostgreSQL, MongoDB, ElasticSearch or many, many other. When developing web application it is sometimes desirable to have strictly application-related service which cooperates with web application in some way. The use case I plan to describe here is a service that will react on RabbitMQ messages sent by front-end. The messages are generated by using web application and the reason for using message queue is that often these tasks require additional permissions or are time consuming. 

The messages are the kind of triggers for batch processing, which might include:

  • Generating configuration files
  • Dumping database backups
  • Getting SSL certificates