[Faile!!]Docker, cron, mail and logs

F……………………………………………………………………………….. https://www.preining.info/blog/2018/05/docker-cron-mail-and-logs/ from debian:stretch-slim RUN apt-get -y update RUN apt-get install -y cron #ssmtp ADD . /app ADD crontab /etc/cron.d/mypackage RUN chmod 0644 /etc/cron.d/mypackage #ADD ssmtp.conf /etc/ssmtp/ssmtp.conf #RUN chown root.mail /etc/ssmtp/ssmtp.conf #RUN chmod 0640 /etc/ssmtp/ssmtp.conf CMD cron -f ===== docker-compose.yml version: '3.3' services: gethpeers: build: context: gethpeers/ volumes: - cronlog:/app/cronapplog:rw networks: - fastdev fakelog: build: context: fakelog/ volumes: - cronlog:/app/cronapplog:rw - filebeat:/usr/share/filebeat/data:rw networks: - fastdev volumes: cronlog: filebeat: networks: fastdev: driver: bridge gethpeers Dockerfile from debian:stretch-slim RUN apt-get -y update RUN apt-get install -y cron #ssmtp ADD . /app ADD crontab /etc/cron.d/mypackage RUN chmod 0644 /etc/cron.d/mypackage #ADD ssmtp.conf /etc/ssmtp/ssmtp.conf #RUN chown root.mail /etc/ssmtp/ssmtp.conf #RUN chmod 0640 /etc/ssmtp/ssmtp.conf CMD cron -f gethpeers crontab * * * * * root /app/run-cronjob /app/start.sh gethpeers run-cronjob #!/bin/bash if [ -z "$1" ] ; then echo "need name of cron job as first argument" >&2 exit 1 fi if [ ! -x "$1" ] ; then echo "cron job file $1 not executable, exiting" >&2 exit 1 fi if "$1" then exit 0 else echo "cron job $1 failed!" 2>/proc/1/fd/2 >&2 exit 1 fi gethpeers start.sh #!/bin/bash IP_PORT=xxx.xxx.xxx.xxx:8545 ETH_METHOD=admin_peers PEERS=$(curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"'$ETH_METHOD'","params":[],"id":1}' $IP_PORT | jq '.result[].network + {"project":"cronapp"}') printf "\n===== Now Geth Peers =====\n" printf "Peers: %s\n" $PEERS echo $PEERS >> /app/cronapplog/gethpeers.log fakelog Dockerfile FROM docker.elastic.co/beats/filebeat:6.5.4 COPY filebeat.yml /usr/share/filebeat/filebeat.yml USER root RUN chown root:filebeat /usr/share/filebeat/filebeat.yml USER filebeat fakelog filebeat.yml filebeat.prospectors: - type: log paths: - /app/cronapplog/gethpeers.log exclude_files: ['.gz$'] fields: srcname: "geth" srctype: "cron" filebeatserverip: "xxx.xxx.xxx.xxx" fields_under_root: true symlinks: true output.logstash: hosts: ["logstash:5044"]

2019-02-22 · 2 min · 252 words · Me

OpenFaas

https://github.com/openfaas/faas

2019-02-21 · 1 min · word · Me

k8s kubernetes Lesson 4 RKE

Use RKE only one YAML config https://itnext.io/setup-a-basic-kubernetes-cluster-with-ease-using-rke-a5f3cc44f26f

2019-02-20 · 1 min · 7 words · Me

[轉]"migrating" to Kubernetes from docker-compose in homelab

https://www.reddit.com/r/docker/comments/9j2vc7/migrating_to_kubernetes_from_dockercompose_in/ If / when you’re able to spawn arbitrary VMs, you can look at kubeadm, CoreOS, RKE (my current choice), and so on for cluster creation. Before you can use kompose, or use kubectl apply -f myawesome.yaml, you first and foremost need to set up a Kubernetes cluster. This might be the most challenging thing to do because Kubernetes is heavy-weight compared to docker-compose. I recommend using RKE to set it up. Also, run away if anyone mentions Kubespray. ...

2019-02-20 · 1 min · 82 words · Me

YAML multi-line string

https://rancher.com/docs/rke/v0.1.x/en/config-options/add-ons/user-defined-add-ons/ To define an add-on directly in the YAML file, make sure to use the YAML’s block indicator |- as the addons directive is a multi-line string option. It’s possible to specify multiple YAML resource definitions by separating them using the -– directive.

2019-02-20 · 1 min · 43 words · Me

[轉]Headless CMS: REST vs JSON:API vs GraphQL

https://dri.es/headless-cms-rest-vs-jsonapi-vs-graphql?fbclid=IwAR3PJouIotZns9DnthDvr4cA-vtWiFq60opwL-dCuAjLElaflI-qj4Uw5KY#operational-efficiency

2019-02-16 · 1 min · word · Me

嘉能 免手洗單槽洗淨過濾魔術平板拖把

爛! 不合用! https://media.etmall.com.tw/XML/Scrshot/20190214/150926299_2190891.jpg 爛在那: 1. 拖把只能單邊收折,意謂只能單邊進入洗桶 2. 承1. 洗桶高度非常剛好是拖版的高度,那就代表一邊進去後,另一邊的最後面是洗不到的!!……整個無言了 3. 承2. 洗桶和拖版高度一致,導致…拖把不能弄略乾,水肯定要裝蠻高的,不然洗個屁,洗完慢慢拉出來,按照水的高度,不就只有一小段是能略乾,其他段都是溼 4. 裝水時根本不知道水裝了多少?? 5. 另外拖把必須要特殊使用方式,不然地上會一痕一痕,還有拖完地板很溼! 基本上比最近市面上很紅的腳踏式拖把還差!比同類型雙桶(一洗一乾)還差!比跪在地上用手擦地還浪費時間! 能想像 拖把只能洗一半的情況嗎??!!

2019-02-16 · 1 min · 19 words · Me

[轉]Benchmark results of Kubernetes network plugins (CNI) over 10Gbit/s network

https://itnext.io/benchmark-results-of-kubernetes-network-plugins-cni-over-10gbit-s-network-36475925a560

2019-02-12 · 1 min · word · Me

ethereum-etl to csv to filebeat to kafka to mysql

filbeat to kafka https://www.elastic.co/guide/en/beats/filebeat/current/kafka-output.html sink-connector to mysql https://docs.confluent.io/current/connect/kafka-connect-jdbc/sink-connector/index.html

2019-02-12 · 1 min · 8 words · Me

[轉]做吃的

https://www.mobile01.com/topicdetail.php?f=747&t=5710232 我曾經是個牛肉麵 “第三代小老闆”(跑堂小弟) 自我國小5年級起!!! 從一碗小碗牛肉麵30元新台幣賣到2014年10月為止! 那年…牛肉麵一碗小碗漲賣130元 大碗賣到150元! 店租從早年每月5000元! 到最後紡寮夜市場被拆(租金當時15000元) 足足超過30年… 後來去景平路租6坪大小店面租金要8萬!!! 隨後放棄再賣牛肉麵!!! 其實! 我看到本版太多人想賣吃的賺錢!!! 但是… 麻煩一下!!! 看清楚現實!!! 俗話說…“秀才造反!三年不晚!!!” 你們想做吃的賺錢!!! 我是不反對!!! 但是有打算虧三年的心理準備嗎? 沒特色地小吃.餐廳或是飲料店! 基本上離倒店不遠!!! 坦白說…我家賣牛肉麵關門兩次… 一次是我家老闆娘生病…那次關了整整8年! 另一次是我那個無緣地越南前妻鬧政變! 那一次搞到至今無法再開店! 因為…無人可幫!!! 說沒人幫忙!太沉重… 應該說…不想把秘密流出去! PS.別問我是否開班授徒! 答案是 NO 回頭把真實狀況想出來吧!!! 作吃地生意! 有三大影響收入問題 第一…進貨成本. 第二…開銷成本. 第三…人事成本. 這三個不解決!很難賺大錢 以牛肉麵而言… 進貨成本! 我從一箱牛肉(澳洲)2400元60磅 買到一箱牛肉(USA)6400元60磅 而每天購買小白菜從最低3元一斤到50元一斤(颱風天) 青蔥從20元一把到每把300元(颱風天) 大蒜一斤20元到一斤80元 老薑一箱30斤600元到2500元 ……(還有許多) 其實沒去菜市場當"三寶"(台語.台北果菜批發市場對收尾大戶尊稱) 你永遠不知道怎樣省錢! 當時…我每天購買 2030斤菜. 每天5把三星蔥一把蒜葉 每一星期進蒜頭20斤 每2030天進老薑一箱 每兩個月進一箱辣椒粉與10斤花椒. …..還有很多很多… 包括香料.醬油.糖.鹽.糯米醋.香醋.菜油…等. 每天口袋鈔票有萬元以上是要付出去! 所以!每天要有最低收入…否則開"天窗" 開銷成本. 房租!電費!瓦斯!水費!垃圾袋!(其他雜項開支) 其實這項最恐怖! 每當這項在每天收攤回家算錢作帳時! 總會發現少了點錢! 最恐怖的是…花在哪裡不知道!!! 明明辛苦賺上萬元! 怎口袋剩下4000多…要死了!!! 比較常見有…鈔票換銅板.1元.5元.10元.50元 碗盤.玻璃櫃破損. 修理冰箱.冷氣!運菜車… 人事成本 作吃的生意!!! 如果不是夫妻.兄弟.姊妹…下去做! 而且齊心齊力做! 根本無法賺錢(算薪水更恐怖.到底誰多誰少?) 因為外聘費用問題! 我從一位歐巴桑雇用3000元到最後12000元 只有洗菜.切菜.切酸菜.切豆干以及洗碗. 從早上10點坐到下午2點 另外一位是下午5點到晚上8點! 後來發現下午那一位偷錢所以開除! 以後來的都嫌髒.嫌油膩.端麵慢.收桌慢… 改為自己弄!!! 人…總是每天累翻!!! 每個月總休息兩天!(初一與十五) 因為每個月沒有收入XX萬…很難睡好覺!!! 當時!曾考慮外包麵條… 結果老客人不爽一天全又改回自己做手工麵條! 當時我家老爺高齡81歲做麵給小娃娃吃… 為的是"手工筋道"麵條 哀~~~麵粉錢也不少. 每次都要叫50袋麵粉才有便宜! 我家永遠用"駱駝" 因為該牌不偷… ...

2019-02-11 · 1 min · 139 words · Me

k8s kubernetes Lesson 3 k8s by hand

Kubernetes wiki https://wiki.gslin.org/wiki/Kubernetes How to Install a Kubernetes Docker Cluster on CentOS 7 https://www.howtoforge.com/tutorial/centos-kubernetes-docker-cluster/ https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/ https://sueboy.blogspot.com/2019/11/kubernetes-nodeport.html https://rickhw.github.io/2019/03/17/Container/Install-K8s-with-Kubeadm/ ===== https://www.howtoforge.com/tutorial/centos-kubernetes-docker-cluster/ only one master/node k8s yum update setenforce 0 sed -i --follow-symlinks 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux modprobe br_netfilter echo '1' > /proc/sys/net/bridge/bridge-nf-call-iptables swapoff -a vim /etc/fstab >> mark swap yum install -y yum-utils device-mapper-persistent-data lvm2 yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo yum install -y docker-ce cat << eof > /etc/yum.repos.d/kubernetes.repo [kubernetes] name=Kubernetes baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64 enabled=1 gpgcheck=1 repo_gpgcheck=1 gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg EOF yum install -y kubelet kubeadm kubectl sudo reboot systemctl start docker && systemctl enable docker systemctl start kubelet && systemctl enable kubelet docker info | grep -i cgroup sed -i 's/cgroup-driver=systemd/cgroup-driver=cgroupfs/g' /etc/systemd/system/kubelet.service.d/10-kubeadm.conf systemctl daemon-reload systemctl restart kubelet ## kubeadm init --apiserver-advertise-address=10.0.15.10 --pod-network-cidr=10.244.0.0/16 kubeadm init --pod-network-cidr=10.244.0.0/16 mkdir -p $HOME/.kube sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config sudo chown $(id -u):$(id -g) $HOME/.kube/config kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml kubectl get nodes kubectl get pods --all-namespaces https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/#control-plane-node-isolation ...

2019-01-31 · 4 min · 676 words · Me

[轉]kubernetes failure stories

https://github.com/hjacobs/kubernetes-failure-stories

2019-01-31 · 1 min · word · Me

[轉]ingress-nginx & kubernetes-ingress with NGINX & nginxinc/kubernetes-ingress with NGINX Plus

https://github.com/nginxinc/kubernetes-ingress/blob/master/docs/nginx-ingress-controllers.md F…………………………. ================ https://mritd.me/2017/03/04/how-to-use-nginx-ingress/

2019-01-31 · 1 min · 4 words · Me

k8s kubernetes Lesson 2 yaml

https://kubernetes.github.io/ingress-nginx/examples/docker-registry/ https://sueboy.blogspot.com/2019/11/kubernetes-nodeport.html PS:Close basic auth just remark configmap.yml auth: #auth: # htpasswd: # realm: basic-realm # path: /auth/htpasswd README.md # Docker Registry K8s Domain:docker-registry Port:30500 /etc/hosts add 192.168.99.118 docker-registry ## ip is k8s host eth2's ip Finish command: docker login -u username -p password docker-registry:30500 [![](https://3.bp.blogspot.com/-Wj82n6nvHkw/XHUVI-gNy7I/AAAAAAAAUE8/rs1l8mQuu8cKvkoMcZGn0lOfJUWY3udMgCLcBGAs/s640/dockerloginsuccess.jpg)](https://3.bp.blogspot.com/-Wj82n6nvHkw/XHUVI-gNy7I/AAAAAAAAUE8/rs1l8mQuu8cKvkoMcZGn0lOfJUWY3udMgCLcBGAs/s1600/dockerloginsuccess.jpg) https://docs.docker.com/registry/insecure/ Deploy a plain HTTP registry ---------------------------- ```bash /etc/docker/daemon.json { "insecure-registries" : ["docker-registry:30500"] } Restart Docker for the changes to take effect https://blog.csdn.net/zsd498537806/article/details/79290732 https://serverfault.com/questions/611120/failed-tls-handshake-does-not-contain-any-ip-sans http://dockone.io/article/684 #-subj “/C=/ST=/L=/O=/OU=/CN=192.168.99.118” -subj “/C=/ST=/L=/O=/OU=/CN=docker-registry” ...

2019-01-30 · 6 min · 1083 words · Me

k8s kubernetes Lesson 1 windows

1、install Virtualbox 2、donwload & rename minikube.exe & move minikube.exe put file on path C:\minikube add path to system PATH https://storage.googleapis.com/minikube/releases/latest/minikube-windows-amd64.exe 3、download kubectl.exe put file on path C:\minikube https://storage.googleapis.com/kubernetes-release/release/v1.13.0/bin/windows/amd64/kubectl.exe 4、minikube start 5、check virtualbox have new minikube PS:Don’t start minikube with Virtualbox UI. Use cmd >minikube start 6、Run > minikube dashboard 7、Get IP > minikube ip

2019-01-30 · 1 min · 54 words · Me

docker registry

1. create htpasswd docker run --rm --entrypoint htpasswd registry:2 -Bbn username password > htpasswd docker run --rm --entrypoint htpasswd registry:2 -Bbn test test > htpasswd htpasswd file inside have two records: username & test 2. create registry_config.yml version: 0.1 log: fields: service: registry storage: delete: enabled: true cache: blobdescriptor: inmemory filesystem: rootdirectory: /var/lib/registry http: addr: :5000 headers: X-Content-Type-Options: [nosniff] Access-Control-Allow-Origin: ['*'] Access-Control-Allow-Methods: ['HEAD', 'GET', 'OPTIONS', 'DELETE'] Access-Control-Allow-Headers: ['Authorization'] Access-Control-Max-Age: [1728000] Access-Control-Allow-Credentials: [true] Access-Control-Expose-Headers: ['Docker-Content-Digest'] auth: htpasswd: realm: basic-realm path: /etc/docker/registry/htpasswd Access-Control-Allow-Origin can change you want. ...

2019-01-29 · 1 min · 162 words · Me

[轉]EKS 最主要是為了改善維護及升級 k8s cluster 的困難度 Kubernetes

https://kkc.github.io/2018/10/04/EKS-notes/ 為什麼需要 EKS 最主要是為了改善維護及升級 k8s cluster 的困難度,一般來說,自己維護的 k8s cluster 必需要很注意 master 的穩定性,而其他痛苦的地方像是升級 kubernetes version (master node),etcd 的升級,etcd 的備份和還原,另外還有些問題像是有些人忘了更新 certificate ,超過了過期時間後,連不進 master node 的意外。所以在沒有一定大小程度的 kubernetes operation 團隊下,其實蠻推薦大家使用 managed k8s 像是 EKS, GKE, AKS 等等的 solution ,減少其心智負擔。

2019-01-28 · 1 min · 35 words · Me

[轉]你(多半)不需要 Kubernetes k8s

https://linux.cn/article-10469-1.html https://arp242.net/weblog/dont-need-k8s.html

2019-01-25 · 1 min · 2 words · Me

[轉]用 docker 改善開發流程筆記

https://kkc.github.io/2018/04/28/docker-note/ multistage build Optimization && Debugging skill Development environment revolution

2019-01-25 · 1 min · 10 words · Me

[轉]go modules docker

https://pliutau.com/go-modules-docker/

2019-01-25 · 1 min · word · Me