From 2e1c246aeacbbb88be4b5b4dda1dc5d64b59ef69 Mon Sep 17 00:00:00 2001 From: Vitor Hideyoshi Date: Sat, 14 Oct 2023 22:37:17 -0300 Subject: [PATCH 1/3] Adds Example of Secrets File --- .gitignore | 1 + env.example.json | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 env.example.json diff --git a/.gitignore b/.gitignore index 585e3ad..382902f 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ .vscode/ **/*.json +!**/*.example.json **/cert-manager-certificate.yaml diff --git a/env.example.json b/env.example.json new file mode 100644 index 0000000..1533946 --- /dev/null +++ b/env.example.json @@ -0,0 +1,39 @@ +{ + "backendSecret": { + "tokenSecret": "", + "accessTokenDuration": "", + "refreshTokenDuration": "", + "defaultUserFullName": "", + "defaultUserEmail": "", + "defaultUserUsername": "", + "defaultUserPassword": "", + "googleClientId": "", + "googleClientSecret": "", + "googleRedirectUrl": "", + "githubClientId": "", + "githubClientSecret": "", + "githubRedirectUrl": "" + }, + "frontendSecret": { + "frontendPath": "", + "backendUrl": "", + "backendOAuthUrl": "" + }, + "postgresSecret": { + "postgresDatabase": "", + "postgresUser": "", + "postgresPassword": "" + }, + "redisSecret": { + "redisPassword": "" + }, + "storageSecret": { + "storageType": "", + "awsAccessKeyId": "", + "awsSecretAccessKey": "", + "awsRegion": "", + "awsBucket": "", + "virusCheckerType": "", + "virusCheckerApiKey": "" + } +} \ No newline at end of file From 4f1560f6919280767f7666cd28e31fd7767165bb Mon Sep 17 00:00:00 2001 From: Vitor Hideyoshi Date: Sat, 14 Oct 2023 22:47:51 -0300 Subject: [PATCH 2/3] Basic README Implementation --- README.md | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7d5151f..5df62ed 100644 --- a/README.md +++ b/README.md @@ -1 +1,25 @@ -# infra-kubernetes +# infra-hideyoshi.com + +## How to Configure + +- Requirements: + + This project requires a working kubernetes cluster, in case of a testing environment a minikube cluster will by configured for you, otherwise a kubernetes will not be configured. + +- Configuring Secrets: + + ``` + python -m pip install --upgrade pip pipenv + pipenv install + pipenv run python setup.py -e prod -f config.json + ``` + +- Running Kubernetes Application: + + ``` + sudo apt update && sudo apt install -y jq python3-pip + cd infra-hideyoshi.com + ./deploy.sh {{environmet-flag}} + ``` + + `{{environment-flag}}`: `--test`, `--staging`, `--prod` From 27e18611f80cbcd99a834f4230d2e6166bc69ee5 Mon Sep 17 00:00:00 2001 From: Vitor Hideyoshi Date: Sat, 14 Oct 2023 22:52:10 -0300 Subject: [PATCH 3/3] Updates Scripts Run Options --- README.md | 6 ++++-- deploy.sh | 2 +- setup.py | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5df62ed..485d9db 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ ``` python -m pip install --upgrade pip pipenv pipenv install - pipenv run python setup.py -e prod -f config.json + pipenv run python setup.py -e {{environment-option}} -f config.json ``` - Running Kubernetes Application: @@ -22,4 +22,6 @@ ./deploy.sh {{environmet-flag}} ``` - `{{environment-flag}}`: `--test`, `--staging`, `--prod` + `{{environment-flag}}` : `--local`, `--staging`, `--prod` + + `{{environment-option}` : `local`, `staging`, `prod` diff --git a/deploy.sh b/deploy.sh index 7097ef0..9c8eb9a 100755 --- a/deploy.sh +++ b/deploy.sh @@ -67,7 +67,7 @@ function application_deploy() { function main() { - if [[ $1 == "--test" || $1 == "-t" ]]; then + if [[ $1 == "--local" || $1 == "-l" ]]; then function kubectl { minikube kubectl -- $@ diff --git a/setup.py b/setup.py index c93cdc5..d9466b7 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ def write_template(template: str, output: str): output.write(envsubst(template.read())) def configure_templates(environment: str): - if not environment in ("prod", "staging", "local", "dev"): + if not environment in ("prod", "staging", "local"): raise ValueError("Invalid Environment Selected") match environment: