2020-02-22 14:26:54 UTC - Roman Popenov: Left the build overnight and woke up 
to this:
```[INFO] Step 18/23 : RUN /pulsar/django/init-postgres.sh
[INFO]
[INFO]  ---> Running in 337dd637444e
[INFO] + rm -rf '/data/*'
[INFO]
[INFO] + chown -R postgres: /data
[INFO]
[INFO] chown: invalid spec: 'postgres:'
[INFO]
[ERROR] The command '/bin/sh -c /pulsar/django/init-postgres.sh' returned a 
non-zero code: 1```
----
2020-02-22 14:34:32 UTC - Roman Popenov: I guess this is also related to 
permissions somehow
----
2020-02-22 16:59:14 UTC - Devin G. Bost: Hmm
----
2020-02-22 17:00:33 UTC - Roman Popenov: I am trying with
```# Copy web-app sources
# Setup database and create tables
RUN ln -sf /bin/bash /bin/sh
RUN useradd -ms /bin/bash postgres
USER postgres
COPY --from=dashboard /pulsar/init-postgres.sh /pulsar/django/init-postgres.sh
RUN mkdir /data
RUN /pulsar/django/init-postgres.sh
RUN sudo -u postgres /etc/init.d/postgresql stop```
In the `pulsar-standalone` Dockerfile
----
2020-02-22 17:00:41 UTC - Roman Popenov: Not sure if I need `USER postgres`
----
2020-02-22 17:02:07 UTC - Devin G. Bost: I've never seen "invalid spec" from 
chown before. I'm not sure what that means.
----
2020-02-22 17:02:29 UTC - Roman Popenov: It doesn’t look like the user 
`postgres` exists
----
2020-02-22 17:02:50 UTC - Roman Popenov: It’s not in the passwd file
----
2020-02-22 17:03:18 UTC - Devin G. Bost: Maybe that USER command isn't doing 
what you're expecting.
----
2020-02-22 17:03:28 UTC - Roman Popenov: Oh, I am not sure I need it
----
2020-02-22 17:03:39 UTC - Roman Popenov: 
<https://docs.docker.com/engine/reference/builder/#user>
----
2020-02-22 17:03:49 UTC - Roman Popenov: I’ve added:
```RUN ln -sf /bin/bash /bin/sh
RUN useradd -ms /bin/bash postgres```
----
2020-02-22 17:04:34 UTC - Roman Popenov: I am not sure if
```CMD ["supervisord", "-n"]```
later on in the file is affected… I suspect that I shouldn’t use `USER postgres`
----
2020-02-22 17:05:07 UTC - Roman Popenov: because the CMD is run with postgres 
user
----
2020-02-22 17:06:23 UTC - Roman Popenov: I also have a suspicion that
```USER postgres
COPY --from=dashboard /pulsar/init-postgres.sh 
/pulsar/django/init-postgres.sh````
Might need to be inversed :sweat_smile:
----
2020-02-22 17:34:58 UTC - Subbu Ramanathan: @Subbu Ramanathan has joined the 
channel
----
2020-02-22 18:14:18 UTC - Roman Popenov: Well, this is progress 
:rolling_on_the_floor_laughing::
```[INFO]  ---&gt; Running in 867dfd966cd7
[INFO] + rm -rf '/data/*'
[INFO]
[INFO] + chown -R postgres: /data
[INFO]
[INFO] + chmod 700 /data
[INFO]
[INFO] + sudo -u postgres /usr/lib/postgresql/9.6/bin/initdb /data/
[INFO]
[INFO] sudo: /usr/lib/postgresql/9.6/bin/initdb: command not found
[INFO]```
pray : Devin G. Bost
----
2020-02-22 19:35:44 UTC - Devin G. Bost: Can someone please tag this issue with 
“help-wanted”? <https://github.com/apache/pulsar/issues/6332>
I’m stumped and not sure where to look next.
----
2020-02-22 19:37:56 UTC - Devin G. Bost: This test fails all the time and is 
driving me crazy, but I can’t figure out how to reproduce it locally.
----
2020-02-23 01:54:07 UTC - tuteng: I think this has been fixed in here 
<https://github.com/apache/pulsar/pull/6279>, Because postgresql upgrade from 9 
to 11
----
2020-02-23 01:55:15 UTC - Roman Popenov: Oh, that does look like it might have 
fixed things, I am building off 2.5.0
----
2020-02-23 01:56:27 UTC - Roman Popenov: I have a different fix that I came up 
with:
```RUN echo "deb <http://apt.postgresql.org/pub/repos/apt/> `dpkg --status 
tzdata | grep Provides | cut -f2 -d'-'`-pgdg main" &gt; 
/etc/apt/sources.list.d/pgdg.list
RUN wget --quiet -O - <https://www.postgresql.org/media/keys/ACCC4CF8.asc> | 
apt-key add -
RUN apt-get update
RUN apt-get -y install python2.7 python-pip postgresql-9.6 sudo nginx 
supervisor libpq-dev```
----
2020-02-23 01:57:06 UTC - Roman Popenov: I am not sure if it’s better to work 
with postgres 11 or stick with 9.6?
----
2020-02-23 01:58:45 UTC - tuteng: I think both 11 and 9 are ok, because this 
database is used by dashboard to store some simple statistical information.
----
2020-02-23 02:00:01 UTC - Roman Popenov: I also realize that it doesn’t fix the 
issue of not having the postgres user
----
2020-02-23 02:14:34 UTC - Roman Popenov: Oh, the user postgres might not exist 
becaue apt-get didn’t install postgres user
----
2020-02-23 02:26:07 UTC - tuteng: No, my test found that once the postgres 
database is installed, there will be a user like postgres.
----
2020-02-23 02:26:36 UTC - Roman Popenov: Yes, that does create user postgres
----

Reply via email to