Docker 로 GnuBoard 설치하고 운영하기 1탄. > 개발강좌

매출이 오르면 내리는 수수료! 지금 수수료센터에서 전자결제(PG)수수료 비교견적 신청해 보세요!

개발강좌

프로그램 강좌 :
1. 유창화님의 썸네일, 정규표현식, 이미지관련 강좌
2. Sphinx 검색엔진을 이용한 도로명 주소 검색 시스템 구축

Docker 로 GnuBoard 설치하고 운영하기 1탄. 정보

그누보드5 Docker 로 GnuBoard 설치하고 운영하기 1탄.

본문

Ubuntu 기반에서 Docker 설치하기 1탄.

 

방화벽 disable

sudo ufw disable

 

스왑 메모리 Off

sudo swapoff -a && sudo sed -i '/swap/s/^/#/' /etc/fstab

 

docker 설치하기 위한 기본 유틸 셋팅

sudo apt-get -y update

sudo apt-get -y install \
    ca-certificates \
    curl \
    gnupg \
    lsb-release

sudo mkdir -p /etc/apt/keyrings

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg

 

Docker 설치하기 위해 레파지토리 등록
echo \
  "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
  $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

 

Docker 설치
sudo apt-get update
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin


sudo systemctl enable docker
sudo systemctl start docker

sudo systemctl enable containerd
sudo systemctl start containerd

sudo mkdir -p /etc/docker
cat <<EOF | sudo tee /etc/docker/daemon.json
{
  "exec-opts": ["native.cgroupdriver=systemd"],
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "100m"
  },
  "storage-driver": "overlay2"
}
EOF

sudo systemctl daemon-reload
sudo systemctl restart docker

 

K8S 동시 설치용
cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
br_netfilter
EOF

cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
EOF
sudo sysctl --system

 

K8S 설치
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl

curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.28/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.28/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list

sudo apt-get update
sudo apt-get install -y kubelet kubeadm kubectl
sudo apt-mark hold kubelet kubeadm kubectl docker-ce docker-ce-cli containerd.io docker-compose-plugin

sudo systemctl daemon-reload
sudo systemctl restart kubelet

sudo rm /etc/containerd/config.toml
sudo systemctl restart containerd

 

Master 노드 설치

sudo kubeadm init

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

source <(kubectl completion bash)
echo "source <(kubectl completion bash)" >> ~/.bashrc

kubectl apply -f https://github.com/weaveworks/weave/releases/download/v2.8.1/weave-daemonset-k8s.yaml

 

//k8s 연결
kubeadm join 192.168.25.31:6443 --token 516wsb.f7ubkpu109urzibs \
        --discovery-token-ca-cert-hash sha256:1ae5a6f972f6982b4068ce5e96fc46df3dc25c4361fee672afc251777e92a7f6

 

//Volume 설치용 NFS

sudo apt install -y nfs-common net-tools

mkdir /nfs
mount -t nfs -o vers=3 192.168.X.X:/volume1/web /nfs
192.168.X.X:/volume1/web      /nfs    nfs     defaults        0       0

timedatectl set-timezone Asia/Seoul
timedatectl show

 

//swarm 연결
docker swarm init --advertise-addr
docker swarm join --token SWMTKN-1-2anx9ctzm3ffwbktlnr501ho6gqr3vb370c5d6anyqws07591f-2r3ywtldirv6o6gcdio24fan4 192.168.X.X:2377

 

#groupadd -g 999 docker

#https://github.com/jakubhajek/elasticsearch-docker-swarm/blob/master/stack-elastic.yml

 

Docker APP 성능 향상 및 ES 관련 옵션 설정

# elasticsearch coordinating node
/etc/security/limits.conf
* hard memlock unlimited
* soft memlock unlimited
* hard nofile 65536
* soft nofile 65536
* hard nproc 65536
* soft nproc 65536

vim /etc/rc.local
echo never > /sys/kernel/mm/transparent_hugepage/enabled
exit 0

/etc/sysctl.conf
vm.max_map_count=262144
vm.overcommit_memory=1
net.core.somaxconn=1024

/lib/systemd/system/docker.service
LimitMEMLOCK=infinity

#sudo adduser allinone --disabled-password
#sudo usermod -aG sudo allinone

추천
1

댓글 2개

전체 29
개발강좌 내용 검색 그누보드5에서

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT