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

DM-46257: Add Docker support for ppdb-replication #3

Merged
merged 6 commits into from
Oct 2, 2024

Conversation

JeremyMcCormick
Copy link
Contributor

No description provided.

@JeremyMcCormick JeremyMcCormick marked this pull request as draft September 20, 2024 18:07
@JeremyMcCormick JeremyMcCormick force-pushed the tickets/DM-46257 branch 19 times, most recently from 702d3f2 to f87628b Compare September 27, 2024 17:44
@JeremyMcCormick JeremyMcCormick force-pushed the tickets/DM-46257 branch 3 times, most recently from 3620429 to 9449163 Compare September 27, 2024 18:57
@JeremyMcCormick JeremyMcCormick changed the title DM-46257: Add APDB to PPDB replication service DM-46257: Add Docker support for ppdb-replication Sep 28, 2024
@JeremyMcCormick JeremyMcCormick marked this pull request as ready for review September 30, 2024 17:06
@JeremyMcCormick JeremyMcCormick force-pushed the tickets/DM-46257 branch 5 times, most recently from 147abf0 to b45406f Compare October 1, 2024 03:14
@JeremyMcCormick JeremyMcCormick force-pushed the tickets/DM-46257 branch 2 times, most recently from ba21a7e to 5437383 Compare October 1, 2024 04:09
@JeremyMcCormick JeremyMcCormick force-pushed the tickets/DM-46257 branch 4 times, most recently from 238ef40 to 10340e9 Compare October 1, 2024 05:12
@lsst lsst deleted a comment from codecov bot Oct 1, 2024
@JeremyMcCormick JeremyMcCormick force-pushed the tickets/DM-46257 branch 5 times, most recently from 7534446 to b48e754 Compare October 1, 2024 22:20
Copy link
Collaborator

@andy-slac andy-slac left a comment

Choose a reason for hiding this comment

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

Looks great, a couple of minor comments.

WORKDIR /app

# Install sdm_schemas
RUN git clone https://github.com/lsst/sdm_schemas.git
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe add --depth=0 option to avoid cloning full history?

Just a general comment for the future - we may need to install a specific version of sdm_schemas that matches the version of the database schema. It may be even better to delay or avoid cloning sdm_schemas into the image, to be able to use the same image with different schema version. Something to work out later.

Copy link
Contributor Author

@JeremyMcCormick JeremyMcCormick Oct 2, 2024

Choose a reason for hiding this comment

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

Maybe add --depth=0 option to avoid cloning full history?

Good idea - will do.

Just a general comment for the future - we may need to install a specific version of sdm_schemas that matches the version of the database schema. It may be even better to delay or avoid cloning sdm_schemas into the image, to be able to use the same image with different schema version. Something to work out later.

I improved the Dockfile so that it has an SDM_SCHEMAS_REF variable with the branch of sdm_schemas to use. By default, it will use main. Right now, we can't change this in the GitHub Action (it doesn't support setting environment variables for the Docker build), but the version can be updated directly in Dockerfile.replication for development if another ref than main should be used.

Comment on lines 46 to 44
[ -n "${PPDB_REPLICATION_APDB_CONFIG:-}" ] && _CMD="$_CMD $PPDB_REPLICATION_APDB_CONFIG"
[ -n "${PPDB_REPLICATION_PPDB_CONFIG:-}" ] && _CMD="$_CMD $PPDB_REPLICATION_PPDB_CONFIG"
Copy link
Collaborator

Choose a reason for hiding this comment

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

These two must be non-empty, no need to check them again?

Comment on lines 50 to 55
# Check the exit status of the command
status=$?
if [ $status -ne 0 ]; then
echo "Command failed with exit status $status"
exit $status
fi
Copy link
Collaborator

Choose a reason for hiding this comment

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

With set -e if $_CMD fails then the shell will exit immediately, this if is only ever executed if status=0.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, will remove it.

@JeremyMcCormick JeremyMcCormick force-pushed the tickets/DM-46257 branch 5 times, most recently from ed041ae to 5480e09 Compare October 2, 2024 20:11
This will run the ppdb-replication command, which is installed through
pip. The entrypoint script used to run the command will convert the
PPDB environment variables into the appropriate command line arguments.
This only builds the Docker image for ppdb-replication. Add additional
steps to build other Docker images.
@JeremyMcCormick JeremyMcCormick merged commit d821f4e into main Oct 2, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants