Skip to content

Commit 664aee1

Browse files
committed
Add to rhel
1 parent cc975d7 commit 664aee1

File tree

15 files changed

+278
-94
lines changed

15 files changed

+278
-94
lines changed

rstudio/c9s-python-3.11/Dockerfile.cpu

Lines changed: 4 additions & 2 deletions
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/ /
@@ -167,8 +167,10 @@ RUN sed -i -f ${NGINX_APP_ROOT}/nginxconf.sed ${NGINX_CONF_PATH} && \
167167
chmod -R ug+rwX ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \
168168
chmod -R ug+rwX /var/lib/nginx /var/log/nginx /run && \
169169
chmod -R ug+rwX /var/log/httpd /var/run/httpd /etc/httpd/logs && \
170-
# Make CGI script executable
170+
# Make CGI scripts executable and set proper ownership
171171
chmod +x /opt/app-root/api/kernels/access.cgi && \
172+
chmod +x /opt/app-root/api/probe.cgi && \
173+
chown -R 1001:0 /opt/app-root/api && \
172174
rpm-file-permissions
173175

174176
# Launcher

rstudio/c9s-python-3.11/Dockerfile.cuda

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,8 @@ RUN R -f ./install_packages.R && \
107107
rm ./install_packages.R
108108

109109
# Install NGINX to proxy RStudio and pass probes check
110-
ENV NGINX_VERSION=1.24 \
110+
ENV APP_ROOT=/opt/app-root \
111+
NGINX_VERSION=1.24 \
111112
NGINX_SHORT_VER=124 \
112113
NGINX_CONFIGURATION_PATH=${APP_ROOT}/etc/nginx.d \
113114
NGINX_CONF_PATH=/etc/nginx/nginx.conf \
@@ -127,7 +128,7 @@ RUN dnf -y module enable nginx:$NGINX_VERSION && \
127128

128129
# Configure httpd for CGI processing
129130
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
131+
COPY --chown=1001:0 ${RSTUDIO_SOURCE_CODE}/httpd/rstudio-cgi.conf /etc/httpd/conf.d/rstudio-cgi.conf
131132

132133
# Copy extra files to the image.
133134
COPY --chown=1001:0 ${RSTUDIO_SOURCE_CODE}/nginx/root/ /
@@ -168,8 +169,10 @@ RUN sed -i -f ${NGINX_APP_ROOT}/nginxconf.sed ${NGINX_CONF_PATH} && \
168169
chmod -R ug+rwX ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \
169170
chmod -R ug+rwX /var/lib/nginx /var/log/nginx /run && \
170171
chmod -R ug+rwX /var/log/httpd /var/run/httpd /etc/httpd/logs && \
171-
# Make CGI script executable
172+
# Make CGI scripts executable and set proper ownership
172173
chmod +x /opt/app-root/api/kernels/access.cgi && \
174+
chmod +x /opt/app-root/api/probe.cgi && \
175+
chown -R 1001:0 /opt/app-root/api && \
173176
rpm-file-permissions
174177

175178
# Launcher

rstudio/c9s-python-3.11/httpd/httpd.conf

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,21 @@ Listen 8080
44

55
# Load modules
66
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
7+
LoadModule unixd_module modules/mod_unixd.so
78
LoadModule authz_core_module modules/mod_authz_core.so
89
LoadModule mime_module modules/mod_mime.so
10+
LoadModule alias_module modules/mod_alias.so
911
LoadModule dir_module modules/mod_dir.so
12+
LoadModule autoindex_module modules/mod_autoindex.so
1013
LoadModule cgi_module modules/mod_cgi.so
1114
LoadModule rewrite_module modules/mod_rewrite.so
1215

1316
# User and Group - run as the container user (OpenShift assigns random UIDs)
14-
# User 1001
15-
# Group 0
17+
User default
18+
Group root
19+
20+
# PidFile for process management
21+
PidFile /var/run/httpd/httpd.pid
1622

1723
# Server configuration
1824
ServerAdmin root@localhost
@@ -38,5 +44,11 @@ DocumentRoot "/opt/app-root"
3844
ErrorLog "/var/log/httpd/error_log"
3945
LogLevel warn
4046

41-
# Include additional configurations
42-
# IncludeOptional conf.d/*.conf
47+
# Types configuration
48+
TypesConfig /etc/mime.types
49+
50+
# Include additional configurations (exclude SSL)
51+
IncludeOptional conf.d/autoindex.conf
52+
IncludeOptional conf.d/userdir.conf
53+
IncludeOptional conf.d/welcome.conf
54+
IncludeOptional conf.d/rstudio-cgi.conf

rstudio/c9s-python-3.11/httpd/rstudio-cgi.conf

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,25 @@
11
# RStudio-server CGI configuration
2-
# This configuration handles the /api/kernels/ endpoint for culling
2+
# This configuration handles the /api/ endpoints for culling and health checks
33

4-
# Enable CGI for the kernels API endpoint
5-
<LocationMatch "^/api/kernels/">
4+
# Set the CGI script paths
5+
ScriptAlias /api/kernels/ /opt/app-root/api/kernels/access.cgi
6+
ScriptAlias /api/probe /opt/app-root/api/probe.cgi
7+
ScriptAlias /api /opt/app-root/api/probe.cgi
8+
9+
# Enable CGI for the API endpoints
10+
<LocationMatch "^/api/?">
611
SetHandler cgi-script
712
Options +ExecCGI
813
Require all granted
914
</LocationMatch>
1015

11-
# Set the CGI script path
12-
ScriptAlias /api/kernels/ /opt/app-root/api/kernels/
16+
# Ensure the CGI scripts are executable
17+
<Directory "/opt/app-root/api">
18+
Options +ExecCGI
19+
AddHandler cgi-script .cgi
20+
Require all granted
21+
</Directory>
1322

14-
# Ensure the CGI script is executable
1523
<Directory "/opt/app-root/api/kernels">
1624
Options +ExecCGI
1725
AddHandler cgi-script .cgi

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

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,16 @@ rewrite ^/auth-sign-out(.*) "$custom_scheme://$http_host/rstudio/auth-sign-out$1
66
###############
77

88
###############
9-
# api calls from probes get to CGI processing
9+
# api calls from probes get to CGI processing via Apache
1010
###############
1111
location /api/ {
12-
index probe.cgi;
13-
fastcgi_index probe.cgi;
12+
proxy_pass http://localhost:8080;
13+
proxy_set_header Host $host;
14+
proxy_set_header X-Real-IP $remote_addr;
15+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
16+
proxy_set_header X-Forwarded-Proto $scheme;
1417
gzip off;
15-
access_log off;
16-
root /opt/app-root;
17-
fastcgi_pass unix:/var/run/fcgiwrap.socket;
18-
include /etc/nginx/fastcgi_params;
19-
fastcgi_param SCRIPT_FILENAME /opt/app-root$fastcgi_script_name;
18+
access_log off;
2019
}
2120

2221
location = /api/kernels {
@@ -33,6 +32,16 @@ location /api/kernels/ {
3332
gzip off;
3433
access_log off;
3534
}
35+
36+
location = /api/probe {
37+
proxy_pass http://localhost:8080;
38+
proxy_set_header Host $host;
39+
proxy_set_header X-Real-IP $remote_addr;
40+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
41+
proxy_set_header X-Forwarded-Proto $scheme;
42+
gzip off;
43+
access_log off;
44+
}
3645
###############
3746

3847
###############

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

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,23 @@ location ${NB_PREFIX}/api/ {
1919
}
2020

2121
location /api/ {
22-
index probe.cgi;
23-
fastcgi_index probe.cgi;
22+
proxy_pass http://localhost:8080;
23+
proxy_set_header Host $host;
24+
proxy_set_header X-Real-IP $remote_addr;
25+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
26+
proxy_set_header X-Forwarded-Proto $scheme;
2427
gzip off;
25-
access_log off;
26-
root /opt/app-root;
27-
fastcgi_pass unix:/var/run/fcgiwrap.socket;
28-
include /etc/nginx/fastcgi_params;
29-
fastcgi_param SCRIPT_FILENAME /opt/app-root$fastcgi_script_name;
28+
access_log off;
29+
}
30+
31+
location = /api/probe {
32+
proxy_pass http://localhost:8080;
33+
proxy_set_header Host $host;
34+
proxy_set_header X-Real-IP $remote_addr;
35+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
36+
proxy_set_header X-Forwarded-Proto $scheme;
37+
gzip off;
38+
access_log off;
3039
}
3140
###############
3241

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,22 @@ source ${SCRIPT_DIR}/utils/*.sh
66

77
# Start nginx and httpd
88
run-nginx.sh &
9+
10+
# Start Apache httpd with error checking
11+
echo "Starting Apache httpd..."
912
/usr/sbin/httpd -D FOREGROUND &
13+
HTTPD_PID=$!
14+
sleep 2
15+
16+
# Check if Apache started successfully
17+
if ! kill -0 $HTTPD_PID 2>/dev/null; then
18+
echo "ERROR: Apache httpd failed to start"
19+
echo "Checking Apache configuration..."
20+
/usr/sbin/httpd -t
21+
exit 1
22+
else
23+
echo "Apache httpd started successfully (PID: $HTTPD_PID)"
24+
fi
1025

1126

1227
# Add .bashrc for custom promt if not present

rstudio/rhel9-python-3.11/Dockerfile.cpu

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ USER 1001
3030
WORKDIR /opt/app-root/src
3131

3232
#####################
33-
# rstudio #
33+
# rstudio #
3434
#####################
3535
FROM base AS rstudio
3636

@@ -117,7 +117,8 @@ COPY ${RSTUDIO_SOURCE_CODE}/rsession.conf /etc/rstudio/rsession.conf
117117
RUN R -e "install.packages('Rcpp')"
118118

119119
# Install NGINX to proxy RStudio and pass probes check
120-
ENV NGINX_VERSION=1.24 \
120+
ENV APP_ROOT=/opt/app-root \
121+
NGINX_VERSION=1.24 \
121122
NGINX_SHORT_VER=124 \
122123
NGINX_CONFIGURATION_PATH=${APP_ROOT}/etc/nginx.d \
123124
NGINX_CONF_PATH=/etc/nginx/nginx.conf \
@@ -129,16 +130,23 @@ ENV NGINX_VERSION=1.24 \
129130

130131
# Modules does not exist
131132
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" && \
133+
INSTALL_PKGS="nss_wrapper bind-utils gettext hostname nginx nginx-mod-stream nginx-mod-http-perl httpd" && \
133134
dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \
134135
rpm -V $INSTALL_PKGS && \
135136
nginx -v 2>&1 | grep -qe "nginx/$NGINX_VERSION\." && echo "Found VERSION $NGINX_VERSION" && \
136137
dnf -y clean all --enablerepo='*'
137138

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

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

143151
# Changing ownership and user rights to support following use-cases:
144152
# 1) running container on OpenShift, whose default security model
@@ -158,21 +166,25 @@ RUN sed -i -f ${NGINX_APP_ROOT}/nginxconf.sed ${NGINX_CONF_PATH} && \
158166
mkdir -p ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \
159167
mkdir -p ${NGINX_LOG_PATH} && \
160168
mkdir -p ${NGINX_PERL_MODULE_PATH} && \
169+
# Create httpd directories and set permissions
170+
mkdir -p /var/log/httpd /var/run/httpd /etc/httpd/logs && \
161171
chown -R 1001:0 ${NGINX_CONF_PATH} && \
162172
chown -R 1001:0 ${NGINX_APP_ROOT}/etc && \
163173
chown -R 1001:0 ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \
164174
chown -R 1001:0 /var/lib/nginx /var/log/nginx /run && \
175+
# Create httpd directories and set permissions
176+
mkdir -p /var/log/httpd /var/run/httpd /etc/httpd/logs && \
165177
chmod ug+rw ${NGINX_CONF_PATH} && \
166178
chmod -R ug+rwX ${NGINX_APP_ROOT}/etc && \
167179
chmod -R ug+rwX ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \
168180
chmod -R ug+rwX /var/lib/nginx /var/log/nginx /run && \
181+
chmod -R ug+rwX /var/log/httpd /var/run/httpd /etc/httpd/logs && \
182+
# Make CGI scripts executable and set proper ownership
183+
chmod +x /opt/app-root/api/kernels/access.cgi && \
184+
chmod +x /opt/app-root/api/probe.cgi && \
185+
chown -R 1001:0 /opt/app-root/api && \
169186
rpm-file-permissions
170187

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-
176188
# Launcher
177189
WORKDIR /opt/app-root/bin
178190

rstudio/rhel9-python-3.11/Dockerfile.cuda

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,8 @@ COPY ${RSTUDIO_SOURCE_CODE}/rsession.conf /etc/rstudio/rsession.conf
247247
RUN R -e "install.packages('Rcpp')"
248248

249249
# Install NGINX to proxy RStudio and pass probes check
250-
ENV NGINX_VERSION=1.24 \
250+
ENV APP_ROOT=/opt/app-root \
251+
NGINX_VERSION=1.24 \
251252
NGINX_SHORT_VER=124 \
252253
NGINX_CONFIGURATION_PATH=${APP_ROOT}/etc/nginx.d \
253254
NGINX_CONF_PATH=/etc/nginx/nginx.conf \
@@ -259,16 +260,23 @@ ENV NGINX_VERSION=1.24 \
259260

260261
# Modules does not exist
261262
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" && \
263+
INSTALL_PKGS="nss_wrapper bind-utils gettext hostname nginx nginx-mod-stream nginx-mod-http-perl httpd" && \
263264
dnf install -y --setopt=tsflags=nodocs $INSTALL_PKGS && \
264265
rpm -V $INSTALL_PKGS && \
265266
nginx -v 2>&1 | grep -qe "nginx/$NGINX_VERSION\." && echo "Found VERSION $NGINX_VERSION" && \
266267
dnf -y clean all --enablerepo='*'
267268

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

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

273281
# Changing ownership and user rights to support following use-cases:
274282
# 1) running container on OpenShift, whose default security model
@@ -288,21 +296,25 @@ RUN sed -i -f ${NGINX_APP_ROOT}/nginxconf.sed ${NGINX_CONF_PATH} && \
288296
mkdir -p ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \
289297
mkdir -p ${NGINX_LOG_PATH} && \
290298
mkdir -p ${NGINX_PERL_MODULE_PATH} && \
299+
# Create httpd directories and set permissions
300+
mkdir -p /var/log/httpd /var/run/httpd /etc/httpd/logs && \
291301
chown -R 1001:0 ${NGINX_CONF_PATH} && \
292302
chown -R 1001:0 ${NGINX_APP_ROOT}/etc && \
293303
chown -R 1001:0 ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \
294304
chown -R 1001:0 /var/lib/nginx /var/log/nginx /run && \
305+
# Create httpd directories and set permissions
306+
mkdir -p /var/log/httpd /var/run/httpd /etc/httpd/logs && \
295307
chmod ug+rw ${NGINX_CONF_PATH} && \
296308
chmod -R ug+rwX ${NGINX_APP_ROOT}/etc && \
297309
chmod -R ug+rwX ${NGINX_CONTAINER_SCRIPTS_PATH}/nginx-start && \
298310
chmod -R ug+rwX /var/lib/nginx /var/log/nginx /run && \
311+
chmod -R ug+rwX /var/log/httpd /var/run/httpd /etc/httpd/logs && \
312+
# Make CGI scripts executable and set proper ownership
313+
chmod +x /opt/app-root/api/kernels/access.cgi && \
314+
chmod +x /opt/app-root/api/probe.cgi && \
315+
chown -R 1001:0 /opt/app-root/api && \
299316
rpm-file-permissions
300317

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-
306318
# Launcher
307319
WORKDIR /opt/app-root/bin
308320

0 commit comments

Comments
 (0)