Skip to content

Instantly share code, notes, and snippets.

View phpclub's full-sized avatar

Alexandr Smirnov phpclub

View GitHub Profile

Create a highly available k3s cluster with external datastore

Prereqs

For this particular setup we will need 3 machines to act as kubernetes (k3s) masters and one machine to act as a datastore

The datastore will be a mysql (mariadb) server although you can choose different options

The operating system chosen for this task is Debian 11 (theoretically the setup can be performed on any linux machine)

@phpclub
phpclub / k3s-etcd-commands.md
Created July 12, 2025 19:18 — forked from superseb/k3s-etcd-commands.md
k3s etcd commands

k3s etcd commands

etcd

Setup etcdctl using the instructions at https://github.com/etcd-io/etcd/releases/tag/v3.4.13 (changed path to /usr/local/bin):

Note: if you want to match th etcdctl binaries with the embedded k3s etcd version, please run the curl command for getting the version first and adjust ETCD_VER below accordingly:

curl -L --cacert /var/lib/rancher/k3s/server/tls/etcd/server-ca.crt --cert /var/lib/rancher/k3s/server/tls/etcd/server-client.crt --key /var/lib/rancher/k3s/server/tls/etcd/server-client.key https://127.0.0.1:2379/version
@phpclub
phpclub / angie.md
Created July 2, 2025 06:41 — forked from llcawc/angie.md
Настройка сервера Angie для Ubuntu или Debian

Настройка сервера Angie

Angie (Энджи) — эффективный, мощный и масштабируемый веб-сервер, реализованный как форк nginx:

  • Создан бывшими разработчиками исходного проекта, чтобы двигаться в новом направлении, и может служить заменой предшественнику без переработки конфигурации и модулей.
  • Включает все возможности nginx 1.27.4 и добавляет к ним целый ряд новых функций.

Установка Angie на сервер Ubuntu или Debian

На основе официальной документации: https://angie.software/angie/docs/installation/

@phpclub
phpclub / dnf_copy
Created April 3, 2025 18:21
How to replicate installed package selection from one Almalinux instance to another?
the Dnf repoquery subcommand supports has a new option for listing all user-installed packages:
$ dnf repoquery --qf '%{name}' --userinstalled \
| grep -v -- '-debuginfo$' \
| grep -v '^\(kernel-modules\|kernel\|kernel-core\|kernel-devel\)$' > pkgs_a.lst
In contrast to other methods, it also lists all debuginfo packages. The additional grep in the above example filters them out.
To install the list on host B:
$ < pkgs_a.lst xargs dnf -y install
<?php
define('_JEXEC', 1);
// Connect with Joomla
define('JPATH_BASE', __DIR__);
require_once JPATH_BASE . '/includes/defines.php';
require_once JPATH_BASE . '/includes/framework.php';
// Database connection
$db = JFactory::getDBO();
# Add Repository to your system (ondrej/php PPA)
sudo apt install apt-transport-https lsb-release ca-certificates
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
sudo sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
sudo apt update
# Install PHP 7.1
sudo apt install php7.1
@phpclub
phpclub / phpstan-install.sh
Created June 14, 2024 03:33 — forked from fedir/phpstan-install.sh
phpstan install globally as phar
wget -O phpstan.phar https://github.com/phpstan/phpstan/raw/HEAD/phpstan.phar
chmod a+x phpstan.phar
sudo mv phpstan.phar /usr/local/bin/phpstan
phpstan
@phpclub
phpclub / setup_russiantrustedca.md
Created May 28, 2024 07:07 — forked from jidckii/setup_russiantrustedca.md
Установка сертификатов НУЦ Минцифры в Alpine Linux

Установка сертификатов НУЦ Минцифры в Alpine Linux

Проверяем:

curl -vvv -XGET -I https://www.sberbank.ru/ru/certificates

Устанавливаем:

@phpclub
phpclub / README.md
Last active May 21, 2024 14:24 — forked from lcrilly/README.md
Prometheus exporter for NGINX Unit metrics

Prometheus exporter for NGINX Unit metrics

The NGINX Unit control API includes a /status endpoint for usage statistics. This is a solution for exposing these metrics in Prometheus format.

The application (run by Unit) queries the /status URI on the control socket and converts the JSON response into Prometheus text format. PHP and Python implementations are available.

These instructions assume an existing Unit installation with a working configuration. We will add a new listener on the default prometheus port (9090) and route it directly to the Prometheus app.

Step 0. Install the preferred Unit language module (unit-php or unit-python)

apiVersion: v1
kind: ServiceAccount
metadata:
name: admin-user
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: admin-user