Commit 5e53a9e2 authored by JooHan Hong's avatar JooHan Hong

k8s, oper update9

parent 84d45924
Pipeline #6071 passed with stages
in 1 minute and 5 seconds
[![logo](https://www.hongsnet.net/images/logo.gif)](https://www.hongsnet.net)
# MON Container Image Overview
> 각 구성 요소에 대한 **Container Image** Review
## Nginx Dockerfile Review
> 참고 : supervisord 이용한 데몬을 기동한다.
```
# cat Dockerfile
FROM harbor.hongsnet.net/hongsnet-centos/centos:7.6.1810
MAINTAINER Hongs <master@hongsnet.net>
#TIME ZONE 설정
ENV TZ=Asia/Seoul
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone &&\
yum -y install epel-release
#한글 지원
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
COPY CONFIG/MariaDB.repo /etc/yum.repos.d/MariaDB.repo
COPY CONFIG/bashrc /root/.bashrc
RUN yum -y install epel-release
RUN yum -y install glibc glibc-common openssl-devel net-tools vi vim iproute wget bind-utils pwgen psmisc hostname openssh-server openssh-clients cronie crontabs supervisor nodejs npm redis telnet MariaDB MariaDB-server MariaDB-client MariaDB-backup curl tcpdump bind-utils
RUN ln -s /usr/bin/resolveip /usr/libexec/resolveip
RUN npm install -g yarn
RUN npm install -g create-react-app
RUN npm install pm2 -g
#Install nginx repo
RUN rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
RUN yum install -y nginx-1.16.1-1.el7.ngx
COPY CONFIG/default.conf /etc/nginx/conf.d/default.conf
COPY CONFIG/supervisord.conf /etc/supervisor/supervisord.conf
COPY CONFIG/supervisord_monitoring.conf /etc/supervisor/conf.d/supervisord_monitoring.conf
COPY CONFIG/resolv.conf /etc/resolv.conf
EXPOSE 80
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]
```
- Nginx default.conf 내용
```
# cat CONFIG/default.conf
server {
listen 80;
server_name monitor.hongsnet.net;
access_log /var/log/nginx/mon-web.access.log;
error_log /var/log/nginx/mon-web.error.log;
add_header Cache-Control no-store always;
location / {
root /home/mon-web;
index index.html index.htm;
try_files $uri $uri/ /index.html;
# kill cache
add_header Last-Modified $date_gmt;
add_header Cache-Control 'no-store, no-cache';
if_modified_since off;
expires off;
etag off;
}
}
```
- supervisord_monitoring.conf 내용
```
# cat CONFIG/supervisord_monitoring.conf
[program:nginx]
command=/usr/sbin/nginx -g "daemon off;"
user=root
```
## Node.js API Dockerfile Review
> 참고 : supervisord 이용한 데몬을 기동하며, PM2 Manager를 fork 방식으로 실행한다.
```
# cat Dockerfile
FROM harbor.hongsnet.net/hongsnet-centos/centos:7.6.1810
MAINTAINER Hongs <master@hongsnet.net>
#TIME ZONE 설정
ENV TZ=Asia/Seoul
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone &&\
yum -y install epel-release
#한글 지원
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
COPY CONFIG/MariaDB.repo /etc/yum.repos.d/MariaDB.repo
COPY CONFIG/bashrc /root/.bashrc
RUN yum -y install epel-release
RUN yum -y install glibc glibc-common openssl-devel net-tools vi vim iproute wget bind-utils pwgen psmisc hostname openssh-server openssh-clients cronie crontabs supervisor nodejs npm redis telnet MariaDB MariaDB-server MariaDB-client MariaDB-backup curl tcpdump bind-utils
RUN ln -s /usr/bin/resolveip /usr/libexec/resolveip
RUN npm install -g yarn
RUN npm install -g create-react-app
RUN npm install pm2 -g
COPY CONFIG/redis.conf /etc/redis.conf
COPY CONFIG/supervisord.conf /etc/supervisor/supervisord.conf
COPY CONFIG/supervisord_monitoring.conf /etc/supervisor/conf.d/supervisord_monitoring.conf
COPY CONFIG/resolv.conf /etc/resolv.conf
COPY CONFIG/mon-api-start.sh /root/mon-api-start.sh
RUN chmod 755 /root/mon-api-start.sh
EXPOSE 8081
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]
```
- supervisord_monitoring.conf 내용
```
# cat CONFIG/supervisord_monitoring.conf
[program:mon-api]
command=/root/mon-api-start.sh
user=root
[program:redis]
command=/usr/bin/redis-server /etc/redis.conf
user=redis
```
- mon-api-start.sh 내용
```
# cat CONFIG/mon-api-start.sh
#!/bin/bash
cd /home/mon-api;pm2 start ecosystem.config.js --env production
```
## Node.js DB API Dockerfile Review
> 참고 :
```
# cat Dockerfile
FROM harbor.hongsnet.net/hongsnet-centos/centos:7.6.1810
MAINTAINER Hongs <master@hongsnet.net>
#TIME ZONE 설정
ENV TZ=Asia/Seoul
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone &&\
yum -y install epel-release
#한글 지원
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
COPY CONFIG/MariaDB.repo /etc/yum.repos.d/MariaDB.repo
COPY CONFIG/bashrc /root/.bashrc
RUN yum -y install epel-release
RUN yum -y install glibc glibc-common openssl-devel net-tools vi vim iproute wget bind-utils pwgen psmisc hostname openssh-server openssh-clients cronie crontabs supervisor nodejs npm redis telnet MariaDB MariaDB-server MariaDB-client MariaDB-backup curl tcpdump bind-utils
RUN ln -s /usr/bin/resolveip /usr/libexec/resolveip
RUN npm install -g yarn
RUN npm install -g create-react-app
RUN npm install pm2 -g
COPY CONFIG/supervisord.conf /etc/supervisor/supervisord.conf
COPY CONFIG/supervisord_monitoring.conf /etc/supervisor/conf.d/supervisord_monitoring.conf
COPY CONFIG/resolv.conf /etc/resolv.conf
COPY CONFIG/db-api-start.sh /root/db-api-start.sh
RUN chmod 755 /root/db-api-start.sh
EXPOSE 8900
CMD ["/usr/bin/supervisord", "-c", "/etc/supervisor/supervisord.conf"]
```
- supervisord_monitoring.conf 내용
```
# cat CONFIG/supervisord_monitoring.conf
[program:db-api]
command=/root/db-api-start.sh
user=root
```
- db-api-start.sh 내용
```
# cat CONFIG/db-api-start.sh
#!/bin/bash
cd /home/db-api;pm2 start ecosystem.config.js --env production
```
## Build and Deploy
> Image Build 및 Deploy는 GitLAB + Jenkins를 이용한 CI/CD 항목에서 명시한다.
> 바로가기 :
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment