Skip to content

[Docker] Fixed shell synatx error and rename database #236

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

Merged
merged 2 commits into from
Mar 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docker/etc/profile.d/csghub_config_load.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export GITLAB_SHELL_SSH_PORT=${GITLAB_SHELL_SSH_PORT:-2222}

# Knative Serving and Space Application
export SPACE_APP_NS=${SPACE_APP_NS:-spaces}
export SPACE_APP_DOMAIN=${SPACE_APP_DOMAIN:-app.internal}
export SPACE_APP_DOMAIN=${SPACE_APP_DOMAIN:-app1.internal}
export SPACE_APP_HOST=${SPACE_APP_HOST:-127.0.0.1}
export SPACE_APP_PORT=${SPACE_APP_PORT:-80}
export SPACE_DATA_PATH=${SPACE_DATA_PATH:-/var/opt/csghub-builder}
Expand Down Expand Up @@ -184,6 +184,7 @@ export CSGHUB_PORTAL_S3_ENDPOINT=${S3_ENDPOINT:-"$SERVER_DOMAIN:9000"}

# Knative Serving Environments
export KNATIVE_SERVING_ENABLE=${KNATIVE_SERVING_ENABLE:-false}
export ENABLE_ARGO_WORKFLOW=${ENABLE_ARGO_WORKFLOW:-false}
export KNATIVE_KOURIER_TYPE=${KNATIVE_KOURIER_TYPE:-NodePort}

# NVIDIA device plugin Environments
Expand Down
2 changes: 1 addition & 1 deletion docker/etc/server/scripts/update_casdoor.sql.sample
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ SELECT pg_catalog.set_config('search_path', 'public', false);
-- Name: application; Type: TABLE; Schema: public; Owner: csghub
--
-- Connect to casdoor management database
\connect casdoor
\connect csghub_casdoor

-- Update RedirectURLs
UPDATE
Expand Down
2 changes: 2 additions & 0 deletions docker/quick_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ if $k8s; then
-v ${config:-"~/.kube"}:/etc/.kube \
-v /var/run/docker.sock:/var/run/docker.sock \
-p ${registry_port}:5000 \
-e KNATIVE_SERVING_ENABLE=true \
-e ENABLE_ARGO_WORKFLOW=true \
-e REGISTRY_ADDRESS=${host}:${registry_port} "
else
docker_cmd+=" -e CSGHUB_WITH_K8S=0 "
Expand Down
2 changes: 1 addition & 1 deletion docker/scripts/csghub-server-process-wrapper
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ echo "Migration init"
echo "Migration migrate"
/usr/bin/csghub-server migration migrate

if [ $(ls -A /etc/.kube/config* 2>dev/null) ]; then
if [[ $(ls -A /etc/.kube/config* 2>dev/null) ]]; then
echo "Copy kube configs."
cp -a /etc/.kube /root
fi
Expand Down
21 changes: 13 additions & 8 deletions docker/scripts/k8s-init-job.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
#!/bin/bash

# export KNATIVE_SERVING_ENABLE=true
# export NVIDIA_DEVICE_PLUGIN=true
export KNATIVE_SERVING_ENABLE=${KNATIVE_SERVING_ENABLE:-true}
export ENABLE_ARGO_WORKFLOW=${ENABLE_ARGO_WORKFLOW:-true}
export NVIDIA_DEVICE_PLUGIN=${NVIDIA_DEVICE_PLUGIN:-true}

# Function to retry a command up to a specified number of times if it fails
retry() {
local n=1
local max=5
local delay=10
while true; do
"$@" && break || {
KUBECONFIG=$KUBECONFIG "$@" && break || {
if [[ $n -lt $max ]]; then
((n++))
echo "Command failed. Attempt $n/$max:"
Expand Down Expand Up @@ -54,19 +55,19 @@ create_namespace() {
install_argo_workflow() {
# Install argo workflow
log "INFO" "Install the ARGO Workflow component."
retry kubectl apply -f https://ghp.ci/https://raw.githubusercontent.com/OpenCSGs/csghub-installer/refs/heads/main/argo/argo.yaml
retry kubectl apply -f https://ghp.ci/https://raw.githubusercontent.com/OpenCSGs/csghub-installer/refs/heads/main/argo/rbac.yaml
retry kubectl apply -f https://raw.githubusercontent.com/OpenCSGs/csghub-installer/refs/heads/main/argo/argo.yaml
retry kubectl apply -f https://raw.githubusercontent.com/OpenCSGs/csghub-installer/refs/heads/main/argo/rbac.yaml
}

install_knative_serving() {
echo "Install the Knative Serving component"
retry kubectl apply -f https://ghp.ci/https://raw.githubusercontent.com/OpenCSGs/csghub-installer/refs/heads/main/knative/serving-crds.yaml
retry kubectl apply -f https://ghp.ci/https://raw.githubusercontent.com/OpenCSGs/csghub-installer/refs/heads/main/knative/serving-core.yaml
retry kubectl apply -f https://raw.githubusercontent.com/OpenCSGs/csghub-installer/refs/heads/main/knative/serving-crds.yaml
retry kubectl apply -f https://raw.githubusercontent.com/OpenCSGs/csghub-installer/refs/heads/main/knative/serving-core.yaml
retry kubectl patch cm config-autoscaler -n knative-serving -p='{"data":{"enable-scale-to-zero":"false"}}'
retry kubectl patch cm config-features -n knative-serving -p='{"data":{"kubernetes.podspec-nodeselector":"enabled"}}'

echo "Install a networking layer"
retry kubectl apply -f https://ghp.ci/https://raw.githubusercontent.com/OpenCSGs/csghub-installer/refs/heads/main/knative/kourier.yaml
retry kubectl apply -f https://raw.githubusercontent.com/OpenCSGs/csghub-installer/refs/heads/main/knative/kourier.yaml

echo "Configure Knative Serving to use Kourier"
retry kubectl patch configmap/config-network \
Expand Down Expand Up @@ -147,6 +148,10 @@ cluster_infos=()
for CONFIG in $(ls -A /etc/.kube/config*); do
export KUBECONFIG=$CONFIG

if ! kubectl cluster-info; then
echo "Warning: Invalid KUBECONFIG file '$CONFIG'. Skipping..."
continue
fi
create_namespace

if [ "$STARHUB_SERVER_DOCKER_IMAGE_PULL_SECRET" == "csghub-docker-config" ]; then
Expand Down