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

feat: deploy bankless.community to cloudflare pages #26

Closed
Closed
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ override.tf.json

# IDE dirs
.idea/

# python
venv/
mklebrasseur marked this conversation as resolved.
Show resolved Hide resolved
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,21 @@ We're currently using Root First structure, meaning each folder contains a compl
├──── cloudflare # Contains DNS Records for BanklessCard.xyz
└── README.md

## Prerequisites

* [Terraform](https://www.terraform.io/downloads.html)
* [pre-commit](https://pre-commit.com/)

Make sure you have `pre-commit`, and `terraform` in your `$PATH`.

## Terraform Cloud

All infrastructure changes will automatically plan but require approval from infosec.bankless.community memeber.

## pre-commit
This repo uses Yelp's [pre-commit](https://pre-commit.com/) to manage some pre-commit hooks automatically.
mklebrasseur marked this conversation as resolved.
Show resolved Hide resolved
In order to use the hooks, make sure you have `pre-commit`, and `terraform` in your `$PATH`.
Once in your path you should run `make` in order to configure it. If you push commits that fail pre-commit, your PR will
not pass tests
Configure pre-commit hooks before making changes.
If you push commits that fail pre-commit, your PR will not pass tests.

```bash
pre-commit install
```
51 changes: 51 additions & 0 deletions bankless-community/cloudflare/pages.tf
mklebrasseur marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
resource "cloudflare_pages_project" "deployment_configs" {
account_id = local.cloudflare_account_id
name = local.cloudflare_account_name
production_branch = "main"

source {
type = "github"
config {
owner = local.cloudflare_account_name
repo_name = "bankless-website"
production_branch = "main"
pr_comments_enabled = true
deployments_enabled = true
production_deployment_enabled = true
preview_deployment_setting = "all"
}
}

build_config {
build_command = "npx next build"
destination_dir = "out"
root_dir = ""
}

deployment_configs {
preview {
environment_variables = {
ENVIRONMENT = "preview"
}
secrets = {
NEXT_PUBLIC_ALCHEMY_API_KEY = var.alchemy_api_key
NEXT_PUBLIC_BLOCKNATIVE_API_KEY = var.blocknative_api_key
NEXT_PUBLIC_INFURA_PROJECT_ID = var.infura_project_id
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID = var.walletconnect_project_id
}
always_use_latest_compatibility_date = true
}
production {
environment_variables = {
ENVIRONMENT = "production"
}
secrets = {
NEXT_PUBLIC_ALCHEMY_API_KEY = alchemy_api_key
NEXT_PUBLIC_BLOCKNATIVE_API_KEY = blocknative_api_key
NEXT_PUBLIC_INFURA_PROJECT_ID = infura_project_id
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID = walletconnect_project_id
}
always_use_latest_compatibility_date = true
}
}
}
4 changes: 4 additions & 0 deletions bankless-community/cloudflare/variables.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
variable "cloudflare_api_token" {
sensitive = true
}
variable "alchemy_api_key" { sensitive = true }
variable "blocknative_api_key" { sensitive = true }
variable "infura_project_id" { sensitive = true }
variable "walletconnect_project_id" { sensitive = true }
Loading