Get local postgres working on kube

This commit is contained in:
Luke Van Seters 2021-09-09 07:49:29 -06:00
parent bc25cf1eba
commit 144ed63381
6 changed files with 20 additions and 8 deletions

View File

@ -2,7 +2,7 @@ load('ext://helm_remote', 'helm_remote')
helm_remote("postgresql",
repo_name='bitnami',
repo_url='https://charts.bitnami.com/bitnami',
values=["k8s/postgresql/values_dev.yaml"]
set=["postgresqlPassword=password", "postgresqlDatabase=mev_inspect"],
)
docker_build('mev-inspect', '.',

View File

@ -1,7 +1,7 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: mev-inspect
name: mev-inspect-deployment
labels:
app: mev-inspect
spec:
@ -19,6 +19,17 @@ spec:
image: mev-inspect:latest
command: [ "/bin/bash", "-c", "--" ]
args: [ "while true; do sleep 30; done;" ]
env:
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: mev-inspect-db-password
key: username
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: mev-inspect-db-password
key: password
livenessProbe:
exec:
command:

View File

@ -1,5 +0,0 @@
global:
postgresql:
postgresqlDatabase: "mev_inspect"
postgresqlUsername: "postgres"
postgresqlPassword: "password"

View File

@ -5,7 +5,12 @@ from sqlalchemy.orm import sessionmaker
def get_engine():
return create_engine(os.getenv("SQLALCHEMY_DATABASE_URI"))
username = os.getenv("POSTGRES_USER")
password = os.getenv("POSTGRES_PASSWORD")
server = "postgresql"
db_name = "mev_inspect"
uri = f"postgresql://{username}:{password}@{server}/{db_name}"
return create_engine(uri)
def get_session():

View File

@ -41,6 +41,7 @@ build = 'scripts.poetry.docker:build'
attach = 'scripts.poetry.docker:attach'
exec = 'scripts.poetry.docker:exec'
inspect = 'scripts.poetry.inspect:inspect'
inspect-block = 'scripts.inspect_block:inspect_block'
inspect-many = 'scripts.poetry.inspect:inspect_many'
[tool.black]

View File