Skip to content
This repository has been archived by the owner on May 12, 2020. It is now read-only.

postgresql-embedded fails to start in travis environment #145

Open
arhelmus opened this issue Oct 12, 2018 · 2 comments
Open

postgresql-embedded fails to start in travis environment #145

arhelmus opened this issue Oct 12, 2018 · 2 comments

Comments

@arhelmus
Copy link

Hi there, first of all, thx for your library it worked great for the last two years for me.

Currently, I have a public project which uses postgres-embedded and builds it at CI, but after some changes (probably in Travis ci agents), my test code cannot connect to Postgres on build machines. I cannot reproduce it locally and not sure how to get more information about what's going on.

Here is build log https://travis-ci.org/ArchDev/akka-http-rest/jobs/440496384#L796 and file where I use the library https://github.com/ArchDev/akka-http-rest/blob/master/src/test/scala/me/archdev/utils/InMemoryPostgresStorage.scala also Travis build config https://github.com/ArchDev/akka-http-rest/blob/master/.travis.yml

This happening only on CI (worst words ever). Locally everything works great for me. Can you please help me to debug that issue?

@ilkerc
Copy link

ilkerc commented Nov 8, 2018

I'm digging this problem for a while (using wercker CI tool). Using wercker CLI I can do the same steps locally on my machine and debug intermediate containers. (Postgres is being initiated on a maven test step.)

What I have discovered so far are:

  • The files do really exists on the given paths.
  • initdb should be called from postgres user (not sure of that one)

Here is the log of the failing intermediate container.

f942d41eb4eb:/tmp/postgresql-embed-27b0c95b-2ddb-413a-88ac-abe62ef8949a/pgsql-10.3-1/pgsql/bin$ whoami
postgres

Binary files do exists.

f942d41eb4eb:/tmp/postgresql-embed-27b0c95b-2ddb-413a-88ac-abe62ef8949a/pgsql-10.3-1/pgsql/bin$ ls
''$'\001''p'   initdb		   pg_dump	    pg_rewind	     postgres
 clusterdb     oid2name		   pg_dumpall	    pg_standby	     postmaster
 createdb      pg_archivecleanup   pg_isready	    pg_test_fsync    psql
 createuser    pg_basebackup	   pg_receivewal    pg_test_timing   psql.bin
 dropdb        pg_config	   pg_recvlogical   pg_upgrade	     reindexdb
 dropuser      pg_controldata	   pg_resetwal	    pg_waldump	     vacuumdb
 ecpg	       pg_ctl		   pg_restore	    pgbench	     vacuumlo

Somehow, I can not run the executable. Which lead me to checking the instruction set compability

f942d41eb4eb:/tmp/postgresql-embed-27b0c95b-2ddb-413a-88ac-abe62ef8949a/pgsql-10.3-1/pgsql/bin$ ./initdb
-sh: ./initdb: not found

I also checked x64 compability:

f942d41eb4eb:/tmp/postgresql-embed-27b0c95b-2ddb-413a-88ac-abe62ef8949a/pgsql-10.3-1/pgsql/bin$ uname -a
Linux f942d41eb4eb 4.14.79-boot2docker #1 SMP Thu Nov 8 01:56:42 UTC 2018 x86_64 GNU/Linux

Anyone having insights about that?

@ilkerc
Copy link

ilkerc commented Nov 9, 2018

Somehow it did had to do with the base image I was using. Maybe it was missing some runtime libraries.. I left using alpine versions and ended up using ubuntu 16.04 with preinstalled jdk.

After all, it was able to execute initdb. While maven is being executed as root I created a new user and did installation & packaging using the unprivileged user.

Anyone having the same issue, I'll paste here the wercker.yml file. Hope you wont waste hours like I did :)

box: mlaccetti/docker-oracle-java8-ubuntu-16.04
build:
  steps:
  - script:
      name: install required packages
      code: |
        apt-get -y update
        apt-get install -y git curl sudo
        useradd -ms /bin/bash mavenuser
  - wercker/maven:
      goals: install
      cache_repo: true
      version: 3.5.4
      sudo_user: mavenuser

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants