Skip to content

Commit 51053f7

Browse files
committed
Update backend to 1.2.4
Update applications to v1.3.0 Update blockexplorer to v0.3.2 Update scripts to v0.2.1 Update golang to 1.11.5 Update go setup in bf/be dockerfiles Clean up quick start management script variables
1 parent a548479 commit 51053f7

File tree

11 files changed

+157
-87
lines changed

11 files changed

+157
-87
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## Version 0.7.3 / 2019-Feb-12 06:38
2+
* Upgrade backend to version 1.2.4
3+
* Upgrade applications to version v1.3.0
4+
* Upgrade scripts to v0.2.1
5+
* Upgrade Block Explorer version v0.3.2
6+
17
## Version 0.7.2 / 2018-Dec-26 19:26
28
* Upgrade mac docker to version Community Edition 2.0.0.0-mac81 2018-12-07
39
* Upgrade backend to version 1.1.10

CONTENT.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# Version 0.7.3
2+
3+
* [Backend v1.2.4](https://github.com/AplaProject/go-apla/releases/tag/1.2.4)
4+
* [Frontend v0.11.1](https://github.com/GenesisKernel/genesis-front/releases/tag/v0.11.1)
5+
* [Applications v1.3.0](https://github.com/AplaProject/apps/releases/tag/v1.3.0)
6+
* [Block Explorer v0.3.2](https://github.com/GenesisKernel/blockexplorer/releases/tag/v0.3.2)
7+
* [Scripts v0.2.1](https://github.com/blitzstern5/genesis-scripts/releases/tag/v0.2.1)
8+
19
# Version 0.7.2
210

311
* [Backend v1.1.10](https://github.com/AplaProject/go-apla/releases/tag/1.1.10)

genesis-be/Dockerfile

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,26 @@ FROM debian:stretch-slim
22

33
ENV GOPATH /go
44
ENV PATH /go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
5-
ENV GOLANG_VER 1.11
6-
ENV BACKEND_GO_URL github.com/GenesisKernel/go-genesis
7-
ENV BACKEND_BRANCH 1.0.4
8-
ENV BE_BIN_BASENAME go-genesis
5+
ENV GOLANG_VER 1.11.5
6+
ENV NODEJS_SETUP_SCRIPT_URL https://deb.nodesource.com/setup_10.x
7+
ENV BACKEND_GO_URL github.com/AplaProject/go-apla
8+
ENV BACKEND_BRANCH 1.2.4
9+
ENV BE_BIN_BASENAME go-apla
10+
ENV FRONTEND_REPO_URL https://github.com/GenesisKernel/genesis-front
11+
ENV FRONTEND_BRANCH v0.11.1
912
ENV SCRIPTS_REPO_URL https://github.com/blitzstern5/genesis-scripts
10-
ENV SCRIPTS_BRANCH develop
11-
ENV DEMO_APPS_URL https://raw.githubusercontent.com/GenesisKernel/apps/master/system.json
13+
ENV SCRIPTS_BRANCH v0.2.1
14+
ENV DEMO_APPS_URL https://github.com/GenesisKernel/apps/releases/download/v1.3.0/system.json
1215

13-
RUN apt-get update -y && \
14-
apt-get install -y sudo supervisor curl git gnupg2 postgresql-client-9.6 \
15-
build-essential && \
16-
apt-get clean && rm -rf /var/lib/apt/lists/*
16+
RUN set -ex; apt-get update -y && \
17+
mkdir -p /usr/share/man/man1 && mkdir -p /usr/share/man/man7 && \
18+
apt-get install -y --no-install-recommends sudo supervisor curl git gnupg2 \
19+
postgresql-client-9.6 build-essential ca-certificates && apt-get clean; \
20+
(rm -rf /var/lib/apt/lists/*; :)
1721

18-
RUN curl -L -o /go$GOLANG_VER.linux-amd64.tar.gz https://dl.google.com/go/go$GOLANG_VER.linux-amd64.tar.gz && tar xvf /go$GOLANG_VER.linux-amd64.tar.gz && mv /go /usr/local/ && find /go$GOLANG_VER.linux-amd64.tar.gz -delete
22+
RUN curl -L -o go$GOLANG_VER.linux-amd64.tar.gz https://dl.google.com/go/go$GOLANG_VER.linux-amd64.tar.gz && tar -C /usr/local -xzf go$GOLANG_VER.linux-amd64.tar.gz && rm go$GOLANG_VER.linux-amd64.tar.gz
1923

20-
RUN go get -d $BACKEND_GO_URL && cd /go/src/$BACKEND_GO_URL && git checkout $BACKEND_BRANCH && go get $BACKEND_GO_URL && mkdir -p /genesis-back/bin && git rev-parse --abbrev-ref HEAD > /genesis-back/bin/go-genesis.git_branch && git rev-parse HEAD > /genesis-back/bin/go-genesis.git_commit && mkdir -p /genesis-back/data/node1 && mv $GOPATH/bin/go-genesis /genesis-back/bin/go-genesis && rm -rf /go
24+
RUN go get -d $BACKEND_GO_URL && cd /go/src/$BACKEND_GO_URL && git checkout $BACKEND_BRANCH && go get $BACKEND_GO_URL && mkdir -p /genesis-back/bin && git rev-parse --abbrev-ref HEAD > /genesis-back/bin/$BE_BIN_BASENAME.git_branch && git rev-parse HEAD > /genesis-back/bin/$BE_BIN_BASENAME.git_commit && mkdir -p /genesis-back/data/node1 && mv $GOPATH/bin/$BE_BIN_BASENAME /genesis-back/bin/$BE_BIN_BASENAME && rm -rf /go
2125

2226
RUN mkdir /genesis-apps && \
2327
echo -n "$DEMO_APPS_URL" > /genesis-apps/demo_apps.url
@@ -26,7 +30,7 @@ ADD $DEMO_APPS_URL /genesis-apps/demo_apps.json
2630
RUN git clone -b $SCRIPTS_BRANCH $SCRIPTS_REPO_URL /genesis-scripts
2731
COPY scripts.config.sh /genesis-scripts/.env
2832

29-
RUN apt-get update -y && apt-get install -y --no-install-recommends python3 python3-pip && apt-get clean && rm -rf /var/lib/apt/lists/*
33+
RUN apt-get update -y && apt-get install -y --no-install-recommends python3 python3-pip && apt-get clean; (rm -rf /var/lib/apt/lists/*; :)
3034
RUN pip3 install -U pip
3135
RUN pip3 install setuptools wheel
3236
RUN pip3 install -r /genesis-scripts/requirements.txt

genesis-be/genesis-scripts

genesis-bf/Dockerfile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,24 @@ FROM debian:stretch-slim
22

33
ENV GOPATH /go
44
ENV PATH /go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
5-
ENV GOLANG_VER 1.11.4
5+
ENV GOLANG_VER 1.11.5
66
ENV NODEJS_SETUP_SCRIPT_URL https://deb.nodesource.com/setup_10.x
77
ENV BACKEND_GO_URL github.com/AplaProject/go-apla
8-
ENV BACKEND_BRANCH 1.1.10
8+
ENV BACKEND_BRANCH 1.2.4
99
ENV BE_BIN_BASENAME go-apla
1010
ENV FRONTEND_REPO_URL https://github.com/GenesisKernel/genesis-front
1111
ENV FRONTEND_BRANCH v0.11.1
1212
ENV SCRIPTS_REPO_URL https://github.com/blitzstern5/genesis-scripts
13-
ENV SCRIPTS_BRANCH v0.2.0
14-
ENV DEMO_APPS_URL https://github.com/GenesisKernel/apps/releases/download/v1.2.0/system.json
13+
ENV SCRIPTS_BRANCH v0.2.1
14+
ENV DEMO_APPS_URL https://github.com/GenesisKernel/apps/releases/download/v1.3.0/system.json
1515

1616
RUN set -ex; apt-get update -y && \
1717
mkdir -p /usr/share/man/man1 && mkdir -p /usr/share/man/man7 && \
1818
apt-get install -y --no-install-recommends sudo supervisor curl git gnupg2 \
1919
postgresql-client-9.6 build-essential ca-certificates && apt-get clean; \
2020
(rm -rf /var/lib/apt/lists/*; :)
2121

22-
RUN curl -L -o /go$GOLANG_VER.linux-amd64.tar.gz https://dl.google.com/go/go$GOLANG_VER.linux-amd64.tar.gz && tar xvf /go$GOLANG_VER.linux-amd64.tar.gz && mv /go /usr/local/ && find /go$GOLANG_VER.linux-amd64.tar.gz -delete
22+
RUN curl -L -o go$GOLANG_VER.linux-amd64.tar.gz https://dl.google.com/go/go$GOLANG_VER.linux-amd64.tar.gz && tar -C /usr/local -xzf go$GOLANG_VER.linux-amd64.tar.gz && rm go$GOLANG_VER.linux-amd64.tar.gz
2323

2424
RUN go get -d $BACKEND_GO_URL && cd /go/src/$BACKEND_GO_URL && git checkout $BACKEND_BRANCH && go get $BACKEND_GO_URL && mkdir -p /genesis-back/bin && git rev-parse --abbrev-ref HEAD > /genesis-back/bin/$BE_BIN_BASENAME.git_branch && git rev-parse HEAD > /genesis-back/bin/$BE_BIN_BASENAME.git_commit && mkdir -p /genesis-back/data/node1 && mv $GOPATH/bin/$BE_BIN_BASENAME /genesis-back/bin/$BE_BIN_BASENAME && rm -rf /go
2525

genesis-bf/genesis-scripts

genesis-blex/Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
FROM debian:stretch-slim
22

33
ENV BLEX_REPO_URL https://github.com/GenesisKernel/blockexplorer
4-
ENV BLEX_BRANCH v0.3.0
4+
ENV BLEX_BRANCH v0.3.2
55
ENV SCRIPTS_REPO_URL https://github.com/blitzstern5/genesis-scripts
6-
ENV SCRIPTS_BRANCH v0.2.0
6+
ENV SCRIPTS_BRANCH v0.2.1
77

88
RUN set -ex; apt-get update -y && \
99
mkdir -p /usr/share/man/man1 && mkdir -p /usr/share/man/man7 && \

genesis-blex/genesis-scripts

genesis-db/Dockerfile

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ RUN set -eux; \
2222
chown -R postgres:postgres /var/lib/postgresql
2323

2424
# grab gosu for easy step-down from root
25-
ENV GOSU_VERSION 1.10
25+
ENV GOSU_VERSION 1.11
2626
RUN set -x \
2727
&& apt-get update && apt-get install -y --no-install-recommends ca-certificates wget && rm -rf /var/lib/apt/lists/* \
2828
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
@@ -71,7 +71,7 @@ RUN set -ex; \
7171
apt-key list
7272

7373
ENV PG_MAJOR 11
74-
ENV PG_VERSION 11.1-1.pgdg90+1
74+
ENV PG_VERSION 11.1-3.pgdg90+1
7575

7676
RUN set -ex; \
7777
\
@@ -153,10 +153,13 @@ RUN set -ex; \
153153
find /usr -name '*.pyc' -type f -exec bash -c 'for pyc; do dpkg -S "$pyc" &> /dev/null || rm -vf "$pyc"; done' -- '{}' +
154154

155155
# make the sample config easier to munge (and "correct by default")
156-
RUN mv -v "/usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample" /usr/share/postgresql/ \
157-
&& ln -sv ../postgresql.conf.sample "/usr/share/postgresql/$PG_MAJOR/" \
158-
&& sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/share/postgresql/postgresql.conf.sample \
159-
&& sed -ri "s!^#?(max_connections)\s*=\s*\S+.*!\1 = 300!" /usr/share/postgresql/postgresql.conf.sample
156+
RUN set -eux; \
157+
dpkg-divert --add --rename --divert "/usr/share/postgresql/postgresql.conf.sample.dpkg" "/usr/share/postgresql/$PG_MAJOR/postgresql.conf.sample"; \
158+
cp -v /usr/share/postgresql/postgresql.conf.sample.dpkg /usr/share/postgresql/postgresql.conf.sample; \
159+
ln -sv ../postgresql.conf.sample "/usr/share/postgresql/$PG_MAJOR/"; \
160+
sed -ri "s!^#?(listen_addresses)\s*=\s*\S+.*!\1 = '*'!" /usr/share/postgresql/postgresql.conf.sample; \
161+
sed -ri "s!^#?(max_connections)\s*=\s*\S+.*!\1 = 300!" /usr/share/postgresql/postgresql.conf.sample; \
162+
grep -F "listen_addresses = '*'" /usr/share/postgresql/postgresql.conf.sample
160163

161164
RUN mkdir -p /var/run/postgresql && chown -R postgres:postgres /var/run/postgresql && chmod 2777 /var/run/postgresql
162165

genesis-db/docker-entrypoint.sh

Lines changed: 90 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
#!/bin/bash
2-
set -e
1+
#!/usr/bin/env bash
2+
set -Eeo pipefail
3+
# TODO swap to -Eeuo pipefail above (after handling all potentially-unset variables)
34

45
# usage: file_env VAR [DEFAULT]
56
# ie: file_env 'XYZ_DB_PASSWORD' 'example'
@@ -27,26 +28,75 @@ if [ "${1:0:1}" = '-' ]; then
2728
set -- postgres "$@"
2829
fi
2930

30-
if [ "$1" = 'postgres' ]; then
31+
# allow the container to be started with `--user`
32+
if [ "$1" = 'postgres' ] && [ "$(id -u)" = '0' ]; then
3133
mkdir -p "$PGDATA"
32-
chmod 700 "$PGDATA"
3334
chown -R postgres "$PGDATA"
35+
chmod 700 "$PGDATA"
3436

35-
mkdir -p /run/postgresql
36-
chmod g+s /run/postgresql
37-
chown -R postgres /run/postgresql
37+
mkdir -p /var/run/postgresql
38+
chown -R postgres /var/run/postgresql
39+
chmod 775 /var/run/postgresql
40+
41+
# Create the transaction log directory before initdb is run (below) so the directory is owned by the correct user
42+
if [ "$POSTGRES_INITDB_WALDIR" ]; then
43+
mkdir -p "$POSTGRES_INITDB_WALDIR"
44+
chown -R postgres "$POSTGRES_INITDB_WALDIR"
45+
chmod 700 "$POSTGRES_INITDB_WALDIR"
46+
fi
47+
48+
exec gosu postgres "$BASH_SOURCE" "$@"
49+
fi
50+
51+
if [ "$1" = 'postgres' ]; then
52+
mkdir -p "$PGDATA"
53+
chown -R "$(id -u)" "$PGDATA" 2>/dev/null || :
54+
chmod 700 "$PGDATA" 2>/dev/null || :
3855

3956
# look specifically for PG_VERSION, as it is expected in the DB dir
4057
if [ ! -s "$PGDATA/PG_VERSION" ]; then
58+
# "initdb" is particular about the current user existing in "/etc/passwd", so we use "nss_wrapper" to fake that if necessary
59+
# see https://github.com/docker-library/postgres/pull/253, https://github.com/docker-library/postgres/issues/359, https://cwrap.org/nss_wrapper.html
60+
if ! getent passwd "$(id -u)" &> /dev/null && [ -e /usr/lib/libnss_wrapper.so ]; then
61+
export LD_PRELOAD='/usr/lib/libnss_wrapper.so'
62+
export NSS_WRAPPER_PASSWD="$(mktemp)"
63+
export NSS_WRAPPER_GROUP="$(mktemp)"
64+
echo "postgres:x:$(id -u):$(id -g):PostgreSQL:$PGDATA:/bin/false" > "$NSS_WRAPPER_PASSWD"
65+
echo "postgres:x:$(id -g):" > "$NSS_WRAPPER_GROUP"
66+
fi
67+
68+
file_env 'POSTGRES_USER' 'postgres'
69+
file_env 'POSTGRES_PASSWORD'
70+
4171
file_env 'POSTGRES_INITDB_ARGS'
42-
eval "gosu postgres initdb $POSTGRES_INITDB_ARGS"
72+
if [ "$POSTGRES_INITDB_WALDIR" ]; then
73+
export POSTGRES_INITDB_ARGS="$POSTGRES_INITDB_ARGS --waldir $POSTGRES_INITDB_WALDIR"
74+
fi
75+
eval 'initdb --username="$POSTGRES_USER" --pwfile=<(echo "$POSTGRES_PASSWORD") '"$POSTGRES_INITDB_ARGS"
76+
77+
# unset/cleanup "nss_wrapper" bits
78+
if [ "${LD_PRELOAD:-}" = '/usr/lib/libnss_wrapper.so' ]; then
79+
rm -f "$NSS_WRAPPER_PASSWD" "$NSS_WRAPPER_GROUP"
80+
unset LD_PRELOAD NSS_WRAPPER_PASSWD NSS_WRAPPER_GROUP
81+
fi
4382

4483
# check password first so we can output the warning before postgres
4584
# messes it up
46-
file_env 'POSTGRES_PASSWORD'
47-
if [ "$POSTGRES_PASSWORD" ]; then
48-
pass="PASSWORD '$POSTGRES_PASSWORD'"
85+
if [ -n "$POSTGRES_PASSWORD" ]; then
4986
authMethod=md5
87+
88+
if [ "${#POSTGRES_PASSWORD}" -ge 100 ]; then
89+
cat >&2 <<-'EOWARN'
90+
91+
WARNING: The supplied POSTGRES_PASSWORD is 100+ characters.
92+
93+
This will not work if used via PGPASSWORD with "psql".
94+
95+
https://www.postgresql.org/message-id/flat/E1Rqxp2-0004Qt-PL%40wrigleys.postgresql.org (BUG #6412)
96+
https://github.com/docker-library/postgres/issues/507
97+
98+
EOWARN
99+
fi
50100
else
51101
# The - option suppresses leading tabs but *not* spaces. :)
52102
cat >&2 <<-'EOWARN'
@@ -57,67 +107,70 @@ if [ "$1" = 'postgres' ]; then
57107
Docker's default configuration, this is
58108
effectively any other container on the same
59109
system.
110+
60111
Use "-e POSTGRES_PASSWORD=password" to set
61112
it in "docker run".
62113
****************************************************
63114
EOWARN
64115

65-
pass=
66116
authMethod=trust
67117
fi
68118

69-
{ echo; echo "host all all all $authMethod"; } | gosu postgres tee -a "$PGDATA/pg_hba.conf" > /dev/null
119+
{
120+
echo
121+
echo "host all all all $authMethod"
122+
} >> "$PGDATA/pg_hba.conf"
70123

71-
# internal start of server in order to allow set-up using psql-client
124+
# internal start of server in order to allow set-up using psql-client
72125
# does not listen on external TCP/IP and waits until start finishes
73-
gosu postgres pg_ctl -D "$PGDATA" \
74-
-o "-c listen_addresses='localhost'" \
126+
PGUSER="${PGUSER:-$POSTGRES_USER}" \
127+
pg_ctl -D "$PGDATA" \
128+
-o "-c listen_addresses=''" \
75129
-w start
76130

77-
file_env 'POSTGRES_USER' 'postgres'
78131
file_env 'POSTGRES_DB' "$POSTGRES_USER"
79132

80-
psql=( psql -v ON_ERROR_STOP=1 )
133+
export PGPASSWORD="${PGPASSWORD:-$POSTGRES_PASSWORD}"
134+
psql=( psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --no-password )
81135

82136
if [ "$POSTGRES_DB" != 'postgres' ]; then
83-
"${psql[@]}" --username postgres <<-EOSQL
84-
CREATE DATABASE "$POSTGRES_DB" ;
137+
"${psql[@]}" --dbname postgres --set db="$POSTGRES_DB" <<-'EOSQL'
138+
CREATE DATABASE :"db" ;
85139
EOSQL
86140
echo
87141
fi
88-
89-
if [ "$POSTGRES_USER" = 'postgres' ]; then
90-
op='ALTER'
91-
else
92-
op='CREATE'
93-
fi
94-
"${psql[@]}" --username postgres <<-EOSQL
95-
$op USER "$POSTGRES_USER" WITH SUPERUSER $pass ;
96-
EOSQL
97-
echo
98-
99-
psql+=( --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" )
142+
psql+=( --dbname "$POSTGRES_DB" )
100143

101144
echo
102145
for f in /docker-entrypoint-initdb.d/*; do
103146
case "$f" in
104-
*.sh) echo "$0: running $f"; . "$f" ;;
147+
*.sh)
148+
# https://github.com/docker-library/postgres/issues/450#issuecomment-393167936
149+
# https://github.com/docker-library/postgres/pull/452
150+
if [ -x "$f" ]; then
151+
echo "$0: running $f"
152+
"$f"
153+
else
154+
echo "$0: sourcing $f"
155+
. "$f"
156+
fi
157+
;;
105158
*.sql) echo "$0: running $f"; "${psql[@]}" -f "$f"; echo ;;
106159
*.sql.gz) echo "$0: running $f"; gunzip -c "$f" | "${psql[@]}"; echo ;;
107160
*) echo "$0: ignoring $f" ;;
108161
esac
109162
echo
110163
done
111164

112-
gosu postgres pg_ctl -D "$PGDATA" -m fast -w stop
165+
PGUSER="${PGUSER:-$POSTGRES_USER}" \
166+
pg_ctl -D "$PGDATA" -m fast -w stop
167+
168+
unset PGPASSWORD
113169

114170
echo
115171
echo 'PostgreSQL init process complete; ready for start up.'
116172
echo
117173
fi
118-
119-
exec gosu postgres "$@"
120174
fi
121175

122176
exec "$@"
123-

0 commit comments

Comments
 (0)