반응형

 

Docker 및 Ctr 로 하는 법 -

2024.04.10 - [Develop/기타 작업] - Docker architecture, save, load, tag 및 ctr tag, export, import, push

 

buildah 에서 docker save, ctr export 과 같은 이미지를 로컬에 저장하고 싶으면,

buildah push 명령어를 사용하면된다.

# buildah push <image-id> oci-archive:/경로/이미지.tar:tag
buildah push 5854065bab5a oci-archive:/root/test.tar:latest

 

이후 ctr image imports 나 docker load 등으로 이미지를 올린 후 조회하면, 아래와 import-yyyy-mm-dd같이 나온다.

docker.io/library/import-2025-03-18 

crictl images
IMAGE                                                TAG                 IMAGE ID            SIZE
docker.io/library/import-2025-03-18                  latest              5854065bab5af       62.9MB

 

적절히 변경하여 사용한다.

 

기타 : buildah 로 push 후 ctr 로 업로드하면 crictl에 조회는 되지만 태그 변경이 안되는데,

이 경우 ctr imge list 로 조회 후 정확한 이름을 찾아서 변경하면된다.

(기본적으로 변경시 Source가 docker.io/library/import-2025-03-18 이 아닌 import-2025-03-18 로 Source를 선택 후

태그를 변경하면된다.

 

반응형
반응형

 

Git 저장소 릴리즈 알림이다.

개인의 경우 Github의 Watch 기능을 이용하면 알림을 받을 수 있지만,

해당기능은 개인만 받는것이 아닌 다수가 메일 또는 슬랙으로 받을 수 있으며,

알림 받기를 원하는 저장소를 통합해서 관리할 수 있음.

 

 

Github actions 또는 k8s cronjob 등으로 동작 가능하다.

 

소스코드 및 사용법 : https://github.com/wonkwangyeon/git-release-notify

 

  • 개발할 경우 root 경로에 _env 파일을 .env로 수정 후 아래 환경변수 세팅
  • Github Actions로 사용시 repository secrets 및 env 설정
  • k8s CronJob 일 경우 DockerBuild 하여 yaml 생성 후 사용
Option Description Required
GIT_URL 알림받을 GIT_URL https://github.com/~~~/release
MAIL_ENABLED 메일 전송 활성화/비활성화 true/false
SMTP_SERVER SMTP 서버 smtp.test.com
SMTP_PORT STMP 포트 123
SMTP_TLS SMTP TLS 설정 false
SMTP_USER STMP 사용자 및 송신자 test_user
SMTP_PASSWORD SMTP 비밀번호 1234
RECEIVER 수신자 test1@test.com
SLACK_ENABLED 슬랙 전송 활성화/비활성화 true/false
SLACK_WEBHOOK_URL 슬랙 URL test.com
# GIT_URL은 반드시 release로 끝나는 url이여야 함. 여러Repo 입력시 아래와 같이 입력.
GIT_URL="https://github.com/wonkwangyeon/git-release-notify/releases
https://github.com/wonkwangyeon/Run-Multiple-Program/releases"
MAIL_ENABLED=true
SMTP_SERVER="smtp.test.com"
SMTP_PORT=123
SMTP_TLS=false
SMTP_USER="test@test.com"
SMTP_PASSWORD=""
# Receiver가 한명일 경우 test@test.com 하나만 입력. 여러명일 경우 ','로 구분해서 나열
RECEIVER="test@test.com,testuser2@test.com"
SLACK_ENABLED=false
SLACK_WEBHOOK_URL=""

 

 

k8s cronjob

## docker build
docker build -t git-release-notify:latest .

## cronjon.yaml
apiVersion: batch/v1
kind: CronJob
metadata:
  name: git-release-notify
spec:
  schedule: "0 9 * * *"
  jobTemplate:
    spec:
      template:
        spec:
          containers:
          - name: git-release-notify
            image: git-release-notify:latest
            imagePullPolicy: IfNotPresent
            env:
            - name: GIT_URL
              value: ""
            - name: MAIL_ENABLED
              value: ""
            - name: SMTP_SERVER
              value: ""
            - name: SMTP_PORT
              value: ""
            - name: SMTP_TLS
              value: ""
            - name: SMTP_USER
              value: ""
            - name: SMTP_PASSWORD
              value: ""
            - name: RECEIVER
              value: ""
            - name: SLACK_ENABLED
              value: ""
            - name: SLACK_WEBHOOK_URL
              value: ""
          restartPolicy: OnFailure

 

반응형
반응형

 

OpenSearch URL을 직접 호출하는게 아닌, OpenSearch Dashboards URL을 호출하여 OpenSearch API를 사용할 수 있다.

/api/console/proxy 를 호출하여 사용하면된다.

curl -u admin:password -H "osd-xsrf: true" -H "Content-Type: application/json" -XPOST "http://os-dashboard.wky.kr:30080/api/console/proxy?path=_cluster/health&method=GET"
## 결과
{"cluster_name":"opensearch-cluster","status":"yellow","timed_out":false,"number_of_nodes":1,"number_of_data_nodes":1,"discovered_master":true,"discovered_cluster_manager":true,"active_primary_shards":9,"active_shards":9,"relocating_shards":0,"initializing_shards":0,"unassigned_shards":2,"delayed_unassigned_shards":0,"number_of_pending_tasks":0,"number_of_in_flight_fetch":0,"task_max_waiting_in_queue_millis":0,"active_shards_percent_as_number":81.81818181818183}

 

반응형

+ Recent posts