INT 21h

Hi, I am Vladimir Smagin, SysAdmin and Kaptain. Telegram Email / GIT / Thingiverse / RSS / GPG

Virtualbox: mount physical disk

№ 11191 В разделе "Sysadmin" от January 4th, 2021,
В подшивках: ,

Add your user to disk group and relogin\reboot.

Next create volume file:

VBoxManage internalcommands createrawvmdk -filename 16Gflash.vmdk -rawdisk /dev/sdf

Add disk and mount to virtual machine

Нет комментариев »

GNUK

№ 11163 В разделах: Electronics Sysadmin от December 31st, 2020,
В подшивках: , ,

Замутил себе GNUK в качестве хранилища ключей для дешифровки писем, бэкапов и прочего хлама, а также ssh авторизации на серверах. Стоит оно всего 140 руб, что гораздо дешевле аналогов за 50 баксов 🙂 На отлично работает под линуксами с GnuPG.

https://wiki.debian.org/GNUK
https://blog.danman.eu/2-usb-crypto-token-for-use-with-gpg-and-ssh/
https://nx3d.org/gnuk-st-link-v2/

Заказал тут https://aliexpress.ru/item/32792925130.html Для прошивки нужен второй такой или любой другой прошивальщик STM32.

Нет комментариев »

Downgrade Thunderbird 78 back to 68 in Ubuntu and Manjaro

№ 11138 В разделе "Sysadmin" от December 5th, 2020,
В подшивках: ,

Ubuntu

At first, return back old software source to your repositories:

echo "deb http://security.ubuntu.com/ubuntu focal-security main"| sudo tee /etc/apt/sources.list.d/thunderbird.list
sudo apt update

Now check available versions:

$ apt-cache policy thunderbird
thunderbird:
  Installed: 1:68.10.0+build1-0ubuntu0.20.04.1
  Candidate: 1:78.5.0+build3-0ubuntu0.20.10.1
  Version table:
     1:78.5.0+build3-0ubuntu0.20.10.1 500
        500 http://ru.archive.ubuntu.com/ubuntu groovy-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu groovy-security/main amd64 Packages
     1:78.3.2+build1-0ubuntu1 500
        500 http://ru.archive.ubuntu.com/ubuntu groovy/main amd64 Packages
 *** 1:68.10.0+build1-0ubuntu0.20.04.1 500
        500 http://security.ubuntu.com/ubuntu focal-security/main amd64 Packages
        100 /var/lib/dpkg/status

You see last “1:68.10.0+build1-0ubuntu0.20.04.1”, install it and keep forever.

sudo apt-get install thunderbird=1:68.10.0+build1-0ubuntu0.20.04.1
sudo apt-mark hold thunderbird

Manjaro

Manjaro is a rolling update distro, but you can still install old software versions with some additional tricks.

sudo pacman -S downgrade 
sudo DOWNGRADE_FROM_ALA=1 downgrade thunderbird

You see last version you want 68 under number 33. Type it and Enter.

How DOWNGRADE PROFILE from 78 to 68 after accidentally run of 78

In console check version and allow downgrade:

thunderbird --version
 Thunderbird 68.10.0

thunderbird --allow-downgrade

After this you can continue use your old profile.


Finally, fuck you Mozilla.

Нет комментариев »

Laravel applications scaling inside Kubernetes

№ 11122 В разделе "Sysadmin" от November 3rd, 2020,
В подшивках: , , ,

I ran into the problem of scaling a Laravel application today. It scales well, but this is hampered by the session management plugin that stores data in files. If you do not share sessions between Pods after scaling the browser will show error 419, page expired.

First of all, I needed to create a Redis cluster that would store the sessions. You can do it however you want, I used the redis-operator which I wrote. For best results, I added balancing via haproxy and turned off persistent storage.

$ k get po -l instance=sessions-store
NAME                                       READY   STATUS    RESTARTS   AGE
sessions-store-haproxy-59b45854f4-48sfp    2/2     Running   0          5h16m
sessions-store-redis-0                     1/1     Running   0          5h16m
sessions-store-redis-1                     1/1     Running   0          5h15m
sessions-store-redis-2                     1/1     Running   0          5h15m
sessions-store-sentinel-586f47d744-4kgqx   1/1     Running   0          5h16m
sessions-store-sentinel-586f47d744-cfwng   1/1     Running   0          5h16m
sessions-store-sentinel-586f47d744-fd254   1/1     Running   0          5h16m

After that, you need to create a connection to the new Redis cluster in config/database.php.

    'redis' => [

        'client' => env('REDIS_CLIENT', 'phpredis'),
        ...
        'sessions' => [
            'host' => env('SESSION_REDIS_HOST', '127.0.0.1'),
            'password' => env('SESSION_REDIS_PASSWORD', null),
            'port' => env('SESSION_REDIS_PORT', 6379),
            'database' => 0,
        ],

    ],

Now you need to apply a patch that will allow you to take the necessary connection parameters from the ENV in config/session.php.

    'driver' => env('SESSION_DRIVER', 'file'),
    'connection' => env('SESSION_CONNECTION', null),

Don’t forget about the php library for working with Redis in Dockerfile.

RUN apt-get install php7.3-redis

Also you can add additional support to php.ini if some additional non-laravel scripts used:

RUN sed -i 's/session.save_handler = files/session.save_handler = redis/g' /etc/php/7.3/fpm/php.ini
RUN sed -i 's/;session.save_path = "\/var\/lib\/php\/sessions"/session.save_path = "tcp:\/\/sessions-store-haproxy:6379"/g' /etc/php/7.3/fpm/php.ini

Now provide all the necessary environment variables to Pod and you can start deploying.

  SESSION_DRIVER: redis
  SESSION_CONNECTION: sessions
  SESSION_REDIS_HOST: "sessions-store-haproxy"
  SESSION_REDIS_PASSWORD: ""
  SESSION_REDIS_PORT: 6379

Login to Laravel and check Redis

Nice.

Нет комментариев »

How to create docker volume from directory

№ 11114 В разделе "Sysadmin" от October 6th, 2020,
В подшивках: ,

Typically its not useful because you can directly mount directory to containers, but… who knows? May be you just want it.

For example, you have directory on your hard drive and want to move files inside docker volume:

root@boroda:/tmp/future-volume# find .
.
./somedir
./somedir/config.yaml
./file1
./test.txt
./myfile2

Just run move (or copy) command in busybox container:

docker run --rm -it \
    -v my-docker-volume:/destination \
    -v /tmp/future-volume:/source \
    busybox \
    /bin/sh -c "mv /source/* /destination/ && find /destination"

This command mounts (or create if not exists already) volume, mount directory on disk and move files from disk to volume.

After move completion you’ll see tree on moved files:

/destination
/destination/somedir
/destination/somedir/config.yaml
/destination/file1
/destination/test.txt
/destination/myfile2

That’s all, easy.

Нет комментариев »

Яндекс.Метрика

Fortune cookie: LET Jesus be YOUR anchor! So when Satan rocks your boat, THROW Jesus overboard!