-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TFでポータルサイトを自動構築する部分はできた。あとはベンチマーカーがAPI Gatewayに結果を送信する部分
- Loading branch information
Showing
16 changed files
with
387 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
.terraform | ||
terraform.tfstate* | ||
*terraform.tfstate* | ||
*.py | ||
*.zip | ||
*.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,19 @@ | ||
# terraform | ||
# Terraform | ||
|
||
## 概要 | ||
|
||
terraformでISHOCON1の環境が構築できます。 | ||
TerraformでISHOCON1の環境が構築できます。 | ||
社内ISUCON等のコンテストの開催準備として使うと便利です。 | ||
開催者(以下admins)と参加者(以下teams)のロールに分けて、サーバーを複数台準備できます。 | ||
|
||
## 作成されるもの | ||
* チーム毎に1台の競技に使用するEC2インスタンス | ||
* 各チームのスコアがリアルタイムに見れるポータルサイト | ||
|
||
## 必要なもの | ||
|
||
- 支払情報が紐付けされたAWSアカウント | ||
- ポータルサイトは低コストになるように実装していますが、主に以下の費用がかかります。 | ||
- DynamoDB, Lambda, CloudWatch, API Gateway, S3 | ||
- IAMユーザのアクセスIDとシークレットアクセスキー | ||
|
||
## 手順 | ||
|
@@ -40,9 +45,20 @@ $ ssh -T [email protected] | |
```shell | ||
$ cd main | ||
$ terraform apply | ||
|
||
... | ||
|
||
Outputs: | ||
|
||
apigateway_url = "https://123456789.execute-api.ap-northeast-1.amazonaws.com/" | ||
ip_addr = { | ||
"team1" = "11.111.111.111" | ||
"team2" = "11.111.111.112" | ||
} | ||
portal_url = "http://ishocon1-portal123456789.s3-website-ap-northeast-1.amazonaws.com" | ||
``` | ||
|
||
outputに競技で使用するインスタンスのIPアドレスが出力されるので、参加者に共有する。 | ||
Outputに競技で使用するインスタンスのIPアドレスとポータルサイトのアドレスが出力されるので、参加者に共有する。 | ||
|
||
``` | ||
$ ssh ishocon@<instance_ip> | ||
|
@@ -53,5 +69,5 @@ $ ssh ishocon@<instance_ip> | |
## 注意点 | ||
|
||
- デフォルトでは、ISHOCON1の推奨インスタンスタイプである `c7i.xlarge` でインスタンスが起動します | ||
- このterraformを使用することで発生した問題に対して責任は一切取りません | ||
- このTerraformを使用することで発生した問題に対して責任は一切取りません | ||
- コードをよく読んだ上で、自己責任でご使用ください |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,11 @@ | ||
output "ip_addr" { | ||
value = module.main.ip_addr | ||
} | ||
|
||
output "portal_url" { | ||
value = module.main.portal_url | ||
} | ||
|
||
output "apigateway_url" { | ||
value = module.main.apigateway_url | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
data "aws_caller_identity" "current" {} | ||
data "aws_region" "current" {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,14 @@ | ||
output "ip_addr" { | ||
value = { | ||
for team in local.team_list : | ||
team => try(aws_instance.main[team]["public_ip"] , aws_spot_instance_request.main[team]["public_ip"]) | ||
team => try(aws_instance.main[team]["public_ip"], aws_spot_instance_request.main[team]["public_ip"]) | ||
} | ||
} | ||
|
||
output "portal_url" { | ||
value = "http://${aws_s3_bucket_website_configuration.portal.website_endpoint}" | ||
} | ||
|
||
output "apigateway_url" { | ||
value = aws_apigatewayv2_stage.portal.invoke_url | ||
} |
Oops, something went wrong.