-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: remove unused immich.app dns records * refactor: add mich ip as a local * refactor: give all the cloudflare api keys proper names * chore: add example.env for running locally * feat: add r2 bucket and mich r2 cloudflare token * feat: add github org iac for secrets initially * chore: add and tell IDE's to add newlines to end of files * feat: deploy github org iac through github actions * docs: add manual setup steps required for IAC in github actions
- Loading branch information
1 parent
4464fe5
commit 5d80b91
Showing
25 changed files
with
186 additions
and
47 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Editor configuration, see https://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
|
||
[*.{md,mdx}] | ||
max_line_length = off | ||
trim_trailing_whitespace = false | ||
|
||
[*.{yml,yaml}] | ||
quote_type = single |
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,6 @@ | ||
### Project gitignore | ||
.env | ||
|
||
### VisualStudioCode template | ||
.vscode/* | ||
!.vscode/settings.json | ||
|
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,7 @@ | ||
export CLOUDFLARE_ACCOUNT_ID= | ||
export CLOUDFLARE_API_TOKEN= | ||
export TF_STATE_POSTGRES_CONN_STR= | ||
export GITHUB_APP_INSTALLATION_ID= | ||
export GITHUB_APP_ID= | ||
export GITHUB_APP_PEM_FILE= | ||
export GITHUB_OWNER= |
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,15 @@ | ||
# Manual Setup Steps | ||
|
||
This lists all the steps required to manually setup the IAC deployments in Github Actions. | ||
|
||
### Github Secrets | ||
|
||
| Secret | Secret Type | Description | | ||
|-----------------------------|-----------------|-----------------------------------------------------------------------------| | ||
| TF_APP_INSTALLATION_ID | Organisation | The installation ID of the Immich Github App | | ||
| TF_APP_ID | Organisation | The ID of the Immich Github App | | ||
| TF_APP_PEM_FILE | Repo (devtools) | The contents of the PEM file for the Github App | | ||
| TF_APP_GITHUB_OWNER | Organisation | The Github owner of the repository (immich-app) | | ||
| CLOUDFLARE_API_TOKEN | Repo (devtools) | The Cloudflare API token scoped to create new API keys | | ||
| CLOUDFLARE_ACCOUNT_ID | Organisation | The Cloudflare account ID | | ||
| TF_STATE_POSTGRES_CONN_STR | Organisation | The connection string for the Postgres database for Terraform state storage | |
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
locals { | ||
mich_ip = "162.55.86.82" | ||
} |
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,5 @@ | ||
resource "cloudflare_r2_bucket" "tf_state_database_backups" { | ||
account_id = var.cloudflare_account_id | ||
name = "tf-state-database-backups" | ||
location = "weur" | ||
} |
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 |
---|---|---|
|
@@ -10,4 +10,4 @@ terraform { | |
version = "4.34.0" | ||
} | ||
} | ||
} | ||
} |
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,3 @@ | ||
locals { | ||
mich_cidrs = ["162.55.86.82/32"] | ||
} |
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,9 @@ | ||
locals { | ||
cloudflare_account_id = get_env("CLOUDFLARE_ACCOUNT_ID") | ||
cloudflare_api_token = get_env("CLOUDFLARE_API_TOKEN") | ||
} | ||
|
||
inputs = { | ||
cloudflare_account_id = local.cloudflare_account_id | ||
cloudflare_api_token = local.cloudflare_api_token | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
terraform { | ||
backend "pg" { | ||
schema_name = "prod_github_org" | ||
} | ||
required_version = "~> 1.7" | ||
|
||
required_providers { | ||
github = { | ||
source = "integrations/github" | ||
version = "~> 6.0" | ||
} | ||
} | ||
} |
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,3 @@ | ||
provider "github" { | ||
app_auth {} | ||
} |
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,8 @@ | ||
data "terraform_remote_state" "api_keys_state" { | ||
backend = "pg" | ||
|
||
config = { | ||
conn_str = var.tf_state_postgres_conn_str | ||
schema_name = "prod_cloudflare_api_keys" | ||
} | ||
} |
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,5 @@ | ||
resource "github_actions_organization_secret" "cloudflare_api_token_pages_upload" { | ||
secret_name = "CLOUDFLARE_API_TOKEN_PAGES_UPLOAD" | ||
plaintext_value = data.terraform_remote_state.api_keys_state.outputs.terraform_key_cloudflare_pages_upload | ||
visibility = "all" | ||
} |
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,15 @@ | ||
terraform { | ||
source = "." | ||
|
||
extra_arguments custom_vars { | ||
commands = get_terraform_commands_that_need_vars() | ||
} | ||
} | ||
|
||
include "root" { | ||
path = find_in_parent_folders("root.hcl") | ||
} | ||
|
||
dependencies { | ||
paths = ["../../cloudflare/api-keys"] | ||
} |
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 @@ | ||
variable "tf_state_postgres_conn_str" {} |
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