Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add VITE_CLERK_PUBLISHABLE_KEY and refine terraform code for release #220

Merged
merged 4 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.production
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
VITE_API_BASE_URL=https://api.restaking.info
VITE_CLERK_PUBLISHABLE_KEY=pk_test_b3B0aW1hbC1jaGlja2VuLTU3LmNsZXJrLmFjY291bnRzLmRldiQ
VITE_LOG_LEVEL=info
35 changes: 34 additions & 1 deletion terraform/Amplify/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
resource "aws_amplify_app" "main" {
name = "restaking-dashboard"
name = "restaking-dashboard-app"
repository = "https://github.com/NethermindEth/restaking-dashboard"

environment_variables = {
Expand All @@ -16,11 +16,23 @@ resource "aws_amplify_app" "main" {
status = "200"
target = "/index.html"
}
# It is required when first time to deploy the app
# oauth_token = var.github_oauth_token

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is permanently commented out from now onwards, I don't think it's necessary to be included in our codebase

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is a hint for next time redeploy production, such as aws account. I spent several hours to figure it out, so I decide to keep it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO it should be in a dedicated README.md or a run book / run script instead of it being a file but with its contents commented out. But yeah its not a blocker.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accept it. Remove the file and comments

}

resource "aws_amplify_branch" "main" {
app_id = aws_amplify_app.main.id
branch_name = "main"
stage = "DEVELOPMENT"

enable_auto_build = false
PhilexWong marked this conversation as resolved.
Show resolved Hide resolved
}

# Release branch for production environment
resource "aws_amplify_branch" "release" {
app_id = aws_amplify_app.main.id
branch_name = "release/v0.1.0"
stage = "PRODUCTION"

enable_auto_build = false
Expand All @@ -37,6 +49,21 @@ resource "aws_amplify_domain_association" "main" {
branch_name = aws_amplify_branch.main.branch_name
prefix = "stage"
}

# add this for pre-production domain
# https://prod.restaking.info
sub_domain {
branch_name = aws_amplify_branch.release.branch_name
prefix = "prod"
}

# add this for production domain
# https://restaking.info
sub_domain {
branch_name = aws_amplify_branch.release.branch_name
prefix = ""
}

}


Expand All @@ -46,3 +73,9 @@ resource "aws_amplify_webhook" "stage" {
description = "stage"
}


resource "aws_amplify_webhook" "release" {
app_id = aws_amplify_app.main.id
branch_name = aws_amplify_branch.release.branch_name
description = "release"
}
8 changes: 8 additions & 0 deletions terraform/Amplify/output.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

output "aws_amplify_domain_association" {
value = aws_amplify_domain_association.main.sub_domain
}

output "aws_amplify_webhook"{
value = aws_amplify_webhook.stage.url
}
6 changes: 6 additions & 0 deletions terraform/Amplify/var.tf
Copy link
Collaborator

@vincenthongzy vincenthongzy Oct 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this whole file is permanently commented out from now onwards, I don't think it's necessary to be included in our codebase

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is a hint for next time redeploy production, such as aws account. I spend several hours to figure it out, so I decide to keep it.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#When tHe first time to deploy, github Oauth token is required
#variable "github_oauth_token" {
# description = "GitHub OAuth Token for Amplify"
# type = string
# sensitive = true
#}