Skip to content

Commit 6c37b92

Browse files
committed
fix(WARNING): MSG: WALE_S3_ENDPOINT defined, ignoring AWS_REGION
1 parent 50d89c3 commit 6c37b92

File tree

5 files changed

+12
-9
lines changed

5 files changed

+12
-9
lines changed

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ RUN apt-get purge -y --auto-remove $BUILD_DEPS && \
3636
COPY rootfs /
3737
ENV WALE_ENVDIR=/etc/wal-e.d/env
3838
RUN mkdir -p $WALE_ENVDIR
39-
RUN python3 /patcher-script.py
39+
RUN python3 /patcher-script.py /bin/create_bucket
40+
RUN python3 /patcher-script.py /usr/local/bin/wal-e
4041

4142
CMD ["/docker-entrypoint.sh", "postgres"]
4243
EXPOSE 5432

rootfs/bin/create_bucket

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def bucket_exists(conn, name):
2020
return True
2121

2222
bucket_name = os.getenv('BUCKET_NAME')
23-
region = os.getenv('AWS_REGION')
23+
region = os.getenv('S3_REGION')
2424

2525
if os.getenv('DATABASE_STORAGE') == "s3":
2626
conn = boto.s3.connect_to_region(region)
@@ -85,6 +85,6 @@ else:
8585
port=int(os.getenv('S3_PORT')),
8686
calling_format=OrdinaryCallingFormat())
8787
# HACK(bacongobbler): allow boto to connect to minio by changing the region name for s3v4 auth
88-
conn.auth_region_name = os.getenv('AWS_REGION')
88+
conn.auth_region_name = os.getenv('S3_REGION')
8989
if not bucket_exists(conn, bucket_name):
9090
conn.create_bucket(bucket_name)

rootfs/docker-entrypoint-initdb.d/001_setup_envdir.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ if [[ "$DATABASE_STORAGE" == "s3" || "$DATABASE_STORAGE" == "minio" ]]; then
3636
else
3737
echo "1" > AWS_INSTANCE_PROFILE
3838
fi
39-
echo $AWS_REGION > AWS_REGION
39+
echo $AWS_REGION > S3_REGION
4040
echo $BUCKET_NAME > BUCKET_NAME
4141
elif [ "$DATABASE_STORAGE" == "gcs" ]; then
4242
GOOGLE_APPLICATION_CREDENTIALS="/var/run/secrets/deis/objectstore/creds/key.json"

rootfs/patcher-script.d/patch_wal_e_s3.py renamed to rootfs/patcher-script.d/patch_boto_s3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ def patch_wal_e_hmac_auth_v4_handler():
44
_init = HmacAuthV4Handler.__init__
55
def wrap_init(self, *args, **kwargs):
66
_init(self, *args, **kwargs)
7-
self.region_name = os.getenv('AWS_REGION', self.region_name)
7+
self.region_name = os.getenv('S3_REGION', self.region_name)
88
HmacAuthV4Handler.__init__ = wrap_init
99

1010

rootfs/patcher-script.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import sys
2+
13
patch_script = """
24
35
def run_patch_scripts(patch_script_path):
@@ -15,18 +17,18 @@ def run_patch_scripts(patch_script_path):
1517
"""
1618

1719

18-
def main():
20+
def main(patch_file):
1921
result_list = []
20-
with open("/usr/local/bin/wal-e", "r") as f:
22+
with open(patch_file, "r") as f:
2123
has_patched = False
2224
for line in f:
2325
if not has_patched and line.startswith('import'):
2426
result_list.append(patch_script)
2527
has_patched = True
2628
result_list.append(line)
27-
with open("/usr/local/bin/wal-e", "w") as f:
29+
with open(patch_file, "w") as f:
2830
for line in result_list:
2931
f.write(line)
3032

3133
if __name__ == '__main__':
32-
main()
34+
main(sys.argv[1])

0 commit comments

Comments
 (0)