From 425291f8383f445782c92178791e1534ee3b8ceb Mon Sep 17 00:00:00 2001 From: yoonseopkim Date: Sat, 21 Dec 2024 16:20:21 +0900 Subject: [PATCH] =?UTF-8?q?fix=20:=20=EB=8F=84=EC=BB=A4=EC=BB=B4=ED=8F=AC?= =?UTF-8?q?=EC=A6=88=20ecr=20=EC=97=90=20=EB=A7=9E=EA=B2=8C=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Ansible/argocd.yaml | 68 ++++++++++++++++++ Ansible/instances.json | 8 +++ Docker/back/docker-compose.back.yaml | 102 +++++++++++++++++++++++---- Terraform/output.tf | 4 ++ 4 files changed, 170 insertions(+), 12 deletions(-) create mode 100644 Ansible/argocd.yaml diff --git a/Ansible/argocd.yaml b/Ansible/argocd.yaml new file mode 100644 index 0000000..461eada --- /dev/null +++ b/Ansible/argocd.yaml @@ -0,0 +1,68 @@ +--- +- name: Install ArgoCD on Dedicated Instance + hosts: argocd + become: yes + tasks: + # 시스템 업데이트 및 기본 패키지 설치 + - name: Update system packages + dnf: + name: '*' + state: latest + update_only: yes + + - name: Install required packages + dnf: + name: + - git + - curl + - wget + - docker + state: present + + # Docker 서비스 활성화 + - name: Start and enable Docker service + systemd: + name: docker + state: started + enabled: yes + + - name: Add ec2-user to docker group + user: + name: ec2-user + groups: docker + append: yes + + # ArgoCD CLI 설치 + - name: Download ArgoCD CLI + get_url: + url: https://github.com/argoproj/argo-cd/releases/latest/download/argocd-linux-amd64 + dest: /usr/local/bin/argocd + mode: '0755' + + # ArgoCD 서버 컨테이너 실행 + - name: Run ArgoCD Server + docker_container: + name: argocd-server + image: quay.io/argoproj/argocd:latest + state: started + restart_policy: always + ports: + - "9000:8080" # HTTP + - "9443:8080" # HTTPS + volumes: + - /home/ec2-user/argocd:/home/argocd + env: + ARGOCD_SERVER_INSECURE: "true" # 개발 환경용, 프로덕션에서는 false로 설정 + + # 초기 비밀번호 저장 + - name: Wait for ArgoCD to be ready + wait_for: + port: 9000 + timeout: 300 + + - name: Store default admin password + aws_ssm_parameter_store: + name: /gitfolio/argocd/admin/password + value: "admin" # 기본 비밀번호, 나중에 변경 필요 + string_type: SecureString + region: ap-northeast-2 \ No newline at end of file diff --git a/Ansible/instances.json b/Ansible/instances.json index 9fc6452..12e7398 100644 --- a/Ansible/instances.json +++ b/Ansible/instances.json @@ -110,5 +110,13 @@ "Service": "jenkins", "Type": "ec2", "Environment": "feature-cicd" + }, + { + "Name": "Gitfolio Argocd", + "InstanceId": "i-0d90c5a4633f18ed1", + "IP": "10.0.108.124", + "Service": "argocd", + "Type": "ec2", + "Environment": "feature-cicd" } ] diff --git a/Docker/back/docker-compose.back.yaml b/Docker/back/docker-compose.back.yaml index d277d7e..28ca49c 100644 --- a/Docker/back/docker-compose.back.yaml +++ b/Docker/back/docker-compose.back.yaml @@ -1,7 +1,8 @@ +# 1번 모듈 services: auth: platform: linux/amd64 - image: aida0/gitfolio_auth:test + image: 727646500036.dkr.ecr.ap-northeast-2.amazonaws.com/gitfolio/auth:dev container_name: gitfolio_auth ports: - target: 8080 @@ -10,15 +11,11 @@ services: - target: 8080 published: 443 protocol: tcp - - target: 8080 - published: 5000 - protocol: tcp networks: - back - member: platform: linux/amd64 - image: aida0/gitfolio_member:test + image: 727646500036.dkr.ecr.ap-northeast-2.amazonaws.com/gitfolio/member:dev container_name: gitfolio_member ports: - target: 8080 @@ -27,13 +24,94 @@ services: - target: 8080 published: 444 protocol: tcp + networks: + - back +networks: + back: + driver: bridge + attachable: true + +#2번 모듈 +services: + resume: + platform: linux/amd64 + image: 727646500036.dkr.ecr.ap-northeast-2.amazonaws.com/gitfolio/resume:dev + container_name: gitfolio_resume + ports: + - target: 8080 + published: 80 + protocol: tcp + - target: 8080 + published: 443 + protocol: tcp + networks: + - back + payment: + platform: linux/amd64 + image: 727646500036.dkr.ecr.ap-northeast-2.amazonaws.com/gitfolio/payment:dev + container_name: gitfolio_payment + ports: - target: 8080 - published: 5000 + published: 81 + protocol: tcp + - target: 8080 + published: 444 + protocol: tcp + networks: + - back +networks: + back: + driver: overlay + attachable: true + +#3번모듈 +services: + notification: + platform: linux/amd64 + image: 727646500036.dkr.ecr.ap-northeast-2.amazonaws.com/gitfolio/notification:dev + container_name: gitfolio_notification + ports: + - target: 8080 + published: 80 + protocol: tcp + - target: 8080 + published: 443 + protocol: tcp + networks: + - back + zookeeper: + platform: linux/amd64 + image: zookeeper:3.6 + container_name: gitfolio_zookeeper + ports: + - target: 2181 + published: 2181 + protocol: tcp + volumes: + - zookeeper_data:/var/lib/zookeeper/data + networks: + - back + kafka: + platform: linux/amd64 + image: confluentinc/cp-kafka:7.4.0 + container_name: gitfolio_kafka + ports: + - target: 9092 + published: 9092 + protocol: tcp + - target: 29092 + published: 29092 protocol: tcp + depends_on: + - zookeeper + volumes: + - kafka_data:/var/lib/kafka/data networks: - back - - networks: - back: - driver: overlay - attachable: true \ No newline at end of file +volumes: + zookeeper_data: + kafka_data: +networks: + back: + driver: overlay + attachable: true \ No newline at end of file diff --git a/Terraform/output.tf b/Terraform/output.tf index 49e2f99..1404094 100644 --- a/Terraform/output.tf +++ b/Terraform/output.tf @@ -32,3 +32,7 @@ output "nosql_id" { description = "ID of the NoSQL instance" value = local.shared ? module.gitfolio_nosql[*].nosql_id : null } +output "jenkins_instance_id" { + description = "The ID of the Jenkins EC2 instance" + value = terraform.workspace == "feature-cicd" ? module.gitfolio_cicd[0].jenkins_instance_id : null +} \ No newline at end of file