From a67b88d862f203641521a81424efbaa2d46f3b25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tiziano=20M=C3=BCller?= Date: Wed, 29 Nov 2023 13:41:09 +0100 Subject: [PATCH] data-serving-relational: use gosu instead of sudo for tty-less operation --- benchmarks/data-serving-relational/server/Dockerfile | 6 +++++- .../server/docker-entrypoint.py | 10 +++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/benchmarks/data-serving-relational/server/Dockerfile b/benchmarks/data-serving-relational/server/Dockerfile index 5273de01..b19b0563 100644 --- a/benchmarks/data-serving-relational/server/Dockerfile +++ b/benchmarks/data-serving-relational/server/Dockerfile @@ -1,7 +1,11 @@ FROM cloudsuite/postgresql:15 # Install sudo for user switching -RUN apt update && apt install sudo python3 -y +RUN set -eux ; \ + apt update ; \ + apt install sudo python3 gosu -y ; \ + rm -rf /var/lib/apt/lists/* ; \ + gosu postgres true # Make the database access public RUN echo 'host\tall\tcloudsuite\t0.0.0.0/0\tscram-sha-256' >> /etc/postgresql/15/main/pg_hba.conf diff --git a/benchmarks/data-serving-relational/server/docker-entrypoint.py b/benchmarks/data-serving-relational/server/docker-entrypoint.py index 73422e83..24dba764 100644 --- a/benchmarks/data-serving-relational/server/docker-entrypoint.py +++ b/benchmarks/data-serving-relational/server/docker-entrypoint.py @@ -81,8 +81,8 @@ def save_dict(config_dict, lines): f.writelines(file_txt) os.system("service postgresql start") -os.system("sudo -u postgres psql -c \"CREATE USER cloudsuite WITH PASSWORD 'cloudsuite';\"") # Create the user called `cloudsuite` -os.system("sudo -u postgres psql -c \"CREATE DATABASE sbtest;\"") # Create a table named sbtest -os.system("sudo -u postgres psql -c \"GRANT ALL PRIVILEGES ON DATABASE sbtest TO cloudsuite\"") # Gave permission to this table -os.system("sudo -u postgres psql sbtest -c \"GRANT ALL ON SCHEMA public TO cloudsuite;\"") -os.system("sudo -u postgres psql") +os.system("gosu postgres psql -c \"CREATE USER cloudsuite WITH PASSWORD 'cloudsuite';\"") # Create the user called `cloudsuite` +os.system("gosu postgres psql -c \"CREATE DATABASE sbtest;\"") # Create a table named sbtest +os.system("gosu postgres psql -c \"GRANT ALL PRIVILEGES ON DATABASE sbtest TO cloudsuite\"") # Gave permission to this table +os.system("gosu postgres psql sbtest -c \"GRANT ALL ON SCHEMA public TO cloudsuite;\"") +os.system("gosu postgres psql")