2022年7月27日 星期三

docker xargs and command

 1 xargs

https://shengyu7697.github.io/linux-xargs/


2.kill commad

https://stackoverflow.com/questions/27757405/how-to-kill-process-inside-container-docker-top-command

https://stackoverflow.com/questions/34552232/cant-kill-processes-originating-in-a-docker-container


docker exec -it tadeu_debian ps aux | grep ping | awk '{ print $2 }' | xargs -I{} docker exec -i tadeu_debian kill -9


3. docker command

https://docs.docker.com/engine/reference/commandline/exec/

https://devconnected.com/docker-exec-command-with-examples/

COMMAND should be an executable, a chained or a quoted command will not work. Example: docker exec -ti my_container "echo a && echo b" will not work, but docker exec -ti my_container sh -c "echo a && echo b" will

2022年7月26日 星期二

docker rm all exit container

 sudo docker ps -a | grep Exit | cut -d ' ' -f 1 | xargs sudo docker rm



https://coderwall.com/p/zguz_w/docker-remove-all-exited-containers

2022年7月24日 星期日

mariadb lock

 http://blog.itpub.net/29773961/viewspace-2145185/


https://www.cnblogs.com/digdeep/p/4892953.html


https://www.twblogs.net/a/5c7faad4bd9eee35fc13486f

https://www.delftstack.com/zh-tw/howto/mysql/waiting-for-table-metadata-lock/


2022年7月21日 星期四

python webssh


# webssh office

https://pypi.org/project/webssh/

+---------+     http     +--------+    ssh    +-----------+
| browser | <==========> | webssh | <=======> | ssh server|
+---------+   websocket  +--------+    ssh    +-----------+

#  webssh and nginx

#https://www.s0nnet.com/archives/conf-webssh

#http://blog.51sec.org/2020/07/python-development-installation-on.html#point2

#https://xyz.cinc.biz/2021/05/nginx-reverse-proxy-websocket.html


# websocket

https://ithelp.ithome.com.tw/articles/10249282


# trouble

# cross domain https://github.com/huashengdun/webssh/issues/98

wssh --origin="*" --debug 

2022年7月20日 星期三

nginx ssh proxy

 主要是要會用 nginx stream module

------------------------------------------------------------

https://blog.csdn.net/carefree2005/article/details/121229818

一、stream模块简介

  stream模块一般用于TCP/UDP数据流的代理和负载均衡,通过stream模块我们可以代理转发tcp报文。ngx_stream_core_module模块从1.9.0版开始提供。默认情况下,此模块不是构建的,应该使用–with stream配置参数启用它,即我们需要使用./configure --with-stream的方式在编译的时候将stream模块添加进去。stream模块用法和http模块差不多,语法也基本相同。


二、使用场景说明

  stream主要有两个可用场景。一是实现流量的代理转发,这里所说的代理转发是只某些端口服务是有源IP地址限制的,例如mysql账户一般是限制了源地址为应用服务器,nginx可能同时是WEB应用服务器,开发人员需要验证一些数据库数据问题,但是账户源地址有限制,此时通过nginx进行数据流转发就可以实现开发终端到mysql的访问。二是实现流量的负载均衡,我们有多个tcp或者udp端口服务(比如DNS),通过stream模块我们可以实现数据流的负载均衡,支持负载均衡算法包括轮询、最小连接数、ip_hash等。

------------------------------------------------------------


# stream module install

https://alpine.pkgs.org/3.16/alpine-main-aarch64/nginx-mod-stream-1.22.0-r1.apk.html


# stream moduele

--ref: https://www.reddit.com/r/selfhosted/comments/eqvi05/reverse_proxy_ssh_connection_with_nginx/


stream { upstream ssh { server localhost:22; } server { listen 80; proxy_pass ssh; } }

----------
https://blog.csdn.net/C3399/article/details/124469967



# ssh tunnel

https://johnliu55.tw/ssh-tunnel.html

https://xenby.com/b/269-%E6%95%99%E5%AD%B8-%E9%80%8F%E9%81%8E-ssh-tunnel-%E5%B0%87%E4%BC%BA%E6%9C%8D%E5%99%A8%E5%85%A7%E9%83%A8%E6%9C%8D%E5%8B%99%E7%B6%81%E5%AE%9A%E5%88%B0%E6%9C%AC%E6%A9%9F%E9%9B%BB%E8%85%A6%E4%B8%8A


# ref
https://iter01.com/68023.html

2022年7月7日 星期四

python alchmsql

 1. learning:

https://sites.google.com/site/sqlalchemynote/home/wu-jian--guan-lian-jiao-xue


2. https://docs.sqlalchemy.org/en/14/orm/query.html


3. https://www.codegrepper.com/code-examples/assembly/sqlalchemy+datetime+range+filter

2022年7月4日 星期一

docker volume

 Good https://phoenixnap.com/kb/nfs-docker-volumes


example

sudo docker volume create --driver local --opt type=nfs --opt o=addr=172.30.1.1,rw --opt device=:/remote_nfs_dir my-docker-nfs



[andychung@TPDT-AMR-01045 system-jupyterLab]$ sudo docker volume ls

local     my-docker-nfs



# structure

https://docs.docker.com/storage/volumes/