Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use heroku.yml and run migrations in release phase #50

Merged
merged 7 commits into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Procfile

This file was deleted.

18 changes: 18 additions & 0 deletions heroku.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM python:3.9

# Install dependencies
RUN apt-get update
RUN apt-get install curl libpq-dev postgresql-client nodejs yarnpkg -y

# Set working directory
WORKDIR /home/indexer

# Copy source code
COPY . .

# Install indexer
RUN pip3 install poetry==1.6.1
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: this is an adjustment that i needed to make because previously i was using the python3-poetry from debian package manager, and that version of poetry did not support the export command in line 16 below

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe worth adding a note to the Install indexer comment about the version and use of export.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RUN poetry install
RUN poetry export --without-hashes --format=requirements.txt > requirements.txt
Copy link
Contributor Author

@wgwz wgwz Sep 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is to work around the weird heroku "run", heroku.yml and poetry bug i mentioned.
this file does not need to be tracked, since it's being generated by poetry.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned above, maybe worth making note of this within the file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RUN pip3 install -r requirements.txt
RUN yarnpkg install
9 changes: 9 additions & 0 deletions heroku.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
build:
docker:
index-regen: heroku.Dockerfile
run:
index-regen: python main.py
release:
image: index-regen
wgwz marked this conversation as resolved.
Show resolved Hide resolved
command:
- PGSSLMODE=no-verify yarnpkg migrate
Copy link
Contributor Author

@wgwz wgwz Sep 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PGSSLMODE was needed because without it the underlying node postgres library throws an error.
this tells the pg library under the hood "don't worry about verifying the ssl certificate, but still make use of it"
the node pg library expects you to add certificates to verify ssl connections by default (and that can be tricky).
we do this in the regen-server as well, seems fairly low stakes in this case (this being "use ssl but don't verify")