Skip to content

Instantly share code, notes, and snippets.

View sashaaro's full-sized avatar

Aleksandr sashaaro

View GitHub Profile
@sashaaro
sashaaro / Receipt dns
Last active November 29, 2018 19:49
Access to docker containers via coredns and coredns-dockerdiscovery plugin for development env
Install coredns
Build images with coredns & dockerdiscovery plugin
One way
git clone git@github.com:kevinjqiu/coredns-dockerdiscovery.git или go get github.com:kevinjqiu/coredns-dockerdiscovery.git
cd coredns-dockerdiscovery или cd ~/go/src/kevinjqiu/coredns-dockerdiscovery.git
docker build -t coredns-dockerdiscovery .
@sashaaro
sashaaro / docker-compose.tunnel.yml
Last active January 25, 2021 13:52
simple tunnel example
# public server compose for foobar.com
services:
nginx:
image: library/nginx:1.19.6
network_mode: host
volumes:
- ./conf.d:/etc/nginx/conf.d
- /etc/letsencrypt:/etc/letsencrypt
@sashaaro
sashaaro / grep kill
Created October 27, 2019 11:45
kill process with grep
kill -9 $(ps -ax | grep "go run" | awk '/^ ([0-9])/{print $1}')
# wrap process and wait while required user would be created (for daemon ex. php-fpm) and others external init scripts would produced
# using USER=www-data wait-init.sh php-fpm
# test
# docker run --name=wait-init-test --rm -v $PWD/wait-init.sh:/wait-init.sh -e USER=www-data alpine sh wait-init.sh su -c "echo \"Dummy daemon started under \$(whoami)\"" www-data
# create user in container with some dockerhost id
# docker exec wait-init-test adduser -D --uid ${UID} www-data
# daemon required username
if [[ -z "${USER}" ]]; then
@sashaaro
sashaaro / build-local-image.sh
Last active April 18, 2020 10:32
recompile origin image with your user
originalImage=$1
if [ -z $2 ]; then
newImage=$originalImage
else
newImage=$2;
fi;
if [ $newImage == $originalImage ]; then
echo -e "\033[0;31mOriginal image $originalImage recompile...\033[0m"
fi;
@sashaaro
sashaaro / CombineQueuesConsumeCommand.php
Last active May 20, 2023 10:10
Combine consume all queue by one command with symfony 4.4 and OldSoundRabbitMqBundle for efficiently using memory in test environment
<?php
declare(strict_types=1);
namespace App\Command;
use Monolog\Handler\StreamHandler;
use Monolog\Logger;
use OldSound\RabbitMqBundle\RabbitMq\BaseAmqp;
use OldSound\RabbitMqBundle\RabbitMq\Consumer;
use PhpAmqpLib\Connection\AbstractConnection;
docker run --name redis -it --rm redis bash -c "redis-server>/dev/null & redis-cli"
@sashaaro
sashaaro / README.md
Last active December 5, 2020 18:23
k8s vagrant nodes for kubespray
@sashaaro
sashaaro / complie-erb.sh
Created December 7, 2020 21:53
compile erb template with docker
#/bin/sh
docker run -v ${PWD}:/workdir -w /workdir ruby erb $1 > $2
@sashaaro
sashaaro / go.mod
Last active December 23, 2020 17:57
for i in {1..200}; do nice -n 19 bin/console rabbitmq:consumer upload_picture & done