2022年8月31日 星期三

certificate use text with multi-domain

 https://www.ibm.com/docs/en/ztpf/1.1.0.15?topic=gssccr-configuration-file-generating-self-signed-certificates-certificate-requests


https://infra.engineer/windows/12-use-openssl-to-generate-a-multi-domain-ucc-certificate


https://serverfault.com/questions/694105/how-to-generate-a-multi-domain-and-or-wildcard-openssl-certificate


https://thesecmaster.com/how-to-generate-a-csr-for-multi-domain-ssl-certificates-using-openssl/


https://support.qacafe.com/knowledge-base/how-do-i-display-the-contents-of-a-ssl-certificate/

2022年8月23日 星期二

alpine nginx logrote with supervisord

ls -alh /var/lib/logrotate.status

   8 cat /var/lib/logrotate.status

   9 history

  10 logrotate -v /etc/logrotate.d/nginx

  11 history

  12 logrotate -vdf /etc/logrotate.conf

  13 ls -al /var/log/nginx/

  14 logrotate -vdf /etc/logrotate.conf


https://blog.toright.com/posts/4622/nginx-log-%E4%BB%A5%E6%97%A5%E6%9C%9F%E6%AD%B8%E6%AA%94.html

https://jiaming0708.github.io/2021/01/26/logrotate-nginx/

 


log does not need rotating (log has already been rotated)

###########################

# good at logrotate

###########################

https://www.baeldung.com/linux/rotating-logs-logrotate

https://www.onitroad.com/jc/linux/how-to-install-and-configure-log-roate-in-alpine-linux.html

https://weinan.io/2019/04/06/cron.html


##############

# crond

###############

https://asaba.sakuragawa.moe/2018/10/%E5%9C%A8-alpine-linux-%E5%AE%B9%E5%99%A8%E4%B8%AD%E4%BD%BF%E7%94%A8-crontab/

https://askubuntu.com/questions/907388/start-cron-service-with-supervisor


###############################

 supervisdrd

###################################

https://stackoverflow.com/questions/49090469/docker-alpine-linux-running-2-programs

https://www.huweihuang.com/article/linux/supervisor-usage/


1. Dockerfile is:

FROM alpine:latest
RUN apk update && apk add --no-cache supervisor openssh nginx
COPY supervisord.conf /etc/supervisord.conf
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisord.conf"]

2. supervisord.conf is:


[supervisord]

nodaemon=true


[program:crond]

command=/usr/sbin/crond -f


[program:nginx]

command=nginx -g 'daemon off;'




##

var/www # crond --help

BusyBox v1.28.4 (2018-07-17 15:21:40 UTC) multi-call binary.


Usage: crond -fbS -l N -d N -L LOGFILE -c DIR


    -f  Foreground

    -b  Background (default)

    -S  Log to syslog (default)

    -l N    Set log level. Most verbose:0, default:8

    -d N    Set log level, log to stderr

    -L FILE Log to FILE

    -c DIR  Cron dir. Default:/var/spool/cron/cro



#######################

 for reference

#####################

https://stackoverflow.com/questions/43792897/supervisorctl-3-3-1-not-working-complaining-about-not-finding-conf-file

https://askubuntu.com/questions/911940/error-ini-file-does-not-include-supervisorctl-section


2022年8月17日 星期三

Open switch

 https://www.openvswitch.org/


https://www.dell.com/zh-tw/shop/productdetailstxn/networking-s-series-25-100gbe


install:

https://sites.google.com/a/cnsrl.cycu.edu.tw/da-shu-bi-ji/sdn/floodlight


https://github.com/YanHaoChen/Learning-SDN/blob/master/Switch/OpenvSwitch/Walkthrough/README.md


https://readthedocs.org/projects/python-ovs-vsctl/downloads/pdf/latest/


https://github.com/openvswitch/ovs

https://www.796t.com/content/1530269779.html

Book:

https://www.tenlong.com.tw/products/9787121413605?list_name=srh

https://www.tenlong.com.tw/products/9787121367861?list_name=sp

https://www.tenlong.com.tw/products/9787121310423?list_name=srh

2022年8月10日 星期三

Linux ssh key script

 #https://blog.gtwang.org/linux/linux-ssh-public-key-authentication/

cd ~

mkdir -p .ssh

chmod 700 ~/.ssh

ssh-keygen

ssh-copy-id andychung@TPDT-AMR-01045


2022年8月7日 星期日

Install the time chrony

 https://shazi.info/chrony-%E7%B3%BB%E7%B5%B1%E6%A0%A1%E6%99%82%E5%B7%A5%E5%85%B7%EF%BC%8C%E6%8A%8A%E9%81%8E%E6%99%82%E7%9A%84-ntpdate-%E4%B8%9F%E6%8E%89%E5%90%A7/


 yum install chrony -y

 service chronyd start

chkconfig chronyd on

 vim /etc/chrony.conf

service chronyd restart



https://xyz.cinc.biz/2016/09/centos-7-chrony.html


https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/ch-configuring_ntp_using_the_chrony_suite#sect-differences_between_ntpd_and_chronyd

2022年8月5日 星期五

Nginx 504 time out gateway


ref: https://www.cnblogs.com/lemon-flm/p/8352194.html

 nginx比较强大,可以针对单个域名请求做出单个连接超时的配置. 

比如些动态解释和静态解释可以根据业务的需求配置

proxy_connect_timeout :后端服务器连接的超时时间_发起握手等候响应超时时间

proxy_read_timeout:连接成功后_等候后端服务器响应时间_其实已经进入后端的排队之中等候处理(也可以说是后端服务器处理请求的时间)

proxy_send_timeout :后端服务器数据回传时间_就是在规定时间之内后端服务器必须传完所有的数据

nginx使用proxy模块时,默认的读取超时时间是60s。



https://tecadmin.net/increase-request-timeout-in-nginx/

Docker container crond and alpine

 ###########################

# test crond

# https://www.linuxfixes.com/2022/01/solved-docker-cron-scheduled-job-not.html

# https://www.onitroad.com/jc/linux/how-to-install-and-configure-log-roate-in-alpine-linux.html

# https://weinan.io/2019/04/06/cron.html

# https://unix.stackexchange.com/questions/375577/why-is-crond-failing-to-run-a-non-root-crontab-on-alpine-linux

#

#############################


apk list -I | grep 'log'

mkdir /etc/periodic/1min

echo "*/1     *       *       *       *       run-parts /etc/periodic/1min" >> /etc/crontabs/root


tee /etc/periodic/1min/foo <<EOF

#!/bin/sh

echo "Hello, world"

date >> /tmp/foo_crond

EOF

crond -f -l 8



# Your can run in out side to start cornd 


docker exec -d share_nginx crond -f -l 8

2022年8月3日 星期三

Cenot7 systemd command

https://www.3chy2.com.tw/3c%E8%B3%87%E8%A8%8A/linux-systemd-%E8%A9%B3%E7%B4%B0%E4%BB%8B%E7%B4%B9-unit%E3%80%81unit-file%E3%80%81systemctl%E3%80%81target/


Linux Systemd 詳細介紹: Unit、Unit File、Systemctl、Target

Systemd

簡介

CentOS 7 使用 Systemd 替換了SysV

Ubuntu 從 15.04 開始使用 Systemd

Systemd 是 Linux 系統工具,用來啟動守護進程,已成為大多數發行版的標準配置.....


.....



 

ref:

https://codingbee.net/rhcsa/rhcsa-the-target-unit

https://www.tecmint.com/list-all-running-services-under-systemd-in-linux/




nfs: https://codingbee.net/rhcsa/nfs-how-to-set-up-an-nfs-client-on-centos-7


https://www.systutorials.com/docs/linux/man/7-nfs.systemd/

https://fossies.org/linux/nfs-utils/systemd/var-lib-nfs-rpc_pipefs.mount


sourcecode

https://fossies.org/linux/nfs-utils/systemd/var-lib-nfs-rpc_pipefs.mount


2022年8月2日 星期二

C3 example

 1. D3 format

https://observablehq.com/@d3/d3-format

https://stackoverflow.com/questions/38639357/c3-js-timeseries-graph-with-percentage-y-axis

https://c3js.org/gettingstarted.html


1-5 c3:

https://hackmd.io/UEzl5wVER7-jVRZj7jqYpQ

https://hackmd.io/@ericacadu/H1k5d1Xew


2,  c3. example

https://a498390344.medium.com/d3-js-c3-js%E5%AD%B8%E7%BF%92%E7%AD%86%E8%A8%98-56ca4e2c88

https://hsuchihting.github.io/javascript/20200715/3292510004/


var chart = c3.generate({
bindto: "#chart",
data: {
columns: [
["data1", 30, 200, 100, 400, 150, 250],
["data2", 50, 20, 10, 40, 15, 25]
],
//新增 data2 的數據在右邊
axes: {
data2: "y2"
},
//自訂圖表類型
types: {
data1: "line", //指定 data1 的圖表類型
data2: "bar" // 指定 data2 的圖表類型
},
//自訂 data 顏色
colors: {
data1: "#03A9F4",
data2: "#76FF03"
}
},
legend: {
show: true //是否顯示項目
},
//客製左邊數據
axis: {
//客製 X 軸內容
x: {
type: "category",
categories: [2000, 2001, 2002, 2003, 2004, 2005],
label: {
text: "X軸名稱"
}
},
//客製 Y 軸內容
y: {
ticket:{
format: d3.format('s')
}
},
//客製右側 (data2) Y2 軸內容
y2: {
show: true,
label: {
text: "右邊Y軸名稱",
position: "outer-middle" //名稱位置
}
}
}
});


3. flask

https://stackoverflow.com/questions/51669102/how-to-pass-data-to-html-page-using-flask

https://flask.palletsprojects.com/en/0.12.x/tutorial/templates/

https://yanwei-liu.medium.com/python%E7%B6%B2%E9%A0%81%E8%A8%AD%E8%A8%88-flask%E4%BD%BF%E7%94%A8%E7%AD%86%E8%A8%98-%E4%BA%8C-89549f4986de

https://devs.tw/post/448