Prometheus란?? 시계열(Time Series) 데이터베이스 기반 모니터링 시스템

[root@zoomoney opt]# tree
.
├── grafana
│   ├── Containerfile
│   └── provisioning
│       ├── dashborads
│       └── datasources
└── prometheus
    ├── Containerfile
    └── prometheus.yml

 

<Prometheus연동>

1.prometheus 디렉토리 이동후

buildah bud -t prometheus:v1 . 명령어 수행

 

<빌드된 컨테이너 이미지 확인>

[root@zoomoney opt]# podman images
REPOSITORY                 TAG                IMAGE ID      CREATED       SIZE
localhost/prometheus       v1                 9290fb8f4fad  24 hours ago  303 MB

 

<Container 이미지 기동>

podman run -d --name prometheus_v1 --pod zoomoney_pro localhost/prometheus:v1

 

<Grafana 연동>

1.grafana 디렉토리 이동후

buildah bud -t grafana:v1 . 명령어 수행

 

<빌드된 컨테이너 이미지 확인>

[root@zoomoney ~]# podimg
REPOSITORY                 TAG                IMAGE ID      CREATED       SIZE
localhost/prometheus       v1                 9290fb8f4fad  24 hours ago  303 MB
localhost/backend          v1                 163c2883438f  24 hours ago  573 MB
localhost/grafana          v1                 2d2ae498da92  29 hours ago   671 MB

 

<Container 이미지 기동>

podman run -d --name grafana_v1 --pod zoomoney_pro localhost/grafana:v1

 

<Container 확인>

CONTAINER ID  IMAGE                                    COMMAND               CREATED       STATUS       PORTS                                                                                                  NAMES               POD ID        PODNAME
2365106ac006  localhost/grafana:v1                                           24 hours ago  Up 24 hours  0.0.0.0:80->80/tcp, 0.0.0.0:7777->7777/tcp, 0.0.0.0:9091->9090/tcp, 0.0.0.0:33000->3000/tcp, 3000/tcp  grafana_v1          89a757316fa5  zoomoney_pro
005a100371c9  localhost/prometheus:v1                  --config.file=/et...  24 hours ago  Up 24 hours  0.0.0.0:80->80/tcp, 0.0.0.0:7777->7777/tcp, 0.0.0.0:9091->9090/tcp, 0.0.0.0:33000->3000/tcp, 9090/tcp  prometheus_v1       89a757316fa5  zoomoney_pro

 

 

<접속확인>

1.Grafana 접속 확인

 

2. Prometheus 가 Zoomoney 프로젝트 엔드포인트에 매트릭스를 수집하는지 Curl 명령어로 확인 결과

[root@zoomoney ~]# curl http://192.168.0.174:7777/zoomoney/actuator/prometheus
# HELP application_ready_time_seconds Time taken for the application to be ready to service requests
# TYPE application_ready_time_seconds gauge
application_ready_time_seconds{main_application_class="com.shinhan.zoomoney.ZooMoneyBackEndApplication"} 10.454
# HELP application_started_time_seconds Time taken to start the application
# TYPE application_started_time_seconds gauge
application_started_time_seconds{main_application_class="com.shinhan.zoomoney.ZooMoneyBackEndApplication"} 10.359
# HELP disk_free_bytes Usable space for path
# TYPE disk_free_bytes gauge
disk_free_bytes{path="/."} 2.43263488E9
# HELP disk_total_bytes Total space for path
# TYPE disk_total_bytes gauge
disk_total_bytes{path="/."} 1.1416895488E10
# HELP executor_active_threads The approximate number of threads that are actively executing tasks
# TYPE executor_active_threads gauge
executor_active_threads{name="applicationTaskExecutor"} 0.0
# HELP executor_completed_tasks_total The approximate total number of tasks that have completed execution
# TYPE executor_completed_tasks_total counter
executor_completed_tasks_total{name="applicationTaskExecutor"} 0.0
# HELP executor_pool_core_threads The core number of threads for the pool
# TYPE executor_pool_core_threads gauge
executor_pool_core_threads{name="applicationTaskExecutor"} 8.0
# HELP executor_pool_max_threads The maximum allowed number of threads in the pool
# TYPE executor_pool_max_threads gauge
executor_pool_max_threads{name="applicationTaskExecutor"} 2.147483647E9
# HELP executor_pool_size_threads The current number of threads in the pool
# TYPE executor_pool_size_threads gauge
executor_pool_size_threads{name="applicationTaskExecutor"} 0.0
# HELP executor_queue_remaining_tasks The number of additional elements that this queue can ideally accept without blocking
# TYPE executor_queue_remaining_tasks gauge
... 생략...

<Grafana 대쉬보드 구성> 

'Cloud' 카테고리의 다른 글

Jenkins  (0) 2025.04.22
Docker 와 Podman 차이  (0) 2025.03.23
Podman 으로 Zoomoney 프로젝트 배포하기  (0) 2025.03.22
Skopeo  (0) 2025.01.21
Dev-Ops  (0) 2025.01.20

Jenkins는 오픈 소스 자동화 서버로, 소프트웨어 개발의 빌드, 테스트, 배포 과정을 자동화하여 지속적인 통합(CI)과 지속적인 배포(CD)를 지원 

Jenkins의 주요 기능

  • 자동화된 빌드 및 테스트: 코드 변경 시 자동으로 빌드와 테스트를 수행하여 품질을 유지
  • 다양한 플러그인 지원: Git, Maven, Docker, Kubernetes 등과의 연동을 통해 유연한 파이프라인 구성이 가능
  • 웹 기반 인터페이스: 직관적인 UI를 통해 파이프라인 관리와 모니터링이 용이
  • Jenkinsfile을 통한 파이프라인 정의: 코드로 파이프라인을 정의하여 버전 관리와 협업

Jenkinsfile과 파이프라인 문법

Jenkinsfile은 Jenkins 파이프라인을 정의하는 스크립트 파일로, 두 가지 문법을 지원

  1. Declarative Pipeline: 구조화된 문법으로, 초보자에게 적합하며 가독성이 높아짐
  2. Scripted Pipeline: Groovy 기반의 유연한 스크립트 문법으로, 복잡한 로직 구현에 적합

Declarative Pipeline 

pipeline {
    agent any
    stages {
        stage('Build') {
            steps {
                echo 'Building...'
            }
        }
        stage('Test') {
            steps {
                echo 'Testing...'
            }
        }
        stage('Deploy') {
            steps {
                echo 'Deploying...'
            }
        }
    }
    post {
        success {
            echo 'Pipeline succeeded!'
        }
        failure {
            echo 'Pipeline failed.'
        }
    }
}

'Cloud' 카테고리의 다른 글

Zoomoney 프로젝트 Prometheus 와 Grafana 연동  (0) 2025.04.23
Docker 와 Podman 차이  (0) 2025.03.23
Podman 으로 Zoomoney 프로젝트 배포하기  (0) 2025.03.22
Skopeo  (0) 2025.01.21
Dev-Ops  (0) 2025.01.20

Docker와 Podman은 컨테이너를 관리하는 도구이지만, 몇 가지 중요한 차이점이 있습니다.

🔹 1. 아키텍처 차이

비교 항목DockerPodman
Daemon (데몬) dockerd라는 데몬이 동작하여 컨테이너를 관리 데몬 없이 작동 (daemonless)
Rootless 지원 기본적으로 root 권한이 필요 기본적으로 rootless 모드 지원
CLI 구조 단일 바이너리 (docker CLI) podman CLI 및 buildah(빌드 전용) CLI 사용
  • Docker는 dockerd라는 백그라운드에서 실행되는 데몬을 통해 컨테이너를 관리함.
  • Podman은 데몬이 없고, 사용자가 실행하는 명령이 곧 컨테이너 실행이 됨.

🔹 2. 보안 (Rootless 모드)

  • Docker는 기본적으로 root 권한을 필요로 하며, rootless 모드는 추가 설정이 필요함.
  • Podman은 기본적으로 rootless 모드를 지원하여 보안성이 높음.
    • 예를 들어, podman run을 실행하면 사용자 권한으로 실행됨..

🔹 3. 명령어 호환성

Podman은 Docker와 CLI 명령어가 거의 동일해서 alias docker=podman처럼 설정하면 Docker처럼 사용할 수 있음.

sh
복사편집
# Docker와 동일한 명령어 사용 가능 podman run -d -p 8080:80 nginx

그러나 Docker Compose는 Podman에서 기본적으로 지원되지 않음 → podman-compose라는 별도 패키지가 필요함.

🔹 4. 이미지 및 레지스트리

  • DockerPodman 모두 동일한 컨테이너 이미지를 사용할 수 있음.
  • Podman은 Docker Hub뿐만 아니라 Red Hat의 Quay, OCI 표준 이미지 저장소를 활용할 수 있음.

🔹 5. 시스템 서비스 및 컨테이너 관리

  • Docker는 docker-compose, docker swarm 등을 활용하여 여러 컨테이너를 쉽게 관리 가능.
  • Podman은 podman generate systemd를 사용하여 systemd 서비스로 컨테이너를 관리할 수 있음.

🔹 6. 사용 사례 추천

사용 목적DockerPodman
개발 환경에서 컨테이너 실행
보안이 중요한 환경 (Rootless 필요)
시스템 서비스(systemd) 기반 관리
Docker Compose 활용 ❌ (podman-compose 필요)
Red Hat 기반 시스템 (RHEL, Fedora)

결론:

  • 개발/배포 환경에서는 Docker가 여전히 강력한 선택지.
  • 보안성이 중요한 엔터프라이즈 환경에서는 Podman이 유리.
  • **Red Hat 기반 시스템(Fedora, RHEL)**에서는 Podman이 기본 제공됨.

'Cloud' 카테고리의 다른 글

Zoomoney 프로젝트 Prometheus 와 Grafana 연동  (0) 2025.04.23
Jenkins  (0) 2025.04.22
Podman 으로 Zoomoney 프로젝트 배포하기  (0) 2025.03.22
Skopeo  (0) 2025.01.21
Dev-Ops  (0) 2025.01.20

1. 준비사항

 

터미널 접속도구(Putty,xShell,cmd 등등) 

FTP 프로그램(파일질라)

리눅스 명령어 

컨테이너 와 POD 개념 


결과물(Zoomoney 기준)
> Front-End(리액트 프로젝트)

> Back-End(SpingBoot 프로젝트)

> mariadb SQL 스키마 및 데이터 파일 (.sql)

 

1.MariaDB SQL DUMP 받는법

여기서 DUMP 란???

SQL DUMP는 데이터베이스의 백업 또는 복구를 위한 SQL 파일을 의미함,
데이터베이스의 테이블 구조, 데이터, 인덱스, 뷰, 트리거 등을 SQL 문 형태로 저장한 파일

 

MaraiaDB cmd 접속

 

1. MariaDB 접속방법

//mariadb 접속 방법
mysql -h zoomoney.c3msoiki2c17.ap-northeast-2.rds.amazonaws.com -P 3306 -u root -p


Setting environment for MariaDB 11.5 (x64)

C:\Windows\System32>mysql -h zoomoney.c3msoiki2c17.ap-northeast-2.rds.amazonaws.com -P 3306 -u root -p
Enter password: **************** //공유된 RDS 비밀번호
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 151821
Server version: 11.4.4-MariaDB-log managed by https://aws.amazon.com/rds/

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> use zoomoney
Database changed
MariaDB [zoomoney]> show tabels;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'tabels' at line 1
MariaDB [zoomoney]> show tabels;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'tabels' at line 1
MariaDB [zoomoney]> show tables;
+----------------------+
| Tables_in_zoomoney   |
+----------------------+
| account              |
| card                 |
| category             |
| contract             |
| daily                |
| member               |
| money_plan           |
| notify               |
| plan_detail          |
| quiz                 |
| quiz_keyword         |
| stock                |
| stock_history        |
| stock_history_backup |
| stock_info           |
| stock_money          |
| stock_result         |
| use_history          |
+----------------------+
18 rows in set (0.010 sec)

MariaDB [zoomoney]>

 

 

2. Zoomoney DB dump 하는법

//DB DUMP 하는방법
mysqldump -h zoomoney.c3msoiki2c17.ap-northeast-2.rds.amazonaws.com -P 3306 -u root -p --databases zoomoney > C:/Users/dydqj/Downloads/zoomoney_dump.sql

옵션 설명
-h : 접속하려는 DB 의 엔드포인트
-P : DB 의 포트번호
-u : user 이름
-p : 비밀번호 문의 유무
--database: db 이름 
> C:/Users/dydqj/Downloads/zoomoney_dump.sql : dump 명령어의 결과물을 해당디렉토리의 파일이름.sql로 export 하겠다

 

DUMP 수행

Setting environment for MariaDB 11.5 (x64)

C:\Windows\System32>mysqldump -h zoomoney.c3msoiki2c17.ap-northeast-2.rds.amazonaws.com -P 3306 -u root -p --databases zoomoney > C:/Users/dydqj/Downloads/zoomoney_dump.sql
Enter password: ****************

C:\Windows\System32>

 

.sql 파일 Export 확인

 

<디렉토리 구조>

[root@zoomoney ~]# tree
.
├── anaconda-ks.cfg
├── backend
│   ├── Containerfile
│   └── ZooMoney_BackEnd_LocalDB.jar
├── contract_pdf
│   ├── fonts
│   │   └── malgun.ttf
│   └── signature
├── database
│   ├── Containerfile
│   └── zoomoney_dump.sql
├── frontend
│   ├── asset-manifest.json
│   ├── build
│   ├── build.tar
│   ├── Containerfile
│   ├── favicon.ico
│   ├── index.html
│   ├── logo192.png
│   ├── logo512.png
│   ├── manifest.json
│   ├── pdf.worker.min.js
│   ├── pdf.worker.min.mjs
│   ├── robots.txt
│   └── static

 


<Front-End 빌드 파일 셋팅>

1.Front-End 파일 빌드하기

 .env 에 설정추가(VsCode)

GENERATE_SOURCEMAP=false

 

 VsCode 터미널창에서  npm run build 명령어 수행

C:\Users\dydqj\git\ZooMoney_FrontEnd>npm run build

> zoomoney@0.1.0 build
> react-scripts build

Creating an optimized production build...
Compiled with warnings.

[eslint] 
src\card\CardHistory.jsx
  Line 9:8:  'cardimage' is defined but never used  no-unused-vars

src\moneyPlan\SelectChart.jsx
  Line 100:6:  React Hook useEffect has a missing dependency: 'findPlanNumByDate'. Either include it or remove the dependency array  react-hooks/exhaustive-deps

Search for the keywords to learn more about each warning.
To ignore, add // eslint-disable-next-line to the line before.

File sizes after gzip:

  484 kB (+139 B)  build\static\js\main.e1b819db.js
  394.29 kB        build\static\js\380.80d869ba.chunk.js
  44.64 kB (+6 B)  build\static\css\main.2584c086.css
  1.73 kB          build\static\js\206.34ec3213.chunk.js

The project was built assuming it is hosted at /.
You can control this with the homepage field in your package.json.

The build folder is ready to be deployed.
You may serve it with a static server:

  serve -s build

Find out more about deployment here:

  https://cra.link/deployment

 

2.빌드파일 확인(프로젝트 폴더 경로 이동)

경고:>>>build 폴더를 통째로 파일질라로 업로드시 업로드는 가능하나.. 크기에 따라서 시간이 오래걸리면 

시간초과로 업로드가 중지될수도있으니,, .tar 나 gzip 파일 처럼 압축해서 올리는것을 권장함 

 

3.파일질라(FileZilla) 로 Front-End 빌드파일 업로드(계정에따라 디렉토리 다를수도있음)

 

업로드후 압축된 build 파일 해체(tar 로 압축했기때문에 tar 명령어로 압축해제)

[root@zoomoney frontend]# ll
total 13012
-rw-r--r--. 1 zoomoney zoomoney 13317120 Mar 24 20:16 build.tar
-rw-r--r--. 1 root     root          105 Mar 24 16:48 Containerfile
[root@zoomoney frontend]# tar -xvf build.tar

압축해제 확인 후 build 디렉토리로 이동하여 모든파일 frontend 디렉토리 이동(mv 명령어 사용)

[root@zoomoney frontend]# ls
build  build.tar  Containerfile
[root@zoomoney frontend]# cd build/
[root@zoomoney build]# ls
asset-manifest.json  favicon.ico  index.html  logo192.png  logo512.png  manifest.json  pdf.worker.min.js  pdf.worker.min.mjs  robots.txt  static
[root@zoomoney build]# mv * ../
[root@zoomoney build]# ls ../
asset-manifest.json  build  build.tar  Containerfile  favicon.ico  index.html  logo192.png  logo512.png  manifest.json  pdf.worker.min.js  pdf.worker.min.mjs  robots.txt  static
[root@zoomoney build]#
[root@zoomoney frontend]# pwd
/root/frontend
[root@zoomoney frontend]# cat Containerfile
FROM docker.io/library/nginx:1.26.3
COPY * /usr/share/nginx/html
ADD static /usr/share/nginx/html/static
[root@zoomoney frontend]# ls -al
total 15616
drwxr-xr-x. 4 zoomoney zoomoney     4096 Mar 24 20:18 .
dr-xr-x---. 8 root     root         4096 Mar 24 20:19 ..
-rwxr-xr-x. 1 root     root         3388 Mar 24 20:14 asset-manifest.json
drwxr-xr-x. 2 root     root            6 Mar 24 20:18 build
-rw-r--r--. 1 zoomoney zoomoney 13317120 Mar 24 20:16 build.tar
-rw-r--r--. 1 root     root          105 Mar 24 16:48 Containerfile
-rwxr-xr-x. 1 root     root       165662 Mar 18 15:20 favicon.ico
-rwxr-xr-x. 1 root     root          643 Mar 24 20:14 index.html
-rwxr-xr-x. 1 root     root         5347 Mar 12 10:34 logo192.png
-rwxr-xr-x. 1 root     root         9664 Mar 12 10:34 logo512.png
-rwxr-xr-x. 1 root     root          517 Mar 12 10:34 manifest.json
-rwxr-xr-x. 1 root     root      1074786 Mar 17 18:40 pdf.worker.min.js
-rwxr-xr-x. 1 root     root      1375858 Mar 12 10:34 pdf.worker.min.mjs
-rwxr-xr-x. 1 root     root           70 Mar 12 10:34 robots.txt
drwxr-xr-x. 5 root     root           40 Mar 24 20:14 static
[root@zoomoney frontend]#

 

<Back-End 빌드 파일 셋팅>

 

1.BackEnd 프로젝트 .jar 로 빌드하기

GradleTasks > build  >bootJar 클릭

 

빌드성공시

프로젝트 폴더 이동후 빌드된 .jar 파일 확인후 미리 작성된 Container 파일 내용안에 ZooMoney_BackEnd_LocalDB.jar

이름으로 해당파일을 이미지를 만들기때문에 .jar 파일 이름을 맞춰줘야함 

 

파일질라로 backend .jar 파일 업로드

 

[root@zoomoney backend]# pwd
/root/backend
[root@zoomoney backend]# cat Containerfile
FROM docker.io/library/openjdk:24-ea-21-jdk-slim
COPY ZooMoney_BackEnd_LocalDB.jar /usr/local/zoomoney/app.jar
EXPOSE 7777
CMD ["java", "-jar","/usr/local/zoomoney/app.jar"]

[root@zoomoney backend]# ls -al
total 116880
drwxr-xr-x. 2 zoomoney zoomoney        63 Mar 24 20:19 .
dr-xr-x---. 8 root     root          4096 Mar 24 20:19 ..
-rw-r--r--. 1 aneunoun aneunoun       175 Mar 24 20:19 Containerfile
-rw-r--r--. 1 zoomoney zoomoney 119673486 Mar 24 20:17 ZooMoney_BackEnd_LocalDB.jar
[root@zoomoney backend]#

 

<DataBase 빌드 파일 셋팅>

파일질라로 .sql 파일 database 디렉토리 업로드

[root@zoomoney database]# pwd
/root/database
[root@zoomoney database]# cat Containerfile
FROM docker.io/library/mariadb:11.4.5-ubi
ENV MARIADB_ROOT_PASSWORD=1234
ENV MARIADB_DATABASE=zoomoney
COPY zoomoney_dump.sql /docker-entrypoint-initdb.d/initdb.sql

[root@zoomoney database]# ls -al
total 56
drwxr-xr-x. 2 zoomoney zoomoney    52 Mar 24 20:17 .
dr-xr-x---. 8 root     root      4096 Mar 24 20:19 ..
-rw-r--r--. 1 root     root       166 Mar 24 16:48 Containerfile
-rw-r--r--. 1 zoomoney zoomoney 49053 Mar 24 20:17 zoomoney_dump.sql
[root@zoomoney database]#

 

<Front-End 컨테이너 이미지 빌드>

1.frontend 디렉토리 이동후

 buildah bud -t frontend:v2 . 명령어 수행

[root@zoomoney frontend]# buildah bud -t frontend:v2 .
STEP 1/3: FROM docker.io/library/nginx:1.26.3
STEP 2/3: COPY * /usr/share/nginx/html
STEP 3/3: ADD static /usr/share/nginx/html/static
COMMIT frontend:v2
Getting image source signatures
Copying blob 1287fbecdfcc skipped: already exists
Copying blob 1fc3fb77f66c skipped: already exists
Copying blob 6e5156a205f6 skipped: already exists
Copying blob d0f4c4ff4232 skipped: already exists
Copying blob 391db6a7e7d3 skipped: already exists
Copying blob 58ed31f4db9b skipped: already exists
Copying blob b9a57c4b9f8f skipped: already exists
Copying blob 44c156affad4 done   |
Copying config e86184a14c done   |
Writing manifest to image destination
--> e86184a14c0c
Successfully tagged localhost/frontend:v2
e86184a14c0c083b71ddec62d9f3d636790abf30c8b1ae48b8db192b90e6c132

 

 

<Back-End 컨테이너 이미지 빌드>

1.backend 디렉토리 이동후

buildah bud -t backend:v2 . 명령어 수행

[root@zoomoney backend]# buildah bud -t backend:v2 .
STEP 1/4: FROM docker.io/library/openjdk:24-ea-21-jdk-slim
STEP 2/4: COPY ZooMoney_BackEnd_LocalDB.jar /usr/local/zoomoney/app.jar
STEP 3/4: EXPOSE 7777
STEP 4/4: CMD ["java", "-jar","/usr/local/zoomoney/app.jar"]
COMMIT backend:v2
Getting image source signatures
Copying blob 98b5f35ea9d3 skipped: already exists
Copying blob c98faa4eebe8 skipped: already exists
Copying blob ea8bd79626bd skipped: already exists
Copying blob 4cc6f2c5d4ae done   |
Copying config 279c9f331c done   |
Writing manifest to image destination
--> 279c9f331c11
Successfully tagged localhost/backend:v2
279c9f331c11b80d4de47fe9381414d6335ed72ce6d5a2b803a71bac65646021
[root@zoomoney backend]#

 

<Database 컨테이너 이미지 빌드>

1.database 디렉토리 이동후

buildah bud -t database:v2 . 명령어 수행

[root@zoomoney database]# buildah bud -t database:v2 .
STEP 1/4: FROM docker.io/library/mariadb:11.4.5-ubi
STEP 2/4: ENV MARIADB_ROOT_PASSWORD=1234
STEP 3/4: ENV MARIADB_DATABASE=zoomoney
STEP 4/4: COPY zoomoney_dump.sql /docker-entrypoint-initdb.d/initdb.sql
COMMIT database:v2
Getting image source signatures
Copying blob 45c00d6e135e skipped: already exists
Copying blob 92fbf195d637 skipped: already exists
Copying blob d37b349846af skipped: already exists
Copying blob c92e059fc869 skipped: already exists
Copying blob 169fbbebd80b skipped: already exists
Copying blob 09dd923221bc skipped: already exists
Copying blob 2083427d588a skipped: already exists
Copying blob 8ab90d31ccde skipped: already exists
Copying blob 7f8958a102ef skipped: already exists
Copying blob 9ae86fb5cef9 skipped: already exists
Copying blob 8ca443c97da5 done   |
Copying config 5be0615a54 done   |
Writing manifest to image destination
--> 5be0615a5483
Successfully tagged localhost/database:v2
5be0615a54839bf6f04478071885dd972ae8e959b1fed064d26d16ffd08a80d2

 

 

<빌드된 컨테이너 이미지 확인>

[root@zoomoney ~]# podman images
REPOSITORY                 TAG                IMAGE ID      CREATED             SIZE
localhost/database         v2                 5be0615a5483  About a minute ago  471 MB
localhost/backend          v2                 279c9f331c11  10 minutes ago      571 MB
localhost/frontend         v2                 e86184a14c0c  16 minutes ago      233 MB

 

<POD 생성 및 기동상태 확인>

[root@zoomoney ~]# podman pod create --publish 80:80 --publish 7777:7777 --name zoomoney1
3463429f13d138a2c6e79e6e4381c6915071f518247555c85e7aaba29980738f
[root@zoomoney ~]# podman pod ls
POD ID        NAME        STATUS      CREATED        INFRA ID      # OF CONTAINERS
3463429f13d1  zoomoney1   Created     5 seconds ago  02d5923b5723  1
77195cd53639  zoomoney    Running     16 hours ago   49bb7c151059  4
[root@zoomoney ~]#

 

<Container 이미지 기동>

podman container run -d --name frontend --pod zoomoney1 localhost/frontend:v2 
podman container run -d --name backend --pod zoomoney1 localhost/backend:v2 
podman container run -d --name database --pod zoomoney1 localhost/database:v2

'Cloud' 카테고리의 다른 글

Jenkins  (0) 2025.04.22
Docker 와 Podman 차이  (0) 2025.03.23
Skopeo  (0) 2025.01.21
Dev-Ops  (0) 2025.01.20
Cloud-Front  (0) 2025.01.15

Skopeo는 컨테이너 이미지를 다루기 위한 오픈소스 도구로, 주로 컨테이너 이미지의 레지스트리 간 복사, 검사, 메타데이터 조회, 이미지 변환 등을 수행하는 데 사용된다. skopeo는 컨테이너 이미지를 로컬에 저장하지 않고도 원격 레지스트리에서 직접 작업할 수 있기 때문에, Docker나 Podman보다 더 간편하고 빠르게 이미지 작업을 할 수 있다

주요 기능

    • Skopeo는 하나의 컨테이너 이미지를 다른 레지스트리로 복사할 수 있다. 예를 들어, Docker Hub에서 이미지를 가져와 다른 레지스트리로 이동하는 작업 가능
    • skopeo copy 명령을 사용하여 이미지를 복사가능
skopeo copy docker://docker.io/library/nginx:latest oci:/tmp/nginx:latest

 

  1. 이미지 정보 조회 (Inspect):
    • Skopeo는 레지스트리에서 이미지를 다운로드하지 않고 메타데이터를 조회할 수 있습니다. 이를 통해 이미지의 크기, 레이어, 태그 등을 알 수 있습니다.
    • skopeo inspect 명령을 사용하여 이미지를 검사할 수 있습니다.
    skopeo inspect docker://docker.io/library/nginx:latest
     
  2. 이미지 미러링:
    • Skopeo는 이미지의 미러를 만들 수 있으며, 이미지의 레지스트리 간 복사를 지원합니다. 이를 통해 특정 레지스트리에서 이미지를 복사하여 다른 레지스트리로 미러링할 수 있습니다.
  3. 이미지 태그 변경:
    • Skopeo는 이미지를 복사할 때 새로운 태그를 지정하거나 기존의 이미지를 다른 태그로 변경할 수 있습니다.
  4. 이미지 비교:
    • Skopeo는 두 이미지를 비교하는 기능을 제공하여, 어떤 차이가 있는지 알 수 있습니다.
  5. 컨테이너 이미지 변환:
    • Skopeo는 Docker 이미지, OCI (Open Container Initiative) 이미지 등 다양한 포맷 간 변환을 지원합니다. 이로써 다양한 도구에서 사용할 수 있도록 이미지를 변환할 수 있습니다.
  6. 멀티레지스트리 작업:
    • Skopeo는 Docker Hub, Quay, Google Container Registry (GCR), AWS ECR 등 다양한 컨테이너 레지스트리와 호환되며, 이를 통해 여러 레지스트리 간의 작업을 원활하게 처리할 수 있습니다.

Skopeo와 Docker/Podman의 차이점

  • Docker/Podman: 이미지를 빌드하고 실행하는 도구입니다. 이미지의 실행과 관련된 작업에 집중합니다.
  • Skopeo: 이미지를 레지스트리 간 이동하거나 메타데이터를 조회하는 도구로, 이미지를 실행하거나 빌드하지 않습니다. 주로 이미지의 배포, 검사, 변환, 복사 등을 처리합니다.

Skopeo 사용 장점

  1. 빠르고 효율적인 레지스트리 작업:
    • 이미지를 로컬에 저장하지 않고도 레지스트리 간에 작업할 수 있어 디스크 공간을 절약하고 작업을 빠르게 처리할 수 있습니다.
  2. 멀티레지스트리 지원:
    • Docker Hub 외에도 다양한 레지스트리와 호환되어 유연하게 작업할 수 있습니다.
  3. 이미지 검사 및 변환:
    • Docker와 같은 도구 없이 이미지의 메타데이터를 검사하거나, 이미지 포맷을 변환할 수 있는 기능을 제공합니다.

'Cloud' 카테고리의 다른 글

Docker 와 Podman 차이  (0) 2025.03.23
Podman 으로 Zoomoney 프로젝트 배포하기  (0) 2025.03.22
Dev-Ops  (0) 2025.01.20
Cloud-Front  (0) 2025.01.15
기본적인 DevOps 를 하기위한 리눅스명령어  (0) 2024.11.26

 

[root@localhost blog]# cat Dockerfile.web
FROM docker.io/library/tomcat:8.5.15

MAINTAINER "KIM YONG BUM<YOUR EMAIL>"

RUN rm -rf /usr/local/tomcat/webapps/

ADD docker/postgresql-9.4.1212.jar /usr/local/tomcat/lib/
ADD target/blog.war /usr/local/tomcat/webapps/ROOT.war
ADD target/shinhan-1.0.0-BUILD-SNAPSHOT.war /usr/local/tomcat/webapps/ROOT.war

'Cloud' 카테고리의 다른 글

Podman 으로 Zoomoney 프로젝트 배포하기  (0) 2025.03.22
Skopeo  (0) 2025.01.21
Cloud-Front  (0) 2025.01.15
기본적인 DevOps 를 하기위한 리눅스명령어  (0) 2024.11.26
쿠버네티스  (0) 2024.11.19
CloudFront 도입 배경과 보안에 대한 설명
  1. 왜 S3의 URL을 직접 노출하면 안 되는가?
    • S3 버킷의 URL이 공개되면, 누구든지 해당 URL을 알고 있는 사람은 데이터를 바로 다운로드하거나 볼 수 있음
    • 이런 식으로 데이터에 쉽게 접근할 수 있으면, 악의적인 사용자가 데이터를 무단으로 이용하거나 시스템을 공격할 가능성이 커짐
    • 따라서 S3의 URL이 외부에 직접적으로 노출되지 않도록 하는 것이 중요
  2. CloudFront는 어떤 역할을 하는가?
    • CloudFront는 S3와 최종 사용자(웹사이트 방문자 또는 애플리케이션 사용자) 사이에서 중개 역할을 함
    • 사용자는 CloudFront의 도메인을 통해 데이터를 요청하게 되고, CloudFront는 S3에서 데이터를 가져와 사용자에게 전달함
    • 이렇게 하면 사용자가 S3의 원본 URL을 알 수 없게 되고, S3 버킷 자체가 외부에 노출되지 않게 됨
    • 결과적으로, 데이터를 안전하게 제공할 수 있는 환경이 만들어짐
  3. CloudFront URL이 노출되면 괜찮은가?
    • 현재 서비스에서는 사진과 같은 콘텐츠만 S3에 저장하고 있고, 유저의 개인정보나 민감한 데이터는 포함하지 않음
    • 이런 경우 CloudFront URL이 노출되더라도 큰 문제가 되지는 않음
    • 하지만 만약 유저의 개인정보나 중요한 데이터를 제공해야 하는 경우라면, CloudFront를 통해 접근 제한 설정을 적용할 수있음
    • 예를 들어, Signed URL을 사용하면 인증된 사용자만 특정 콘텐츠를 볼 수 있도록 제한할 수 있음
  4. CloudFront를 도입한 다른 이유는 무엇인가?
    • 이미지 리사이징과 같은 추가적인 기능을 제공하기 위해서도 CloudFront는 필요했음.

'Cloud' 카테고리의 다른 글

Podman 으로 Zoomoney 프로젝트 배포하기  (0) 2025.03.22
Skopeo  (0) 2025.01.21
Dev-Ops  (0) 2025.01.20
기본적인 DevOps 를 하기위한 리눅스명령어  (0) 2024.11.26
쿠버네티스  (0) 2024.11.19

시스템 정보 및 관리

  • uname: 시스템 정보 확인
     
    uname -a # 커널, 호스트 이름 등 전체 시스템 정보
  • hostname: 호스트 이름 확인 및 설정
     
    hostname # 현재 호스트 이름 출력
  • uptime: 시스템 가동 시간 확인
  • top / htop: 실시간 프로세스 및 시스템 자원 사용 확인
     
    top
  • vmstat: CPU, 메모리, I/O 상태 확인
     
    vmstat 2 # 2초 간격으로 업데이트

2. 사용자 및 권한 관리

  • whoami: 현재 사용자 확인
     
    whoami
  • id: 사용자 및 그룹 정보 확인
     
    id
  • adduser / useradd: 새 사용자 생성
     
    sudo adduser newuser
  • passwd: 사용자 비밀번호 변경
     
    passwd username
  • chmod: 파일/디렉토리 권한 변경
     
    chmod 755 file_name
  • chown: 파일/디렉토리 소유권 변경
     
    sudo chown user:group file_name

3. 파일 및 디렉토리 관리

  • ls: 디렉토리 목록 확인
    bash
    코드 복사
    ls -l # 상세 정보 출력
  • cp: 파일 복사
    bash
    코드 복사
    cp source_file destination_file
  • mv: 파일 이동 또는 이름 변경
    bash
    코드 복사
    mv old_name new_name
  • rm: 파일 삭제
    bash
    코드 복사
    rm file_name
  • find: 파일 검색
    bash
    코드 복사
    find /path/to/search -name "filename"
  • tar: 파일 압축 및 압축 해제
    bash
    코드 복사
    tar -czvf archive.tar.gz /path/to/files
  • df: 디스크 공간 확인
    bash
    코드 복사
    df -h # 사람이 읽기 쉬운 형식
  • du: 디렉토리 크기 확인
    bash
    코드 복사
    du -sh /path

4. 프로세스 및 작업 관리

  • ps: 현재 실행 중인 프로세스 확인
    bash
    코드 복사
    ps aux # 모든 프로세스 상세 보기
  • kill: 프로세스 종료
    bash
    코드 복사
    kill PID # 특정 PID의 프로세스 종료
  • killall: 특정 이름의 모든 프로세스 종료
    bash
    코드 복사
    killall process_name
  • jobs: 백그라운드 작업 확인
    bash
    코드 복사
    jobs
  • bg / fg: 백그라운드 작업을 제어
    bash
    코드 복사
    fg %1 # 백그라운드 작업을 포그라운드로 이동

5. 네트워크 관리

  • ip: 네트워크 인터페이스 및 IP 주소 관리
    bash
    코드 복사
    ip addr # 네트워크 인터페이스 상태 확인
  • netstat: 네트워크 연결 및 상태 확인
    bash
    코드 복사
    netstat -tuln
  • ping: 네트워크 연결 상태 확인
    bash
    코드 복사
    ping google.com
  • curl / wget: HTTP 요청 및 파일 다운로드
    bash
    코드 복사
  • ssh: 원격 서버 접속
    bash
    코드 복사
    ssh user@remote_host
  • scp: 파일을 원격 서버로 복사
    bash
    코드 복사
    scp file_name user@remote_host:/destination

6. 로그 및 디버깅

  • tail: 파일의 마지막 몇 줄 보기
    bash
    코드 복사
    tail -f /var/log/syslog
  • cat: 파일 내용 출력
    bash
    코드 복사
    cat file_name
  • grep: 텍스트 검색
    bash
    코드 복사
    grep "error" /var/log/syslog
  • less: 큰 파일을 페이지 단위로 보기
    bash
    코드 복사
    less file_name

7. 패키지 관리

  • Debian 계열 (Ubuntu 등):
    • apt:
      bash
      코드 복사
      sudo apt update # 패키지 목록 갱신 sudo apt install package_name sudo apt remove package_name
  • RedHat 계열 (CentOS 등):
    • yum / dnf:
      bash
      코드 복사
      sudo yum install package_name sudo yum remove package_name
  • 도커 관련:
    • docker:
      bash
      코드 복사
      docker ps # 실행 중인 컨테이너 확인 docker images # 도커 이미지 목록 확인

8. 시스템 관리 및 모니터링

  • crontab: 정기 작업 설정
    bash
    코드 복사
    crontab -e # 정기 작업 편집
  • systemctl: 서비스 관리
    bash
    코드 복사
    systemctl start service_name systemctl stop service_name systemctl status service_name
  • journalctl: 시스템 로그 확인
    bash
    코드 복사
    journalctl -u service_name

9. 스크립팅 및 자동화

  • bash 스크립트 사용:
    bash
    코드 복사
    #!/bin/bash echo "Hello, DevOps!"
  • awk: 텍스트 처리
    bash
    코드 복사
    awk '{print $1}' file_name
  • sed: 텍스트 편집
    bash
    코드 복사
    sed 's/old/new/g' file_name

10. 추가 학습 리소스

  • man: 명령어 매뉴얼 확인
    bash
    코드 복사
    man command_name
  • --help: 명령어 도움말 확인
    bash
    코드 복사
    command_name --help

'Cloud' 카테고리의 다른 글

Podman 으로 Zoomoney 프로젝트 배포하기  (0) 2025.03.22
Skopeo  (0) 2025.01.21
Dev-Ops  (0) 2025.01.20
Cloud-Front  (0) 2025.01.15
쿠버네티스  (0) 2024.11.19
 

**쿠버네티스(Kubernetes)**는 컨테이너화된 애플리케이션을 자동으로 배포, 스케일링, 관리하는 오픈소스 컨테이너 오케스트레이션 플랫폼입니다. Google이 처음 개발했으며, 현재는 **Cloud Native Computing Foundation(CNCF)**에서 관리하고 있습니다.

쿠버네티스는 마이크로서비스, 클라우드 네이티브 아키텍처, DevOps 등 현대적인 소프트웨어 개발 방식에서 핵심적인 역할을 합니다.


쿠버네티스의 주요 특징

  1. 컨테이너 오케스트레이션
    • 컨테이너화된 애플리케이션을 클러스터에서 효율적으로 관리.
    • 애플리케이션 컨테이너의 배포, 네트워킹, 스케일링, 유지보수를 자동화.
  2. 확장성
    • 수평 스케일링(컨테이너 복제) 및 수직 스케일링(리소스 증가)을 통해 애플리케이션을 동적으로 확장 가능.
  3. 셀프힐링(Self-healing)
    • 실패한 컨테이너를 자동으로 재시작하거나, 문제가 있는 컨테이너를 교체.
    • 비정상적인 노드에서 실행 중인 컨테이너를 자동으로 종료하고, 대체 가능한 노드로 이동.
  4. 자동화
    • 배포(Deployment): 롤링 업데이트, 블루-그린 배포 등 다양한 전략을 제공.
    • 로드 밸런싱: 트래픽 분산으로 안정적인 서비스 제공.
    • 자동 스케일링: 리소스 사용량에 따라 컨테이너 수를 동적으로 조정.
  5. 플랫폼 독립성
    • 온프레미스, 퍼블릭 클라우드, 하이브리드 환경에서 모두 사용 가능.
    • AWS, Google Cloud, Azure 등 다양한 클라우드 플랫폼을 지원.
  6. 네트워킹
    • 각 컨테이너 간의 통신, 서비스 디스커버리, 로드 밸런싱을 지원.

쿠버네티스의 주요 구성 요소

1. 클러스터

  • 쿠버네티스는 클러스터 환경에서 작동하며, 클러스터는 여러 대의 머신(노드)으로 구성됨.
  • 노드(Node): 작업이 실제로 수행되는 물리적/가상 서버.

2. 마스터 노드(Master Node)

  • 클러스터를 제어하고 관리하는 중심 역할.
  • 주요 컴포넌트:
    • API 서버: 클라이언트 요청을 처리.
    • 스케줄러: 작업을 수행할 노드를 결정.
    • 컨트롤러 매니저: 클러스터 상태를 지속적으로 모니터링하고 원하는 상태로 유지.
    • etcd: 분산 키-값 저장소로 클러스터 상태를 저장.

3. 워커 노드(Worker Node)

  • 애플리케이션이 실제로 실행되는 노드.
  • 주요 컴포넌트:
    • Kubelet: 노드에서 실행 중인 컨테이너를 관리.
    • Kube Proxy: 네트워크 통신을 관리.
    • 컨테이너 런타임: 컨테이너를 실행하기 위한 도구(Docker, containerd 등).

4. 파드(Pod)

  • 쿠버네티스의 최소 배포 단위.
  • 하나 이상의 컨테이너가 실행되며, 동일한 네트워크와 스토리지를 공유.

5. 서비스(Service)

  • 클러스터 내부 또는 외부에서 파드에 안정적으로 접근할 수 있는 방법을 제공.
  • 로드 밸런싱 역할을 수행.

6. 네임스페이스(Namespace)

  • 클러스터를 논리적으로 분리하여 다중 사용자가 독립적인 환경을 사용할 수 있게 함.

7. 배포(Deployment)

  • 애플리케이션 배포, 업데이트, 스케일링, 롤백을 정의하고 관리.

쿠버네티스의 주요 장점

  1. 확장성과 효율성:
    • 쿠버네티스는 큰 규모의 애플리케이션을 효율적으로 관리하며, 애플리케이션을 자동으로 확장 및 축소 가능.
  2. 클라우드 네이티브:
    • 다양한 클라우드 환경과 호환되어 하이브리드 클라우드 전략에 적합.
  3. 자동화된 운영:
    • 수동으로 관리할 필요 없이 애플리케이션을 자동으로 관리.
  4. 유연성:
    • 다양한 컨테이너 런타임 및 클라우드 플랫폼을 지원.
  5. 오픈소스:
    • 커뮤니티 지원 및 지속적인 발전.

'Cloud' 카테고리의 다른 글

Podman 으로 Zoomoney 프로젝트 배포하기  (0) 2025.03.22
Skopeo  (0) 2025.01.21
Dev-Ops  (0) 2025.01.20
Cloud-Front  (0) 2025.01.15
기본적인 DevOps 를 하기위한 리눅스명령어  (0) 2024.11.26

+ Recent posts