Top

Tags: Linux InstallGuide Django Web-frontend Python Storage HPC Docker k8s Bootstrap

Count website views in Bash script

Sep 29, 2020 | 763 views

#Linux #Bash


count_website_views.sh

First line combine all log files into STDIN stream, then grep certain website host, use double quote as seperator and filter second column as it is a url. Finally, sort it, count it, and sort it again.

zcat /var/log/nginx/access.log*.gz | cat - /var/log/nginx/access.log | \
    grep -E 'https://(www.|)stateofemptiness.com/' | \
    awk -F '"' '{print $2}' | awk '{print $2}' | sort | uniq -c | sort -n 

Filter a certain period of time in access.log

sed -n '/25\/Sep\/2020/,/30\/Sep\/2020/p' /var/log/nginx/access.log
# Or in a less concise way
grep -E $(for i in `seq 25 30`; do echo -n "$i/Sep/2020"; [ $i -ne 30 ] && echo -n "|"; done) /var/log/nginx/access.log


Comments: 0

Kubernetes Dynamic Provisioning Using Dedicated GlusterFS and Heketi

Sep 17, 2020 | 850 views

#Linux #Docker #k8s


Comments: 0

Install GlusterFS on CentOS7 Tutorial

Sep 16, 2020 | 852 views

#Linux #k8s


Tutorial:

Comments: 0

Kubernetes Tutorial

Sep 13, 2020 | 922 views

#Docker #k8s

Additional Concepts:
Install a Kubernetes Cluster

  • Using kube-router as Pod Network
kubeadm init  --pod-network-cidr 10.5.0.0/16
kubectl apply -f https://raw.githubusercontent.com/cloudnativelabs/kube-router/master/daemonset/kubeadm-kuberouter.yaml

Troubleshooting
PersistentVolume and PersistentVolumeClaim
kubectl patch pv pv-name -p '{"spec":{"claimRef": null}}'

kubectl patch pvc PVC_NAME -p '{"metadata":{"finalizers": []}}' --type=merge
Using GlusterFS with Kubernetes
StatefulSet

Comments: 0

Set Up a Private Docker Registry on CentOS

Sep 10, 2020 | 830 views

#Linux #Docker

Tutorial refer to here: How To Set Up a Private Docker Registry on Ubuntu 18.04

Also check Sharing docker images without a registry

Comments: 0

Certbot letsencrypt tutorial

Sep 09, 2020 | 685 views

#Linux

Avoid using python2 for certbot as it has deprecated.



cd /etc/letsencrypt/
virtualenv -p python3 venv3
source venv3/bin/activate
certbot certonly --standalone  -d your-domain.com

# renew ssl certificates
/etc/letsencrypt/venv3/bin/certbot renew 

Refer to: github info

Comments: 0

Nginx reverse proxy setting

Sep 06, 2020 | 736 views

#Linux #Web-frontend

Refer to below:


Comments: 0

Enable sshd service on CentOS7-systemd docker image

Sep 01, 2020 | 1349 views

#Linux #Docker


1. Build a centos7-systemd docker base image refer to official centos on docker hub

Dockerfile for systemd base image


FROM centos:7.8.2003
ENV container docker
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == \
systemd-tmpfiles-setup.service ] || rm -f $i; done); \
rm -f /lib/systemd/system/multi-user.target.wants/*;\
rm -f /etc/systemd/system/*.wants/*;\
rm -f /lib/systemd/system/local-fs.target.wants/*; \
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -f /lib/systemd/system/basic.target.wants/*;\
rm -f /lib/systemd/system/anaconda.target.wants/*;
VOLUME [ "/sys/fs/cgroup" ]
CMD ["/usr/sbin/init"]

Build your base image

$ docker build --rm -t local/centos7-systemd .
2.  Build image with sshd service based upon above base image

Dockerfile of centos7-systemd-sshd 

FROM local/centos7-systemd
RUN yum -y install openssh-server openssh-clients; systemctl enable sshd.service;
CMD ["/usr/sbin/init"]

Build image

docker build --rm -t local/centos7-systemd-sshd .
3. Run a container of centos7-systemd-sshd refer to stackflow
docker run -it -d --name node2 --privileged -e container=docker \
-v /sys/fs/cgroup:/sys/fs/cgroup:ro local/centos7-systemd-sshd /usr/sbin/init

Enter into container's terminal:

docker exec -it node2 bash

End

Comments: 0

Zabbix-server Tutorial on Centos 7

Aug 28, 2020 | 872 views

#Linux #InstallGuide

Update on 2020/12/8:


IPMI with zabbix

  1. 利用zabbix通过IPMI监控服务器硬件 
  2. Template chooses "Template Server Chassis by IPMI“


Tutorials:

Configuring SELinux with zabbix: refer to here and here


Monitoring Tutorials:

Zabbix Related Tutorial:

On this page, we offer quick access to a list of tutorials related to Zabbix installation.





Comments: 0