1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-20 01:57:09 +03:00

plpgsql: support Travis run with alt. user

Seems that Travis sometimes runs with a user other than 1001 so add
user ID 2000 as well.
This commit is contained in:
Joel Martin 2017-07-25 11:13:13 -05:00
parent 6351d14c6c
commit 74771ea2a9
2 changed files with 5 additions and 3 deletions

View File

@ -19,8 +19,9 @@ ENV HOME=/var/run/postgresql
WORKDIR /mal
# Travis runs as user ID 1001 so add that user
# Travis runs as a couple of different users so add them
RUN useradd -ou 1001 -m -s /bin/bash -G sudo,postgres travis
RUN useradd -ou 2000 -m -s /bin/bash -G sudo,postgres travis2
# Enable postgres and travis users to sudo for postgres startup
RUN echo "%sudo ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers
@ -29,6 +30,7 @@ RUN echo "%sudo ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers
RUN sed -i 's/peer$/peer map=mal/' /etc/postgresql/9.4/main/pg_hba.conf
RUN echo "mal postgres postgres" >> /etc/postgresql/9.4/main/pg_ident.conf
RUN echo "mal travis postgres" >> /etc/postgresql/9.4/main/pg_ident.conf
RUN echo "mal travis2 postgres" >> /etc/postgresql/9.4/main/pg_ident.conf
# Add entrypoint.sh which starts postgres then run bash/command
ADD entrypoint.sh /entrypoint.sh

View File

@ -9,9 +9,9 @@ while [[ ${1:0:1} = '-' ]]; do
done
sudo --user=${POSTGRES_SUDO_USER} \
/usr/lib/postgresql/9.4/bin/postgres \
bash -c "/usr/lib/postgresql/9.4/bin/postgres \
-c config_file=/etc/postgresql/9.4/main/postgresql.conf \
${POPTS} >/var/log/postgresql/output.log 2>&1 & disown -h
${POPTS} >/var/log/postgresql/output.log 2>&1" & disown -h
while ! ( echo "" > /dev/tcp/localhost/5432) 2>/dev/null; do
echo "Waiting for postgres to start"