Get local postgres working on kube
This commit is contained in:
parent
bc25cf1eba
commit
144ed63381
2
Tiltfile
2
Tiltfile
@ -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', '.',
|
||||
|
13
k8s/app.yaml
13
k8s/app.yaml
@ -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:
|
||||
|
@ -1,5 +0,0 @@
|
||||
global:
|
||||
postgresql:
|
||||
postgresqlDatabase: "mev_inspect"
|
||||
postgresqlUsername: "postgres"
|
||||
postgresqlPassword: "password"
|
@ -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():
|
||||
|
@ -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]
|
||||
|
Loading…
x
Reference in New Issue
Block a user