Skip to content

Commit a425f02

Browse files
committed
Add to rhel
1 parent cc975d7 commit a425f02

File tree

10 files changed

+114
-47
lines changed

10 files changed

+114
-47
lines changed

rstudio/c9s-python-3.11/Dockerfile.cpu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ RUN dnf -y module enable nginx:$NGINX_VERSION && \
126126

127127
# Configure httpd for CGI processing
128128
COPY --chown=1001:0 ${RSTUDIO_SOURCE_CODE}/httpd/httpd.conf /etc/httpd/conf/httpd.conf
129-
COPY --chown=1001:0 ${RSTUDIO_SOURCE_CODE}/httpd/codeserver-cgi.conf /etc/httpd/conf.d/codeserver-cgi.conf
129+
COPY --chown=1001:0 ${RSTUDIO_SOURCE_CODE}/httpd/rstudio-cgi.conf /etc/httpd/conf.d/rstudio-cgi.conf
130130

131131
# Copy extra files to the image.
132132
COPY --chown=1001:0 ${RSTUDIO_SOURCE_CODE}/nginx/root/ /

rstudio/c9s-python-3.11/Dockerfile.cuda

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ RUN dnf -y module enable nginx:$NGINX_VERSION && \
127127

128128
# Configure httpd for CGI processing
129129
COPY --chown=1001:0 ${RSTUDIO_SOURCE_CODE}/httpd/httpd.conf /etc/httpd/conf/httpd.conf
130-
COPY --chown=1001:0 ${RSTUDIO_SOURCE_CODE}/httpd/codeserver-cgi.conf /etc/httpd/conf.d/codeserver-cgi.conf
130+
COPY --chown=1001:0 ${RSTUDIO_SOURCE_CODE}/httpd/rstudio-cgi.conf /etc/httpd/conf.d/rstudio-cgi.conf
131131

132132
# Copy extra files to the image.
133133
COPY --chown=1001:0 ${RSTUDIO_SOURCE_CODE}/nginx/root/ /

rstudio/rhel9-python-3.11/Dockerfile.cpu

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,16 +129,23 @@ ENV NGINX_VERSION=1.24 \
129129

130130
# Modules does not exist
131131
RUN dnf -y module enable nginx:$NGINX_VERSION && \
132-
INSTALL_PKGS="nss_wrapper bind-utils gettext hostname nginx nginx-mod-stream nginx-mod-http-perl fcgiwrap initscripts chkconfig supervisor" && \
132+
INSTALL_PKGS="nss_wrapper bind-utils gettext hostname nginx nginx-mod-stream nginx-mod-http-perl httpd" && \
133133
dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \
134134
rpm -V $INSTALL_PKGS && \
135135
nginx -v 2>&1 | grep -qe "nginx/$NGINX_VERSION\." && echo "Found VERSION $NGINX_VERSION" && \
136136
dnf -y clean all --enablerepo='*'
137137

138-
COPY --chown=1001:0 ${RSTUDIO_SOURCE_CODE}/supervisord/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
138+
# Configure httpd for CGI processing
139+
COPY --chown=1001:0 ${RSTUDIO_SOURCE_CODE}/httpd/httpd.conf /etc/httpd/conf/httpd.conf
140+
COPY --chown=1001:0 ${RSTUDIO_SOURCE_CODE}/httpd/rstudio-cgi.conf /etc/httpd/conf.d/rstudio-cgi.conf
139141

140142
# Copy extra files to the image.
141-
COPY ${RSTUDIO_SOURCE_CODE}/nginx/root/ /
143+
COPY --chown=1001:0 ${RSTUDIO_SOURCE_CODE}/nginx/root/ /
144+
145+
# Configure nginx
146+
COPY ${RSTUDIO_SOURCE_CODE}/nginx/serverconf/ /opt/app-root/etc/nginx.default.d/
147+
COPY ${RSTUDIO_SOURCE_CODE}/nginx/httpconf/ /opt/app-root/etc/nginx.d/
148+
COPY ${RSTUDIO_SOURCE_CODE}/nginx/api/ /opt/app-root/api/
142149

143150
# Changing ownership and user rights to support following use-cases:
144151
# 1) running container on OpenShift, whose default security model
@@ -158,21 +165,23 @@ RUN sed -i -f ${NGINX_APP_ROOT}/nginxconf.sed ${NGINX_CONF_PATH} && \
158165
mkdir -p ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \
159166
mkdir -p ${NGINX_LOG_PATH} && \
160167
mkdir -p ${NGINX_PERL_MODULE_PATH} && \
168+
# Create httpd directories and set permissions
169+
mkdir -p /var/log/httpd /var/run/httpd /etc/httpd/logs && \
161170
chown -R 1001:0 ${NGINX_CONF_PATH} && \
162171
chown -R 1001:0 ${NGINX_APP_ROOT}/etc && \
163172
chown -R 1001:0 ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \
164173
chown -R 1001:0 /var/lib/nginx /var/log/nginx /run && \
174+
# Create httpd directories and set permissions
175+
mkdir -p /var/log/httpd /var/run/httpd /etc/httpd/logs && \
165176
chmod ug+rw ${NGINX_CONF_PATH} && \
166177
chmod -R ug+rwX ${NGINX_APP_ROOT}/etc && \
167178
chmod -R ug+rwX ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \
168179
chmod -R ug+rwX /var/lib/nginx /var/log/nginx /run && \
180+
chmod -R ug+rwX /var/log/httpd /var/run/httpd /etc/httpd/logs && \
181+
# Make CGI script executable
182+
chmod +x /opt/app-root/api/kernels/access.cgi && \
169183
rpm-file-permissions
170184

171-
# Configure nginx
172-
COPY ${RSTUDIO_SOURCE_CODE}/nginx/serverconf/ /opt/app-root/etc/nginx.default.d/
173-
COPY ${RSTUDIO_SOURCE_CODE}/nginx/httpconf/ /opt/app-root/etc/nginx.d/
174-
COPY ${RSTUDIO_SOURCE_CODE}/nginx/api/ /opt/app-root/api/
175-
176185
# Launcher
177186
WORKDIR /opt/app-root/bin
178187

rstudio/rhel9-python-3.11/Dockerfile.cuda

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -259,16 +259,23 @@ ENV NGINX_VERSION=1.24 \
259259

260260
# Modules does not exist
261261
RUN dnf -y module enable nginx:$NGINX_VERSION && \
262-
INSTALL_PKGS="nss_wrapper bind-utils gettext hostname nginx nginx-mod-stream nginx-mod-http-perl fcgiwrap initscripts chkconfig supervisor" && \
262+
INSTALL_PKGS="nss_wrapper bind-utils gettext hostname nginx nginx-mod-stream nginx-mod-http-perl httpd" && \
263263
dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \
264264
rpm -V $INSTALL_PKGS && \
265265
nginx -v 2>&1 | grep -qe "nginx/$NGINX_VERSION\." && echo "Found VERSION $NGINX_VERSION" && \
266266
dnf -y clean all --enablerepo='*'
267267

268-
COPY --chown=1001:0 ${RSTUDIO_SOURCE_CODE}/supervisord/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
268+
# Configure httpd for CGI processing
269+
COPY --chown=1001:0 ${RSTUDIO_SOURCE_CODE}/httpd/httpd.conf /etc/httpd/conf/httpd.conf
270+
COPY --chown=1001:0 ${RSTUDIO_SOURCE_CODE}/httpd/rstudio-cgi.conf /etc/httpd/conf.d/rstudio-cgi.conf
269271

270272
# Copy extra files to the image.
271-
COPY ${RSTUDIO_SOURCE_CODE}/nginx/root/ /
273+
COPY --chown=1001:0 ${RSTUDIO_SOURCE_CODE}/nginx/root/ /
274+
275+
# Configure nginx
276+
COPY ${RSTUDIO_SOURCE_CODE}/nginx/serverconf/ /opt/app-root/etc/nginx.default.d/
277+
COPY ${RSTUDIO_SOURCE_CODE}/nginx/httpconf/ /opt/app-root/etc/nginx.d/
278+
COPY ${RSTUDIO_SOURCE_CODE}/nginx/api/ /opt/app-root/api/
272279

273280
# Changing ownership and user rights to support following use-cases:
274281
# 1) running container on OpenShift, whose default security model
@@ -288,21 +295,23 @@ RUN sed -i -f ${NGINX_APP_ROOT}/nginxconf.sed ${NGINX_CONF_PATH} && \
288295
mkdir -p ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \
289296
mkdir -p ${NGINX_LOG_PATH} && \
290297
mkdir -p ${NGINX_PERL_MODULE_PATH} && \
298+
# Create httpd directories and set permissions
299+
mkdir -p /var/log/httpd /var/run/httpd /etc/httpd/logs && \
291300
chown -R 1001:0 ${NGINX_CONF_PATH} && \
292301
chown -R 1001:0 ${NGINX_APP_ROOT}/etc && \
293302
chown -R 1001:0 ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \
294303
chown -R 1001:0 /var/lib/nginx /var/log/nginx /run && \
304+
# Create httpd directories and set permissions
305+
mkdir -p /var/log/httpd /var/run/httpd /etc/httpd/logs && \
295306
chmod ug+rw ${NGINX_CONF_PATH} && \
296307
chmod -R ug+rwX ${NGINX_APP_ROOT}/etc && \
297308
chmod -R ug+rwX ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \
298309
chmod -R ug+rwX /var/lib/nginx /var/log/nginx /run && \
310+
chmod -R ug+rwX /var/log/httpd /var/run/httpd /etc/httpd/logs && \
311+
# Make CGI script executable
312+
chmod +x /opt/app-root/api/kernels/access.cgi && \
299313
rpm-file-permissions
300314

301-
# Configure nginx
302-
COPY ${RSTUDIO_SOURCE_CODE}/nginx/serverconf/ /opt/app-root/etc/nginx.default.d/
303-
COPY ${RSTUDIO_SOURCE_CODE}/nginx/httpconf/ /opt/app-root/etc/nginx.d/
304-
COPY ${RSTUDIO_SOURCE_CODE}/nginx/api/ /opt/app-root/api/
305-
306315
# Launcher
307316
WORKDIR /opt/app-root/bin
308317

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Basic httpd configuration for CGI processing
2+
ServerRoot "/etc/httpd"
3+
Listen 8080
4+
5+
# Load modules
6+
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
7+
LoadModule authz_core_module modules/mod_authz_core.so
8+
LoadModule mime_module modules/mod_mime.so
9+
LoadModule dir_module modules/mod_dir.so
10+
LoadModule cgi_module modules/mod_cgi.so
11+
LoadModule rewrite_module modules/mod_rewrite.so
12+
13+
# User and Group - run as the container user (OpenShift assigns random UIDs)
14+
# User 1001
15+
# Group 0
16+
17+
# Server configuration
18+
ServerAdmin root@localhost
19+
ServerName localhost
20+
21+
# Document root
22+
DocumentRoot "/opt/app-root"
23+
24+
# Directory configuration
25+
<Directory />
26+
AllowOverride none
27+
Require all denied
28+
</Directory>
29+
30+
<Directory "/opt/app-root">
31+
AllowOverride None
32+
Options +ExecCGI
33+
Require all granted
34+
AddHandler cgi-script .cgi
35+
</Directory>
36+
37+
# Error and access logs
38+
ErrorLog "/var/log/httpd/error_log"
39+
LogLevel warn
40+
41+
# Include additional configurations
42+
# IncludeOptional conf.d/*.conf
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# RStudio-server CGI configuration
2+
# This configuration handles the /api/kernels/ endpoint for culling
3+
4+
# Enable CGI for the kernels API endpoint
5+
<LocationMatch "^/api/kernels/">
6+
SetHandler cgi-script
7+
Options +ExecCGI
8+
Require all granted
9+
</LocationMatch>
10+
11+
# Set the CGI script path
12+
ScriptAlias /api/kernels/ /opt/app-root/api/kernels/
13+
14+
# Ensure the CGI script is executable
15+
<Directory "/opt/app-root/api/kernels">
16+
Options +ExecCGI
17+
AddHandler cgi-script .cgi
18+
Require all granted
19+
</Directory>

rstudio/rhel9-python-3.11/nginx/serverconf/proxy.conf.template

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,13 @@ location = /api/kernels {
2525
}
2626

2727
location /api/kernels/ {
28-
index access.cgi;
29-
fastcgi_index access.cgi;
30-
gzip off;
31-
access_log off;
32-
root /opt/app-root;
33-
fastcgi_pass unix:/var/run/fcgiwrap.socket;
34-
include /etc/nginx/fastcgi_params;
35-
fastcgi_param SCRIPT_FILENAME /opt/app-root$fastcgi_script_name;
28+
proxy_pass http://localhost:8080;
29+
proxy_set_header Host $host;
30+
proxy_set_header X-Real-IP $remote_addr;
31+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
32+
proxy_set_header X-Forwarded-Proto $scheme;
33+
gzip off;
34+
access_log off;
3635
}
3736
###############
3837

rstudio/rhel9-python-3.11/nginx/serverconf/proxy.conf.template_nbprefix

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,13 @@ location ${NB_PREFIX}/api/kernels/ {
4444
}
4545

4646
location /api/kernels/ {
47-
index access.cgi;
48-
fastcgi_index access.cgi;
49-
gzip off;
50-
access_log off;
51-
root /opt/app-root;
52-
fastcgi_pass unix:/var/run/fcgiwrap.socket;
53-
include /etc/nginx/fastcgi_params;
54-
fastcgi_param SCRIPT_FILENAME /opt/app-root$fastcgi_script_name;
47+
proxy_pass http://localhost:8080;
48+
proxy_set_header Host $host;
49+
proxy_set_header X-Real-IP $remote_addr;
50+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
51+
proxy_set_header X-Forwarded-Proto $scheme;
52+
gzip off;
53+
access_log off;
5554
}
5655
###############
5756

rstudio/rhel9-python-3.11/run-rstudio.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
SCRIPT_DIR=$(dirname -- "$0")
55
source ${SCRIPT_DIR}/utils/*.sh
66

7-
# Start nginx and supervisord
7+
# Start nginx and httpd
88
run-nginx.sh &
9-
/usr/bin/supervisord -c /etc/supervisor/conf.d/supervisord.conf &
9+
/usr/sbin/httpd -D FOREGROUND &
1010

1111

1212
# Add .bashrc for custom promt if not present
@@ -22,7 +22,7 @@ do
2222
if [ ! -d "/opt/app-root/src/Rpackages/4.4/$package_folder" ]; then
2323
cp -r /opt/app-root/bin/Rpackages/4.4/$package_folder /opt/app-root/src/Rpackages/4.4/
2424
fi
25-
done
25+
done
2626
# rstudio terminal can't see environment variables set by the container runtime;
2727
# so we set all env variables to the Renviron.site config file. For kubectl, we need the KUBERNETES_* env vars at least.
2828
# Also, we store proxy-related env vars lowercased by key so RStudio projects work with proxy by default

rstudio/rhel9-python-3.11/supervisord/supervisord.conf

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)