You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am Unable to initialise database with schema evolution manager on docker startup. My docker file is as follows
FROM postgres:10-alpine
WORKDIR /opt/luminary-api-db
COPY . .
RUN apk add py-pip ruby ruby-rdoc
RUN gem install schema-evolution-manager && \
pip install awscli
RUN cp docker-entrypoint-initdb.d/* /docker-entrypoint-initdb.d
EXPOSE 5432
docker-entrypoint-initdb.d contain one init script
set -e
psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" <<-EOSQL
CREATE DATABASE ${POSTGRES_USER}_test;
GRANT ALL PRIVILEGES ON DATABASE ${POSTGRES_USER}_test TO $POSTGRES_USER;
EOSQL
# Applying Sem Scripts
echo
echo 'PostgreSQL initialzing Data...'
echo
psql -U $POSTGRES_USER
sem-apply --url postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@localhost/$POSTGRES_DB
sem-apply --url postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@localhost/$POSTGRES_DB_test
On docker container startup the database is created fine but the schema evolution manager says its unable to connect to database
Here is the complete stack trace
/usr/local/bin/docker-entrypoint.sh: running /docker-entrypoint-initdb.d/init.sh
CREATE DATABASE
GRANT
PostgreSQL initialzing Data...
psql: could not connect to server: Connection refused
Is the server running on host "localhost" (127.0.0.1) and accepting
TCP/IP connections on port 5432?
could not connect to server: Address not available
Is the server running on host "localhost" (::1) and accepting
TCP/IP connections on port 5432?
/usr/lib/ruby/gems/2.5.0/gems/schema-evolution-manager-0.9.39/lib/schema-evolution-manager/library.rb:136:in `rescue in system_or_error': Error running command[psql --no-align --tuples-only --no-psqlrc --command "select count(*) from pg_namespace where nspname='schema_evolution_manager'" postgresql://user:pass@localhost/db]: Non zero exit code[pid 47 exit 2] running command[psql --no-align --tuples-only --no-psqlrc --command "select count(*) from pg_namespace where nspname='schema_evolution_manager'" postgresql://user:pass@localhost/db] (RuntimeError)
from /usr/lib/ruby/gems/2.5.0/gems/schema-evolution-manager-0.9.39/lib/schema-evolution-manager/library.rb:129:in `system_or_error'
from /usr/lib/ruby/gems/2.5.0/gems/schema-evolution-manager-0.9.39/lib/schema-evolution-manager/db.rb:32:in `psql_command'
from /usr/lib/ruby/gems/2.5.0/gems/schema-evolution-manager-0.9.39/lib/schema-evolution-manager/db.rb:90:in `schema_schema_evolution_manager_exists?'
from /usr/lib/ruby/gems/2.5.0/gems/schema-evolution-manager-0.9.39/lib/schema-evolution-manager/scripts.rb:86:in `scripts_previously_run'
from /usr/lib/ruby/gems/2.5.0/gems/schema-evolution-manager-0.9.39/lib/schema-evolution-manager/scripts.rb:48:in `each_pending'
from /usr/lib/ruby/gems/2.5.0/gems/schema-evolution-manager-0.9.39/lib/schema-evolution-manager/db.rb:22:in `bootstrap!'
from /usr/lib/ruby/gems/2.5.0/gems/schema-evolution-manager-0.9.39/bin/sem-apply:30:in `<top (required)>'
from /usr/bin/sem-apply:23:in `load'
from /usr/bin/sem-apply:23:in `<main>'
Can someone tell me how can i fix this issue?
The text was updated successfully, but these errors were encountered:
Hassnain-Alvi
changed the title
Initialisation on docker startup
Failed Initialisation on docker startup
May 6, 2019
Hassnain-Alvi
changed the title
Failed Initialisation on docker startup
Apply Migration Scripts on docker startup
May 6, 2019
I am Unable to initialise database with schema evolution manager on docker startup. My docker file is as follows
docker-entrypoint-initdb.d contain one init script
On docker container startup the database is created fine but the schema evolution manager says its unable to connect to database
Here is the complete stack trace
Can someone tell me how can i fix this issue?
The text was updated successfully, but these errors were encountered: