Merge pull request #28 from HideyoshiNakazone/adds-storage-service
Fixes Storage Service Integration
This commit is contained in:
@@ -23,6 +23,13 @@ function application_deploy() {
|
||||
|
||||
kubectl apply -f ./deployment/portfolio-namespace.yaml;
|
||||
|
||||
|
||||
kubectl apply -f ./deployment/postgres/postgres-secret.yaml;
|
||||
kubectl apply -f ./deployment/redis/redis-secret.yaml;
|
||||
kubectl apply -f ./deployment/storage/storage-secret.yaml;
|
||||
kubectl apply -f ./deployment/backend/backend-secret.yaml;
|
||||
kubectl apply -f ./deployment/frontend/frontend-secret.yaml;
|
||||
|
||||
kubectl apply -f \
|
||||
./deployment/cert-manager/cert-manager-certificate.yaml;
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ spec:
|
||||
containers:
|
||||
- name: backend
|
||||
image: yoshiunfriendly/backend-hideyoshi.com
|
||||
imagePullPolicy: "Always"
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 8070
|
||||
env:
|
||||
@@ -155,12 +155,21 @@ spec:
|
||||
name: redis-secret
|
||||
key: redis-password
|
||||
|
||||
- name: STORAGE_SERVICE_PATH
|
||||
- name: STORAGE_SERVICE_URL
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: storage-secret
|
||||
configMapKeyRef:
|
||||
name: storage-config
|
||||
key: storage_url
|
||||
|
||||
- name: STORAGE_SERVICE_PORT
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: storage-config
|
||||
key: storage_port
|
||||
|
||||
- name: STORAGE_SERVICE_PATH
|
||||
value: "http://$(STORAGE_SERVICE_URL):$(STORAGE_SERVICE_PORT)"
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
|
||||
19
setup.py
19
setup.py
@@ -5,7 +5,6 @@ from pathlib import Path, PosixPath
|
||||
import argparse
|
||||
import os
|
||||
|
||||
|
||||
ENV_VARIABLES = [
|
||||
"FRONTEND_PATH",
|
||||
"BACKEND_URL",
|
||||
@@ -35,7 +34,6 @@ ENV_VARIABLES = [
|
||||
"AWS_BUCKET_NAME",
|
||||
]
|
||||
|
||||
|
||||
FORCE_BASE64_FIELD = [
|
||||
"OAUTH_GITHUB_CLIENT_ID",
|
||||
"OAUTH_GITHUB_CLIENT_SECRET",
|
||||
@@ -67,17 +65,14 @@ def setting_environment(environment: str):
|
||||
|
||||
match environment:
|
||||
case "staging":
|
||||
DOMAIN="staging.hideyoshi.com.br"
|
||||
API_DOMAIN="api.staging.hideyoshi.com.br"
|
||||
STORAGE_API_DOMAIN="storage.staging.hideyoshi.com.br"
|
||||
DOMAIN = "staging.hideyoshi.com.br"
|
||||
API_DOMAIN = "api.staging.hideyoshi.com.br"
|
||||
case _:
|
||||
DOMAIN="hideyoshi.com.br"
|
||||
API_DOMAIN="api.hideyoshi.com.br"
|
||||
STORAGE_API_DOMAIN="storage.hideyoshi.com.br"
|
||||
DOMAIN = "hideyoshi.com.br"
|
||||
API_DOMAIN = "api.hideyoshi.com.br"
|
||||
|
||||
os.environ["DOMAIN"] = DOMAIN
|
||||
os.environ["API_DOMAIN"] = API_DOMAIN
|
||||
os.environ["STORAGE_API_DOMAIN"] = STORAGE_API_DOMAIN
|
||||
|
||||
|
||||
def load_secret_file(file: str):
|
||||
@@ -102,8 +97,8 @@ def envsubst_file(file: PosixPath):
|
||||
with open(file) as f:
|
||||
formated_file = envsubst(f.read())
|
||||
|
||||
new_file = Path("deployment")\
|
||||
.joinpath(*[part.split('.')[0] for part in file.parts if part != "template"])\
|
||||
new_file = Path("deployment") \
|
||||
.joinpath(*[part.split('.')[0] for part in file.parts if part != "template"]) \
|
||||
.with_suffix(".yaml")
|
||||
|
||||
with open(new_file, 'w') as f:
|
||||
@@ -143,4 +138,4 @@ if __name__ == "__main__":
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
main(**vars(args))
|
||||
main(**vars(args))
|
||||
|
||||
@@ -7,7 +7,6 @@ spec:
|
||||
dnsNames:
|
||||
- ${DOMAIN}
|
||||
- ${API_DOMAIN}
|
||||
- ${STORAGE_API_DOMAIN}
|
||||
secretName: letsencrypt-cluster-certificate-tls
|
||||
issuerRef:
|
||||
name: cluster-certificate-issuer
|
||||
|
||||
@@ -16,13 +16,6 @@ spec:
|
||||
- host: ${DOMAIN}
|
||||
http:
|
||||
paths:
|
||||
- path: /api/storage
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: storage-service
|
||||
port:
|
||||
number: 8000
|
||||
- path: /api(/|$)(.*)
|
||||
pathType: Prefix
|
||||
backend:
|
||||
@@ -32,13 +25,6 @@ spec:
|
||||
number: 8070
|
||||
- http:
|
||||
paths:
|
||||
- path: /api/storage
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: storage-service
|
||||
port:
|
||||
number: 8000
|
||||
- path: /api(/|$)(.*)
|
||||
pathType: Prefix
|
||||
backend:
|
||||
|
||||
@@ -12,7 +12,6 @@ spec:
|
||||
- hosts:
|
||||
- ${DOMAIN}
|
||||
- ${API_DOMAIN}
|
||||
- ${STORAGE_API_DOMAIN}
|
||||
secretName: letsencrypt-cluster-certificate-tls
|
||||
rules:
|
||||
- host: ${DOMAIN}
|
||||
@@ -35,16 +34,6 @@ spec:
|
||||
name: backend-service
|
||||
port:
|
||||
number: 8070
|
||||
- host: ${STORAGE_API_DOMAIN}
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: storage-service
|
||||
port:
|
||||
number: 8000
|
||||
- http:
|
||||
paths:
|
||||
- path: /
|
||||
|
||||
@@ -5,7 +5,6 @@ metadata:
|
||||
name: storage-secret
|
||||
type: Opaque
|
||||
data:
|
||||
storage_url: $STORAGE_URL
|
||||
storage_type: $STORAGE_TYPE
|
||||
aws_access_key_id: $AWS_ACCESS_KEY_ID
|
||||
aws_access_access_key: $AWS_SECRET_ACCESS_KEY
|
||||
|
||||
Reference in New Issue
Block a user