From 2ab3df8c15ac73be88918e59c48cef7c57a2a4a5 Mon Sep 17 00:00:00 2001 From: Kyle Lawlor-Bagcal Date: Thu, 28 Sep 2023 17:00:54 -0400 Subject: [PATCH 1/7] refactor: use heroku.yml and run migrations in release phase --- Procfile | 1 - heroku.Dockerfile | 15 +++++++++++++++ heroku.yml | 9 +++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) delete mode 100644 Procfile create mode 100644 heroku.Dockerfile create mode 100644 heroku.yml diff --git a/Procfile b/Procfile deleted file mode 100644 index 50d149b..0000000 --- a/Procfile +++ /dev/null @@ -1 +0,0 @@ -index-regen: python main.py diff --git a/heroku.Dockerfile b/heroku.Dockerfile new file mode 100644 index 0000000..dc2d1af --- /dev/null +++ b/heroku.Dockerfile @@ -0,0 +1,15 @@ +FROM python:3.9 + +# Install dependencies +RUN apt-get update +RUN apt-get install curl libpq-dev postgresql-client nodejs python3-poetry yarnpkg -y + +# Set working directory +WORKDIR /home/indexer + +# Copy source code +COPY . . + +# Install indexer +RUN poetry install +RUN yarnpkg install diff --git a/heroku.yml b/heroku.yml new file mode 100644 index 0000000..45f0276 --- /dev/null +++ b/heroku.yml @@ -0,0 +1,9 @@ +build: + docker: + index-regen: heroku.Dockerfile +run: + index-regen: poetry run python main.py +release: + image: index-regen + command: + - yarnpkg migrate From c47add30e208095d8e98595da6b4216c0a57ff9b Mon Sep 17 00:00:00 2001 From: Kyle Lawlor-Bagcal Date: Thu, 28 Sep 2023 19:47:44 -0400 Subject: [PATCH 2/7] fix: bug with heroku run and poetry --- heroku.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heroku.yml b/heroku.yml index 45f0276..ffc46f3 100644 --- a/heroku.yml +++ b/heroku.yml @@ -2,7 +2,7 @@ build: docker: index-regen: heroku.Dockerfile run: - index-regen: poetry run python main.py + index-regen: poetry install && poetry run python main.py release: image: index-regen command: From 1b3587736686bd41e18f46d708001c1cb7fb9a7b Mon Sep 17 00:00:00 2001 From: Kyle Lawlor-Bagcal Date: Thu, 28 Sep 2023 19:58:45 -0400 Subject: [PATCH 3/7] fix: use requirements.txt for heroku --- heroku.Dockerfile | 2 +- heroku.yml | 2 +- requirements.txt | 10 ++++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 requirements.txt diff --git a/heroku.Dockerfile b/heroku.Dockerfile index dc2d1af..d47ef72 100644 --- a/heroku.Dockerfile +++ b/heroku.Dockerfile @@ -11,5 +11,5 @@ WORKDIR /home/indexer COPY . . # Install indexer -RUN poetry install +RUN pip3 install -r requirements.txt RUN yarnpkg install diff --git a/heroku.yml b/heroku.yml index ffc46f3..b55057a 100644 --- a/heroku.yml +++ b/heroku.yml @@ -2,7 +2,7 @@ build: docker: index-regen: heroku.Dockerfile run: - index-regen: poetry install && poetry run python main.py + index-regen: python main.py release: image: index-regen command: diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..72e623e --- /dev/null +++ b/requirements.txt @@ -0,0 +1,10 @@ +certifi==2023.5.7 ; python_version >= "3.9" and python_version < "4.0" +charset-normalizer==3.1.0 ; python_version >= "3.9" and python_version < "4.0" +idna==3.4 ; python_version >= "3.9" and python_version < "4.0" +load-dotenv==0.1.0 ; python_version >= "3.9" and python_version < "4.0" +psycopg2-binary==2.9.6 ; python_version >= "3.9" and python_version < "4.0" +python-dotenv==0.18.0 ; python_version >= "3.9" and python_version < "4.0" +requests==2.31.0 ; python_version >= "3.9" and python_version < "4.0" +sentry-sdk==1.24.0 ; python_version >= "3.9" and python_version < "4.0" +tenacity==8.2.2 ; python_version >= "3.9" and python_version < "4.0" +urllib3==1.26.16 ; python_version >= "3.9" and python_version < "4.0" From f04d4b34ff3ca8c9da0da33d1d0e39e1dfdf73c7 Mon Sep 17 00:00:00 2001 From: Kyle Lawlor-Bagcal Date: Thu, 28 Sep 2023 20:04:04 -0400 Subject: [PATCH 4/7] fix: set PGSSLMODE=no-verify for migrate command --- heroku.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/heroku.yml b/heroku.yml index b55057a..2e78836 100644 --- a/heroku.yml +++ b/heroku.yml @@ -6,4 +6,4 @@ run: release: image: index-regen command: - - yarnpkg migrate + - PGSSLMODE=no-verify yarnpkg migrate From 7ee7a79fe73a894c9d7d2be82089cdb6d18ec06a Mon Sep 17 00:00:00 2001 From: Kyle Lawlor-Bagcal Date: Thu, 28 Sep 2023 20:11:30 -0400 Subject: [PATCH 5/7] refactor: generate requirements.txt using poetry --- heroku.Dockerfile | 2 ++ requirements.txt | 10 ---------- 2 files changed, 2 insertions(+), 10 deletions(-) delete mode 100644 requirements.txt diff --git a/heroku.Dockerfile b/heroku.Dockerfile index d47ef72..2c71639 100644 --- a/heroku.Dockerfile +++ b/heroku.Dockerfile @@ -11,5 +11,7 @@ WORKDIR /home/indexer COPY . . # Install indexer +RUN poetry install +RUN poetry export --without-hashes --format=requirements.txt > requirements.txt RUN pip3 install -r requirements.txt RUN yarnpkg install diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 72e623e..0000000 --- a/requirements.txt +++ /dev/null @@ -1,10 +0,0 @@ -certifi==2023.5.7 ; python_version >= "3.9" and python_version < "4.0" -charset-normalizer==3.1.0 ; python_version >= "3.9" and python_version < "4.0" -idna==3.4 ; python_version >= "3.9" and python_version < "4.0" -load-dotenv==0.1.0 ; python_version >= "3.9" and python_version < "4.0" -psycopg2-binary==2.9.6 ; python_version >= "3.9" and python_version < "4.0" -python-dotenv==0.18.0 ; python_version >= "3.9" and python_version < "4.0" -requests==2.31.0 ; python_version >= "3.9" and python_version < "4.0" -sentry-sdk==1.24.0 ; python_version >= "3.9" and python_version < "4.0" -tenacity==8.2.2 ; python_version >= "3.9" and python_version < "4.0" -urllib3==1.26.16 ; python_version >= "3.9" and python_version < "4.0" From ea4b12eb87aeac870f1d4b9758dbb5c73b0a2b14 Mon Sep 17 00:00:00 2001 From: Kyle Lawlor-Bagcal Date: Thu, 28 Sep 2023 20:18:19 -0400 Subject: [PATCH 6/7] fix: install poetry version that supports export command --- heroku.Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/heroku.Dockerfile b/heroku.Dockerfile index 2c71639..34c28ec 100644 --- a/heroku.Dockerfile +++ b/heroku.Dockerfile @@ -2,7 +2,7 @@ FROM python:3.9 # Install dependencies RUN apt-get update -RUN apt-get install curl libpq-dev postgresql-client nodejs python3-poetry yarnpkg -y +RUN apt-get install curl libpq-dev postgresql-client nodejs yarnpkg -y # Set working directory WORKDIR /home/indexer @@ -11,6 +11,7 @@ WORKDIR /home/indexer COPY . . # Install indexer +RUN pip3 install poetry==1.6.1 RUN poetry install RUN poetry export --without-hashes --format=requirements.txt > requirements.txt RUN pip3 install -r requirements.txt From 5fab0dbd67735c6a8fb7be2759278507d0522929 Mon Sep 17 00:00:00 2001 From: Kyle Lawlor-Bagcal Date: Wed, 18 Oct 2023 20:58:16 -0400 Subject: [PATCH 7/7] chore: comments and name change for dyno/image --- heroku.Dockerfile | 4 +++- heroku.yml | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/heroku.Dockerfile b/heroku.Dockerfile index 34c28ec..0e8586b 100644 --- a/heroku.Dockerfile +++ b/heroku.Dockerfile @@ -10,9 +10,11 @@ WORKDIR /home/indexer # Copy source code COPY . . -# Install indexer +# Install indexer and pin the version of poetry RUN pip3 install poetry==1.6.1 RUN poetry install +# the heroku.yml 'run' directive is incompatible with poetry +# so we export to the requirements.txt format and use pip3 RUN poetry export --without-hashes --format=requirements.txt > requirements.txt RUN pip3 install -r requirements.txt RUN yarnpkg install diff --git a/heroku.yml b/heroku.yml index 2e78836..837d9fe 100644 --- a/heroku.yml +++ b/heroku.yml @@ -1,9 +1,9 @@ build: docker: - index-regen: heroku.Dockerfile + indexer: heroku.Dockerfile run: - index-regen: python main.py + indexer: python main.py release: - image: index-regen + image: indexer command: - PGSSLMODE=no-verify yarnpkg migrate