Skip to content

Commit 20c51c5

Browse files
committed
fix(registry): python workaround for ssl connections if > 2.7.8
1 parent 645579c commit 20c51c5

5 files changed

Lines changed: 22 additions & 16 deletions

File tree

builder/image/etc/ssh/sshd_config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ X11Forwarding no
2323
X11DisplayOffset 10
2424
PrintMotd no
2525
PrintLastLog yes
26+
TCPKeepAlive yes
2627
#AcceptEnv LANG LC_*
2728
Subsystem sftp /usr/lib/openssh/sftp-server
2829
UseDNS no

database/bin/boot

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ done
6060

6161
# initialize database if one doesn't already exist
6262
# for example, in the case of a data container
63-
if [[ ! -d /var/lib/postgresql/main ]]; then
63+
if [[ ! -d /var/lib/postgresql/9.3/main ]]; then
6464
chown -R postgres:postgres /var/lib/postgresql
65-
sudo -u postgres /usr/bin/initdb -D /var/lib/postgresql/main
65+
sudo -u postgres /usr/bin/initdb -D /var/lib/postgresql/9.3/main
6666
fi
6767

6868
# ensure WAL log bucket exists
@@ -71,24 +71,24 @@ INIT_ID=$(etcdctl get $ETCD_PATH/initId 2> /dev/null || echo none)
7171
echo "database: expecting initialization id: $INIT_ID"
7272

7373
initial_backup=0
74-
if [[ "$(cat /var/lib/postgresql/main/initialized 2> /dev/null)" != "$INIT_ID" ]]; then
74+
if [[ "$(cat /var/lib/postgresql/9.3/main/initialized 2> /dev/null)" != "$INIT_ID" ]]; then
7575
echo "database: no existing database found or it is outdated."
7676
# check if there are any backups -- if so, let's restore
7777
# we could probably do better than just testing number of lines -- one line is just a heading, meaning no backups
7878
if [[ `envdir /etc/wal-e.d/env wal-e --terse backup-list | wc -l` -gt "1" ]]; then
7979
echo "database: restoring from backup..."
80-
rm -rf /var/lib/postgresql/main
81-
sudo -u postgres envdir /etc/wal-e.d/env wal-e backup-fetch /var/lib/postgresql/main LATEST
82-
chown -R postgres:postgres /var/lib/postgresql/main
83-
chmod 0700 /var/lib/postgresql/main
84-
echo "restore_command = 'envdir /etc/wal-e.d/env wal-e wal-fetch \"%f\" \"%p\"'" | sudo -u postgres tee /var/lib/postgresql/main/recovery.conf >/dev/null
80+
rm -rf /var/lib/postgresql/9.3/main
81+
sudo -u postgres envdir /etc/wal-e.d/env wal-e backup-fetch /var/lib/postgresql/9.3/main LATEST
82+
chown -R postgres:postgres /var/lib/postgresql/9.3/main
83+
chmod 0700 /var/lib/postgresql/9.3/main
84+
echo "restore_command = 'envdir /etc/wal-e.d/env wal-e wal-fetch \"%f\" \"%p\"'" | sudo -u postgres tee /var/lib/postgresql/9.3/main/recovery.conf >/dev/null
8585
else
8686
echo "database: no backups found. Initializing a new database..."
8787
initial_backup=1
8888
fi
8989
# either way, we mark the database as initialized
9090
INIT_ID=$(cat /proc/sys/kernel/random/uuid)
91-
echo $INIT_ID > /var/lib/postgresql/main/initialized
91+
echo $INIT_ID > /var/lib/postgresql/9.3/main/initialized
9292
etcdctl --no-sync -C $ETCD set $ETCD_PATH/initId $INIT_ID >/dev/null
9393
else
9494
echo "database: existing data directory found. Starting postgres..."
@@ -122,7 +122,7 @@ sleep 1 && while [[ -z $(netstat -lnt | awk "\$6 == \"LISTEN\" && \$4 ~ \".5432\
122122
if [[ "${initial_backup}" == "1" ]] ; then
123123
echo "database: performing an initial backup..."
124124
# perform an initial backup
125-
sudo -u postgres envdir /etc/wal-e.d/env wal-e backup-push /var/lib/postgresql/main
125+
sudo -u postgres envdir /etc/wal-e.d/env wal-e backup-push /var/lib/postgresql/9.3/main
126126
fi
127127

128128
echo "database: postgres is running..."
@@ -148,11 +148,11 @@ if [[ ! -z $EXTERNAL_PORT ]]; then
148148
# we really need cron :(
149149
if [[ "${count}" -ge "${BACKUP_FREQUENCY}" ]] ; then
150150
echo "database: performing a backup..."
151-
if [[ -f /var/lib/postgresql/main/recovery.conf ]] ; then
151+
if [[ -f /var/lib/postgresql/9.3/main/recovery.conf ]] ; then
152152
echo "database: database is currently recovering from a backup. Will try again next loop..."
153153
else
154154
# perform a backup
155-
sudo -u postgres envdir /etc/wal-e.d/env wal-e backup-push /var/lib/postgresql/main
155+
sudo -u postgres envdir /etc/wal-e.d/env wal-e backup-push /var/lib/postgresql/9.3/main
156156
# only retain the latest BACKUPS_TO_RETAIN backups
157157
sudo -u postgres envdir /etc/wal-e.d/env wal-e delete --confirm retain ${BACKUPS_TO_RETAIN}
158158
count=0

database/templates/postgresql.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
# The default values of these variables are driven from the -D command-line
3939
# option or PGDATA environment variable, represented here as ConfigDir.
4040

41-
data_directory = '/var/lib/postgresql/main' # use data in another directory
41+
data_directory = '/var/lib/postgresql/9.3/main' # use data in another directory
4242
# (change requires restart)
4343
hba_file = '/etc/postgresql/main/pg_hba.conf' # host-based authentication file
4444
# (change requires restart)

registry/build.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,25 @@ fi
1414
apk add --update-cache \
1515
build-base \
1616
git \
17-
libevent-dev \
1817
openssl-dev \
1918
python-dev \
19+
libffi-dev \
2020
swig \
21+
libevent-dev \
2122
xz-dev
2223

2324
# install pip
2425
curl -sSL https://raw.githubusercontent.com/pypa/pip/6.1.1/contrib/get-pip.py | python -
2526

27+
# workaround to python > 2.7.8 SSL issues
28+
pip install pyopenssl ndg-httpsclient pyasn1
29+
2630
# create a registry user
2731
adduser -D -s /bin/bash registry
2832

2933
# add the docker registry source from github
3034
git clone -b new-repository-import-v091 --single-branch https://github.com/deis/docker-registry /docker-registry && \
31-
chown -R registry:registry /docker-registry
35+
chown -R registry:registry /docker-registry
3236

3337
# install boto configuration
3438
cp /docker-registry/config/boto.cfg /etc/boto.cfg
@@ -49,4 +53,5 @@ apk del --purge \
4953
build-base \
5054
linux-headers \
5155
python-dev
56+
5257
rm -rf /var/cache/apk/*

tests/fixtures/test-etcd/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ RUN curl -sSL -o /usr/local/bin/etcdctl https://s3-us-west-2.amazonaws.com/opdem
1111
RUN buildDeps='curl git-core'; \
1212
set -x; \
1313
apt-get update && apt-get install -y $buildDeps --no-install-recommends \
14-
&& curl -sSL https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz | tar -C /usr/local -xz \
14+
&& curl -sSL https://storage.googleapis.com/golang/go1.4.1.linux-amd64.tar.gz | tar -C /usr/local -xz \
1515
&& git clone -q https://github.com/coreos/etcd.git /opt/etcd \
1616
&& cd /opt/etcd && git checkout -q v0.4.6 && PATH=/usr/local/go/bin:$PATH ./build \
1717
&& cp /opt/etcd/bin/etcd /usr/local/bin \

0 commit comments

Comments
 (0)