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

Move wait-for-postgres.sh to Java #39

Merged
merged 6 commits into from
Aug 19, 2019
Merged

Move wait-for-postgres.sh to Java #39

merged 6 commits into from
Aug 19, 2019

Conversation

steven-sheehy
Copy link
Member

  • Moved the logic in wait-for-postgresh.sh to DatabaseUtilities.openDatabase(). Moving it to code allows both docker and non-docker deployments to startup java processes before postgresql and not immediately crash.
  • Removed wait-for-postgres.sh and any place that references it
  • Removed custom startup scripts for each microservice as it was only needed due to needing to invoke wait-for-postgres.sh.
  • All java microservices now use adoptopenjdk:11-jre-hotspot instead of manually installing jre since they don't need pgclient. Smaller image, smaller attack surface, simpler.
  • rest-api doesn't need wait-for-postgres.sh as it doesn't crash on startup if pg down like java.
  • Simplified docker mvn build to not use script and dockerfile
  • Removed use of postgresInit.sql in docker deployments as it was failing with psql:/docker-entrypoint-initdb.d/postgresInit.sql:32: \connect: FATAL: database "hederamirror" does not exist

Would appreciate a quick test run by someone else to make sure I didn't mess anything up.

@steven-sheehy steven-sheehy added the enhancement Type: New feature label Aug 15, 2019
@steven-sheehy steven-sheehy self-assigned this Aug 15, 2019
@gregscullard
Copy link
Contributor

@steven-sheehy in various places, I've got this code

if (Utility.checkStopFile()) {
	log.info(MARKER, "Stop file found, stopping.");
	break;
}			

such that if a file called stop is found in the runtime folder for the mirror-node, processes shut down cleanly. Seeing DatabaseUtilities.openDatabase() is a potentially infinite loop, I sense we should have the same check there.

@steven-sheehy
Copy link
Member Author

@gregscullard I added the stop file check to the loop.

@gregscullard
Copy link
Contributor

@steven-sheehy I've tested this PR and it looks good. I've made a few changes to fix bugs I introduced in the SQL migration scripts.
It won't pass CI though and I can't find out why at the moment.
Local mvn install works ok

@steven-sheehy
Copy link
Member Author

@gregscullard I think the build is failing because I've yet to merge the new circleci config from master. I can do so soon, but it might be better if you submit your new commits as a separate PR first. The reason is because you and Calvin seem to be making contradictory changes back and forth to these SQL stored procedures and might need to sync up first and ensure you're on the same page.

@gregscullard
Copy link
Contributor

gregscullard commented Aug 18, 2019 via email

@steven-sheehy
Copy link
Member Author

Cool, I think your approach is probably correct and Calvin is just maybe not running flyway correctly. I have an upcoming PR to move flyway to Java code to make it run automatically.

@gregscullard
Copy link
Contributor

gregscullard commented Aug 19, 2019 via email

@gregscullard gregscullard merged commit 60ee4ff into master Aug 19, 2019
@gregscullard gregscullard deleted the wait-for-postgres branch August 21, 2019 07:15
@steven-sheehy steven-sheehy added this to the 0.1.0 milestone Aug 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Type: New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants