Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

web-serving: fix startup of web-server as rootless #442

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion benchmarks/data-serving-relational/server/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 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
Expand Down
10 changes: 5 additions & 5 deletions benchmarks/data-serving-relational/server/docker-entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
5 changes: 3 additions & 2 deletions benchmarks/web-serving/web_server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ RUN mkdir /elgg_data
RUN chmod a+rw /elgg_data

# Copy over the Nginx Server configuration
COPY files/nginx_sites_avail_pt.append /tmp/
COPY files/nginx_sites_avail_tls.append /tmp/
RUN rm /etc/nginx/sites-enabled/default
COPY files/nginx_sites_avail_pt /etc/nginx/sites-available/
COPY files/nginx_sites_avail_tls /etc/nginx/sites-available/


RUN service nginx restart
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/web-serving/web_server/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ sed -i -e"s/mysql_server/${DB_SERVER_IP}/" elgg/elgg-config/settings.php
sed -i -e"s/'memcache_server'/'${MEMCACHE_SERVER_IP}'/" elgg/elgg-config/settings.php

if [ $PROTOCOL == 'https' ]; then
cat /tmp/nginx_sites_avail_tls.append >> /etc/nginx/sites-available/default
ln -sf ../sites-available/nginx_sites_avail_tls /etc/nginx/sites-enabled/cloudsuite
elif [ $PROTOCOL == 'http' ]; then
cat /tmp/nginx_sites_avail_pt.append >> /etc/nginx/sites-available/default
ln -sf ../sites-available/nginx_sites_avail_pt /etc/nginx/sites-enabled/cloudsuite
fi

FPM_CHILDREN=${5:-4}
Expand Down