diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..e182bb7 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,2 @@ +tests +cache diff --git a/Dockerfile b/Dockerfile index bc4fba2..5f6cc69 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,4 +18,4 @@ COPY . /app # easter eggs 😝 RUN echo "PS1='🕵️:\[\033[1;36m\]\h \[\033[1;34m\]\W\[\033[0;35m\]\[\033[1;36m\]$ \[\033[0m\]'" >> ~/.bashrc -CMD ["/bin/bash"] +CMD [ "python", "run.py"] diff --git a/Tiltfile b/Tiltfile index 4d582c1..25e1948 100644 --- a/Tiltfile +++ b/Tiltfile @@ -11,7 +11,7 @@ k8s_yaml(secret_from_dict("mev-inspect-db-credentials", inputs = { "password": "password", })) -docker_build('mev-inspect', '.', +docker_build('mev-inspect-py', '.', live_update=[ sync('.', '/app'), run('cd /app && poetry install', diff --git a/k8s/app.yaml b/k8s/app.yaml index d88b977..46e0946 100644 --- a/k8s/app.yaml +++ b/k8s/app.yaml @@ -16,9 +16,8 @@ spec: spec: containers: - name: mev-inspect - image: mev-inspect:latest - command: [ "/bin/bash", "-c", "--" ] - args: [ "while true; do sleep 30; done;" ] + image: mev-inspect-py + command: [ "python", "run.py"] env: - name: POSTGRES_USER valueFrom: @@ -30,6 +29,8 @@ spec: secretKeyRef: name: mev-inspect-db-credentials key: password + - name: POSTGRES_HOST + value: postgresql livenessProbe: exec: command: diff --git a/mev_inspect/db.py b/mev_inspect/db.py index 712b708..df2b7d9 100644 --- a/mev_inspect/db.py +++ b/mev_inspect/db.py @@ -7,9 +7,9 @@ from sqlalchemy.orm import sessionmaker def get_sqlalchemy_database_uri(): username = os.getenv("POSTGRES_USER") password = os.getenv("POSTGRES_PASSWORD") - server = "postgresql" + host = os.getenv("POSTGRES_HOST") db_name = "mev_inspect" - return f"postgresql://{username}:{password}@{server}/{db_name}" + return f"postgresql://{username}:{password}@{host}/{db_name}" def get_engine(): diff --git a/run.py b/run.py new file mode 100644 index 0000000..30dc5d1 --- /dev/null +++ b/run.py @@ -0,0 +1,5 @@ +import time + +if __name__ == "__main__": + while True: + time.sleep(30)