-
Notifications
You must be signed in to change notification settings - Fork 1.2k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
Unable to run flyway migration #1003
Comments
imho: see the doc in https://hub.docker.com/_/postgres
so try without the "localhost". |
Thanks @ImreSamu for the pointers. I followed the exact pattern from the #474 issue and still getting unknown host exception. RUN_MIGRATIONS="${RUN_MIGRATIONS:-true}"
DB_URL="jdbc:postgresql://@:5432/<<database>>"
#psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" <<-EOSQL
# CREATE DATABASE $DB_NAME;
#EOSQL
echo "coming..."
if [ "$RUN_MIGRATIONS" == "true" ]; then
echo "running migrations ..."
${FLYWAY_EXE} -user=<<user>> -password=<<password>> -url=$DB_URL -locations="filesystem:$MIGRATIONS_LOCATION" migrate
fi Errors ->
Any thoughts? May be this doesn't work for jdbc drivers? Is this a bug in the image? |
Are the |
I sanitized them. I found a work around from other posts and trying that. Will keep you posted. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
I have a requirement to run the flyway migrations during docker run as soon as the postgres docker container is run.
So, based on my analysis on the docker-entrypoint.sh, it sounds like the file names should be in a certain order as they follow sequence to run. I created
a_initial_setup.sql
andinit_db.sh
so that I can create a database and the users and do the grants. So, the database is created correctly and the logs shows that server is running, but when I am trying to connect using localhost on port 5432 it doesn't work. I get below errors -waiting for server to start....2022-10-14 01:59:58.400 UTC [123] LOG: starting PostgreSQL 12.12 (Debian 12.12-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
2022-10-14 01:59:58.403 UTC [123] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2022-10-14 01:59:58.492 UTC [127] LOG: database system was shut down at 2022-10-14 01:59:57 UTC
2022-10-14 01:59:58.513 UTC [123] LOG: database system is ready to accept connections
done
server started
CREATE DATABASE
/usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/a_initial_setup.sql
CREATE ROLE
GRANT
CREATE SCHEMA
GRANT
CREATE EXTENSION
/usr/local/bin/docker-entrypoint.sh: sourcing /docker-entrypoint-initdb.d/init_db.sh
HOSTNAME...localhost
psql: error: connection to server at "localhost" (127.0.0.1), port 5432 failed: Connection refused
Is the server running on that host and accepting TCP/IP connections?
connection to server at "localhost" (::1), port 5432 failed: Cannot assign requested address
Is the server running on that host and accepting TCP/IP connections?
Sample flyway migration code -
Does the server not running on port 5432 or it runs on random port? How do I over come this error? Critical for the work I am doing now. Any thoughts are appreciated.
The text was updated successfully, but these errors were encountered: