Skip to content

Commit

Permalink
Merge pull request opendatahub-io#390 from harshad16/fix-naming-codes…
Browse files Browse the repository at this point in the history
…erver

Fix: Use code-server reference in all the files
  • Loading branch information
harshad16 authored Jan 24, 2024
2 parents cabc4dc + 2305f1e commit 879392e
Show file tree
Hide file tree
Showing 20 changed files with 87 additions and 87 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ labels: 'kind/bug'
- OpenDatahub Version: (please check the operator version)
- Workbench: (all, data-science, etc)
- Workbench Version: (2023.1, etc)
- Specific tool: (jupyterlab, rstudio, vscode, elyra-pipelines,etc)
- Specific tool: (jupyterlab, rstudio, code-server, elyra-pipelines,etc)
- Notebook-Controller Version: (please check the image version in notebook-controller deployment)

**Logs/Screenshots**
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ validate-runtime-image: bin/kubectl
.PHONY: validate-codeserver-image
validate-codeserver-image: bin/kubectl
$(eval NOTEBOOK_NAME := $(subst .,-,$(subst cuda-,,$*)))
$(info # Running tests for $(NOTEBOOK_NAME) Code Server image...)
$(info # Running tests for $(NOTEBOOK_NAME) code-server image...)
$(KUBECTL_BIN) wait --for=condition=ready pod codeserver-pod --timeout=300s
@required_commands=$(REQUIRED_CODE_SERVER_IMAGE_COMMANDS) ; \
if [[ $$image == "" ]] ; then \
Expand All @@ -431,7 +431,7 @@ validate-codeserver-image: bin/kubectl
.PHONY: validate-rstudio-image
validate-rstudio-image: bin/kubectl
$(eval NOTEBOOK_NAME := $(subst .,-,$(subst cuda-,,$*)))
$(info # Running tests for $(NOTEBOOK_NAME) Code Server image...)
$(info # Running tests for $(NOTEBOOK_NAME) code-server image...)
$(KUBECTL_BIN) wait --for=condition=ready pod rstudio-pod --timeout=300s
@required_commands=$(REQUIRED_R_STUDIO_IMAGE_COMMANDS) ; \
if [[ $$image == "" ]] ; then \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ graph TB
subgraph Other Notebooks
%% Nodes
c9s-python-3.9("CentOS Stream Base<br/>(c9s-python-3.9)");
code-server-c9s-python-3.9("Code Server <br/>(code-server-c9s-python-3.9)");
code-server-c9s-python-3.9("code-server <br/>(code-server-c9s-python-3.9)");
r-studio-c9s-python-3.9("R Studio <br/>(r-studio-c9s-python-3.9)");
%% Edges
Expand Down
12 changes: 6 additions & 6 deletions codeserver/c9s-python-3.9/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ FROM ${BASE_IMAGE}
ARG CODESERVER_VERSION=v4.16.1

LABEL name="odh-notebook-code-server-c9s-python-3.9" \
summary="Code Server (VS Code) image with python 3.9 based on CentOS Stream 9" \
description="Code Server (VS Code) image with python 3.9 based on CentOS Stream 9" \
io.k8s.display-name="Code Server (VS Code) image with python 3.9 based on CentOS Stream 9" \
io.k8s.description="Code Server (VS Code) image with python 3.9 based on CentOS Stream 9" \
summary="code-server image with python 3.9 based on CentOS Stream 9" \
description="code-server image with python 3.9 based on CentOS Stream 9" \
io.k8s.display-name="code-server image with python 3.9 based on CentOS Stream 9" \
io.k8s.description="code-server image with python 3.9 based on CentOS Stream 9" \
authoritative-source-url="https://github.com/opendatahub-io/notebooks" \
io.openshift.build.commit.ref="main" \
io.openshift.build.source-location="https://github.com/opendatahub-io/notebooks/tree/main/codeserver/c9s-python-3.9" \
Expand All @@ -17,11 +17,11 @@ USER 0

WORKDIR /opt/app-root/bin

# Install Code Server
# Install code-server
RUN yum install -y "https://github.com/coder/code-server/releases/download/${CODESERVER_VERSION}/code-server-${CODESERVER_VERSION/v/}-amd64.rpm" && \
yum -y clean all --enablerepo='*'

# Install NGINX to proxy VSCode and pass probes check
# Install NGINX to proxy code-server and pass probes check
ENV NGINX_VERSION=1.22 \
NGINX_SHORT_VER=122 \
NGINX_CONFIGURATION_PATH=${APP_ROOT}/etc/nginx.d \
Expand Down
2 changes: 1 addition & 1 deletion codeserver/c9s-python-3.9/nginx/api/kernels/access.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ echo "Status: 200"
echo "Content-type: application/json"
echo
# Query the heartbeat endpoint
HEALTHZ=$(curl -s http://127.0.0.1:8888/vscode/healthz)
HEALTHZ=$(curl -s http://127.0.0.1:8888/codeserver/healthz)
# Extract last_activity | remove milliseconds
LAST_ACTIVITY_EPOCH=$(echo $HEALTHZ | grep -Po 'lastHeartbeat":\K.*?(?=})' | awk '{ print substr( $0, 1, length($0)-3 ) }')
# Convert to ISO8601 date format
Expand Down
2 changes: 1 addition & 1 deletion codeserver/c9s-python-3.9/nginx/httpconf/http.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ map $http_upgrade $connection_upgrade {

# Exclude heartbeat from logging for culling purposes
map $request $loggable {
~\/vscode\/healthz 0;
~\/codeserver\/healthz 0;
default 1;
}

Expand Down
20 changes: 10 additions & 10 deletions codeserver/c9s-python-3.9/nginx/serverconf/proxy.conf.template
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
###############
# api calls from probes get to VSCode /healthz endpoint
# api calls from probes get to code-server /healthz endpoint
###############
location = /api {
return 302 /vscode/healthz/;
return 302 /codeserver/healthz/;
access_log off;
}

location /api/ {
return 302 /vscode/healthz/;
return 302 /codeserver/healthz/;
access_log off;
}
###############
Expand All @@ -33,18 +33,18 @@ location /api/kernels/ {
###############

###############
# root and prefix get to VSCode endpoint
# root and prefix get to code-server endpoint
###############
location = / {
return 302 $custom_scheme://$http_host/vscode/;
return 302 $custom_scheme://$http_host/codeserver/;
}

location = /vscode {
return 302 $custom_scheme://$http_host/vscode/;
location = /codeserver {
return 302 $custom_scheme://$http_host/codeserver/;
}

location /vscode/ {
# Standard Code-Server/NGINX configuration
location /codeserver/ {
# Standard code-server/NGINX configuration
proxy_pass http://127.0.0.1:8787/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
Expand All @@ -59,6 +59,6 @@ location /vscode/ {
proxy_set_header X-NginX-Proxy true;
proxy_redirect off;

access_log /var/log/nginx/vscode.access.log json if=$loggable;
access_log /var/log/nginx/codeserver.access.log json if=$loggable;
}
###############
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
###############
# api calls from probes get to VSCode /healthz endpoint
# api calls from probes get to code-server /healthz endpoint
###############
location = ${NB_PREFIX}/api {
return 302 /vscode/healthz/;
return 302 /codeserver/healthz/;
access_log off;
}

location ${NB_PREFIX}/api/ {
return 302 /vscode/healthz/;
return 302 /codeserver/healthz/;
access_log off;
}
###############
Expand Down Expand Up @@ -38,26 +38,26 @@ location /api/kernels/ {
###############

###############
# root and prefix get to VSCode endpoint
# root and prefix get to code-server endpoint
###############
location = ${NB_PREFIX} {
return 302 $custom_scheme://$http_host/vscode/;
return 302 $custom_scheme://$http_host/codeserver/;
}

location ${NB_PREFIX}/ {
return 302 $custom_scheme://$http_host/vscode/;
return 302 $custom_scheme://$http_host/codeserver/;
}

location = /vscode {
return 302 $custom_scheme://$http_host/vscode/;
location = /codeserver {
return 302 $custom_scheme://$http_host/codeserver/;
}

location = / {
return 302 $custom_scheme://$http_host/vscode/;
return 302 $custom_scheme://$http_host/codeserver/;
}

location /vscode/ {
rewrite ^/vscode/(.*)$ /$1 break;
location /codeserver/ {
rewrite ^/codeserver/(.*)$ /$1 break;
# Standard RStudio/NGINX configuration
proxy_pass http://127.0.0.1:8787;
proxy_http_version 1.1;
Expand All @@ -66,6 +66,6 @@ location /vscode/ {
proxy_read_timeout 20d;
proxy_set_header X-Forwarded-Proto $custom_scheme;

access_log /var/log/nginx/vscode.access.log json if=$loggable;
access_log /var/log/nginx/codeserver.access.log json if=$loggable;
}
###############
2 changes: 1 addition & 1 deletion codeserver/c9s-python-3.9/run-code-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if [ ! -f "/opt/app-root/src/.bashrc" ]; then
fi

# Initilize access logs for culling
echo '[{"id":"code-server","name":"code-server","last_activity":"'$(date -Iseconds)'","execution_state":"running","connections":1}]' > /var/log/nginx/vscode.access.log
echo '[{"id":"code-server","name":"code-server","last_activity":"'$(date -Iseconds)'","execution_state":"running","connections":1}]' > /var/log/nginx/codeserver.access.log

# Start server
start_process /usr/bin/code-server \
Expand Down
12 changes: 6 additions & 6 deletions codeserver/ubi9-python-3.9/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ FROM ${BASE_IMAGE}
ARG CODESERVER_VERSION=v4.16.1

LABEL name="odh-notebook-code-server-ubi9-python-3.9" \
summary="Code Server (VS Code) image with python 3.9 based on UBI 9" \
description="Code Server (VS Code) image with python 3.9 based on UBI9" \
io.k8s.display-name="Code Server (VS Code) image with python 3.9 based on UBI9" \
io.k8s.description="Code Server (VS Code) image with python 3.9 based on UBI9" \
summary="code-server image with python 3.9 based on UBI 9" \
description="code-server image with python 3.9 based on UBI9" \
io.k8s.display-name="code-server image with python 3.9 based on UBI9" \
io.k8s.description="code-server image with python 3.9 based on UBI9" \
authoritative-source-url="https://github.com/opendatahub-io/notebooks" \
io.openshift.build.commit.ref="main" \
io.openshift.build.source-location="https://github.com/opendatahub-io/notebooks/tree/main/codeserver/ubi9-python-3.9" \
Expand All @@ -31,15 +31,15 @@ RUN echo "Installing softwares and packages" && \
# Install usefull OS packages
RUN dnf install -y jq git-lfs libsndfile

# Install Code Server
# Install code-server
RUN yum install -y "https://github.com/coder/code-server/releases/download/${CODESERVER_VERSION}/code-server-${CODESERVER_VERSION/v/}-amd64.rpm" && \
yum -y clean all --enablerepo='*'

# Change ownership of relevant directories
RUN chmod -R g+w /opt/app-root/lib/python3.9/site-packages && \
fix-permissions /opt/app-root -P

# Install NGINX to proxy VSCode and pass probes check
# Install NGINX to proxy code-server and pass probes check
ENV NGINX_VERSION=1.22 \
NGINX_SHORT_VER=122 \
NGINX_CONFIGURATION_PATH=${APP_ROOT}/etc/nginx.d \
Expand Down
2 changes: 1 addition & 1 deletion codeserver/ubi9-python-3.9/nginx/api/kernels/access.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ echo "Status: 200"
echo "Content-type: application/json"
echo
# Query the heartbeat endpoint
HEALTHZ=$(curl -s http://127.0.0.1:8888/vscode/healthz)
HEALTHZ=$(curl -s http://127.0.0.1:8888/codeserver/healthz)
# Extract last_activity | remove milliseconds
LAST_ACTIVITY_EPOCH=$(echo $HEALTHZ | grep -Po 'lastHeartbeat":\K.*?(?=})' | awk '{ print substr( $0, 1, length($0)-3 ) }')
# Convert to ISO8601 date format
Expand Down
2 changes: 1 addition & 1 deletion codeserver/ubi9-python-3.9/nginx/httpconf/http.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ map $http_upgrade $connection_upgrade {

# Exclude heartbeat from logging for culling purposes
map $request $loggable {
~\/vscode\/healthz 0;
~\/codeserver\/healthz 0;
default 1;
}

Expand Down
20 changes: 10 additions & 10 deletions codeserver/ubi9-python-3.9/nginx/serverconf/proxy.conf.template
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
###############
# api calls from probes get to VSCode /healthz endpoint
# api calls from probes get to code-server /healthz endpoint
###############
location = /api {
return 302 /vscode/healthz/;
return 302 /codeserver/healthz/;
access_log off;
}

location /api/ {
return 302 /vscode/healthz/;
return 302 /codeserver/healthz/;
access_log off;
}
###############
Expand All @@ -33,18 +33,18 @@ location /api/kernels/ {
###############

###############
# root and prefix get to VSCode endpoint
# root and prefix get to code-server endpoint
###############
location = / {
return 302 $custom_scheme://$http_host/vscode/;
return 302 $custom_scheme://$http_host/codeserver/;
}

location = /vscode {
return 302 $custom_scheme://$http_host/vscode/;
location = /codeserver {
return 302 $custom_scheme://$http_host/codeserver/;
}

location /vscode/ {
# Standard Code-Server/NGINX configuration
location /codeserver/ {
# Standard code-server/NGINX configuration
proxy_pass http://127.0.0.1:8787/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
Expand All @@ -59,6 +59,6 @@ location /vscode/ {
proxy_set_header X-NginX-Proxy true;
proxy_redirect off;

access_log /var/log/nginx/vscode.access.log json if=$loggable;
access_log /var/log/nginx/codeserver.access.log json if=$loggable;
}
###############
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
###############
# api calls from probes get to VSCode /healthz endpoint
# api calls from probes get to code-server /healthz endpoint
###############
location = ${NB_PREFIX}/api {
return 302 /vscode/healthz/;
return 302 /codeserver/healthz/;
access_log off;
}

location ${NB_PREFIX}/api/ {
return 302 /vscode/healthz/;
return 302 /codeserver/healthz/;
access_log off;
}
###############
Expand Down Expand Up @@ -38,26 +38,26 @@ location /api/kernels/ {
###############

###############
# root and prefix get to VSCode endpoint
# root and prefix get to code-server endpoint
###############
location = ${NB_PREFIX} {
return 302 $custom_scheme://$http_host/vscode/;
return 302 $custom_scheme://$http_host/codeserver/;
}

location ${NB_PREFIX}/ {
return 302 $custom_scheme://$http_host/vscode/;
return 302 $custom_scheme://$http_host/codeserver/;
}

location = /vscode {
return 302 $custom_scheme://$http_host/vscode/;
location = /codeserver {
return 302 $custom_scheme://$http_host/codeserver/;
}

location = / {
return 302 $custom_scheme://$http_host/vscode/;
return 302 $custom_scheme://$http_host/codeserver/;
}

location /vscode/ {
rewrite ^/vscode/(.*)$ /$1 break;
location /codeserver/ {
rewrite ^/codeserver/(.*)$ /$1 break;
# Standard RStudio/NGINX configuration
proxy_pass http://127.0.0.1:8787;
proxy_http_version 1.1;
Expand All @@ -66,6 +66,6 @@ location /vscode/ {
proxy_read_timeout 20d;
proxy_set_header X-Forwarded-Proto $custom_scheme;

access_log /var/log/nginx/vscode.access.log json if=$loggable;
access_log /var/log/nginx/codeserver.access.log json if=$loggable;
}
###############
4 changes: 2 additions & 2 deletions codeserver/ubi9-python-3.9/run-code-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ if [ ! -f "/opt/app-root/src/.bashrc" ]; then
fi

# Initilize access logs for culling
echo '[{"id":"code-server","name":"code-server","last_activity":"'$(date -Iseconds)'","execution_state":"running","connections":1}]' > /var/log/nginx/vscode.access.log
echo '[{"id":"code-server","name":"code-server","last_activity":"'$(date -Iseconds)'","execution_state":"running","connections":1}]' > /var/log/nginx/codeserver.access.log

# Check if code-server exists
if [ ! -f "/opt/app-root/src/.local/share/code-server" ]; then
if [ ! -f "/opt/app-root/src/.local/share/codeserver" ]; then

# Check internet connection
if curl -Is http://www.google.com | head -n 1 | grep -q "200 OK"; then
Expand Down
Loading

0 comments on commit 879392e

Please sign in to comment.