Deploy a C# Container Instance in Azure
Azure에서 Terraform을 사용하여 IronSecureDoc Docker 컨테이너를 배포하고 공용 IP 주소 및 FQDN으로 사용할 수 있게 만드세요.
필수 조건
1단계: GitHub 리포지토리 템플릿 복제
여기에서 바로 복제하고 시작할 수 있는 GitHub 저장소 템플릿이 준비되어 있습니다.
https://github.com/iron-software/IronSecureDoc-Terraform/
2단계: 모든 리소스 이름 수정
variables.tf에서 모든 리소스 이름 수정
resource_group_name: 리소스 그룹의 이름.resource_group_location: 리소스 그룹의 위치.REGIONS.md에서 지역을 찾고 두 번째 열을 사용하여 이 변수를 채울 수 있습니다.container_group_name: 컨테이너 그룹의 이름.container_name: 컨테이너의 이름.image_tag: 배포할 이미지의 태그; 이는latest또는 특정 버전 번호일 수 있습니다.- 다른 변수들은 변경할 필요가 없습니다.
모든 민감한 데이터를 포함할 수 있도록 secret.tfvars 생성
secret.tfvars에 다음 변수를 채우세요.
Azure 컨테이너 레지스트리
dns_name_label = var.dns_name_label 뒤에 main.tf를 추가하세요:
image_registry_credential {
server = var.registry_server
username = var.registry_username
password = var.registry_password
}
variables.tf에 추가하세요:
variable "registry_server" {
type = string
sensitive = false
description = "The server for the container registry. Required if the image is stored in a private registry."
}
variable "registry_username" {
type = string
sensitive = true
description = "Username for the container registry. Required if the image is stored in a private registry."
}
variable "registry_password" {
type = string
sensitive = true
description = "Password for the container registry. Required if the image is stored in a private registry."
}
secret.tfvars에 추가하세요:
registry_server = "<registry-name>.azurecr.io"
registry_username = "YOUR-REGISTRY-USERNAME"
registry_password = "YOUR-REGISTRY-PASSWORD"
license_key = "YOUR-LICENSE-KEY"
Docker 허브
secret.tfvars에 추가하세요:
license_key = "YOUR-LICENSE-KEY"
3단계: Terraform 초기화
Terraform 배포를 초기화하려면 terraform init을 실행하세요. 이 명령은 Azure 리소스를 관리하는 데 필요한 Azure 공급자를 다운로드합니다.
terraform init -upgrade
4단계: Terraform 실행 계획 생성
terraform plan을 실행하여 실행 계획을 생성하세요.
terraform plan -var-file="secret.tfvars" -out main.tfplan
5단계: Terraform 실행 계획 적용
terraform apply을 실행하여 실행 계획을 클라우드 인프라에 적용하세요.
terraform apply main.tfplan
6단계: 결과 확인
-
실행 계획을 적용하면 Terraform은 공용 IP 주소를 출력합니다. IP 주소를 다시 표시하려면
terraform output을 실행하세요.terraform output -raw container_ipv4_addressSHELL또는 FQDN을 표시합니다.
terraform output -raw container_fqdnSHELL -
검증하려면 Postman이나
curl을 사용하세요. 기대되는 결과는pong를 반환해야 합니다.curl http://<container_ipv4_address>:8080/v1/document-services/pingSHELL또는 FQDN을 사용하세요.
curl http://<container_fqdn>:8080/v1/document-services/pingSHELL
7단계: 자원을 파괴합니다
-
리소스를 삭제하기 위한 실행 계획을 수립하십시오.
terraform plan -destroy -var-file="secret.tfvars" -out main.tfplanSHELL -
실행 파괴 계획을 적용합니다.
terraform apply main.tfplanSHELL
자주 묻는 질문
Terraform을 사용하여 Azure에서 Docker 컨테이너를 배포하려면 어떻게 해야 하나요?
Terraform을 사용하여 Azure에서 Docker 컨테이너를 배포하려면 IronSecureDoc에 대한 GitHub 저장소 템플릿을 복제하고, `variables.tf`에서 리소스 이름을 수정한 후, 민감한 데이터를 담은 `secret.tfvars` 파일을 만들어야 합니다. 그런 다음, terraform init로 배포를 초기화하고, terraform plan 및 terraform apply를 사용하여 실행 계획을 생성하고 적용합니다.
Azure 배포를 위해 Terraform을 설정하는 데 필요한 단계는 무엇인가요?
먼저, Terraform을 설치하고 구성한 다음 Azure에 인증합니다. IronSecureDoc에 대한 특정 GitHub 저장소를 복제하고, `variables.tf` 파일에서 리소스 이름을 수정하고, 민감한 데이터는 `secret.tfvars`에서 관리합니다. 마지막으로 Terraform을 초기화하고 배포를 위한 실행 계획을 생성합니다.
이번 배포에서 Azure Container Registry의 역할은 무엇인가요?
Azure Container Registry는 Docker 이미지를 저장하는 데 사용됩니다. `main.tf` 파일에 레지스트리 자격 증명을 추가하고 `variables.tf` 및 `secret.tfvars`에 레지스트리 정보를 명시하여 배포에서 필요한 Docker 이미지를 접근하고 배포할 수 있도록 합니다.
Azure에서 Terraform 배포가 성공했는지 어떻게 확인할 수 있나요?
Terraform 실행 계획을 적용한 후, terraform output을 실행하여 공용 IP 주소나 FQDN을 가져옵니다. Postman이나 curl과 같은 도구를 사용하여 서비스에 핑 요청을 보냅니다. 성공적인 배포는 'pong'을 반환합니다.
Azure 배포를 위해 Terraform을 초기화하는 데 사용되는 명령어는 무엇인가요?
Azure 배포를 위해 Terraform을 초기화하려면 terraform init -upgrade 명령어를 사용합니다. 이는 Azure 리소스를 관리하는 데 필요한 공급자 플러그인을 다운로드합니다.
Terraform 설정에서 민감한 데이터를 어떻게 처리하나요?
레지스트리 자격 증명과 라이선스 키 같은 민감한 데이터는 `secret.tfvars` 파일에 저장해야 합니다. 이 파일은 Terraform 계획 및 적용 과정에서 참조되어 민감한 정보를 안전하게 관리합니다.
Terraform을 사용하여 Azure에서 배포된 리소스를 제거하는 절차는 무엇인가요?
Terraform을 사용하여 Azure에서 배포된 리소스를 제거하려면 terraform plan -destroy -var-file='secret.tfvars' -out main.tfplan으로 제거 실행 계획을 생성한 다음 terraform apply main.tfplan을 사용하여 적용합니다.
How can I verify the deployment of the IronSecureDoc container?
You can verify the deployment by running `terraform output` to obtain the public IP or FQDN and using tools like Postman or `curl` to execute a ping, expecting a `pong` response.
What is the process to destroy the IronSecureDoc resources on Azure?
To destroy the resources, create a destroy execution plan with `terraform plan -destroy` and then apply it using `terraform apply` to remove IronSecureDoc resources from Azure.
Can I specify the tag of the IronSecureDoc Docker image during deployment?
Yes, you can specify the tag of the IronSecureDoc Docker image by setting the `image_tag` variable in the `variables.tf` file, using either `latest` or a specific version number.

커티스 차우는 칼턴 대학교에서 컴퓨터 과학 학사 학위를 취득했으며, Node.js, TypeScript, JavaScript, React를 전문으로 하는 프론트엔드 개발자입니다. 직관적이고 미적으로 뛰어난 사용자 인터페이스를 만드는 데 열정을 가진 그는 최신 프레임워크를 활용하고, 잘 구성되고 시각적으로 매력적인 매뉴얼을 제작하는 것을 즐깁니다.