Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
**/.DS_Store
**/*.rpm
**/*.deb
**/*-registry.yml
**/*-registry.yml
CLAUDE.md
24 changes: 14 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ SHELL ["/bin/bash", "-c"]

RUN mkdir -p \
${CSGHUB_HOME}/{LICENSES,bin} \
${CSGHUB_EMBEDDED}/{bin,lib,sv} \
${CSGHUB_EMBEDDED}/{bin,lib,sv,etc} \
${CSGHUB_SRV_HOME}/{registry,nats,temporal,temporal_ui,casdoor,dnsmasq,consul,server,portal,prometheus,loki}/bin

## Install Runit Service Daemon
Expand Down Expand Up @@ -128,33 +128,37 @@ COPY --from=gitaly /usr/local/. ${CSGHUB_SRV_HOME}/gitaly/
COPY --from=gitlab-shell /srv/gitlab-shell/. ${CSGHUB_SRV_HOME}/gitlab_shell/

## Install Temporal & Temporal-ui
COPY --from=temporal ${CSGHUB_HOME}/etc/temporal/. ${CSGHUB_HOME}/etc/temporal/
COPY --from=temporal ${CSGHUB_HOME}/etc/temporal/. ${CSGHUB_EMBEDDED}/etc/temporal/
COPY --from=temporal ${CSGHUB_SRV_HOME}/temporal/. ${CSGHUB_SRV_HOME}/temporal/
COPY --from=temporal ${CSGHUB_HOME}/etc/temporal_ui/. ${CSGHUB_HOME}/etc/temporal_ui/
COPY --from=temporal ${CSGHUB_HOME}/etc/temporal_ui/. ${CSGHUB_EMBEDDED}/etc/temporal_ui/
COPY --from=temporal ${CSGHUB_SRV_HOME}/temporal_ui/. ${CSGHUB_SRV_HOME}/temporal_ui/

# Using 8182 as temporal-ui default listen port
RUN sed -i 's/8080/8182/g' ${CSGHUB_HOME}/etc/temporal_ui/config-template.yaml
RUN sed -i 's/8080/8182/g' ${CSGHUB_EMBEDDED}/etc/temporal_ui/config-template.yaml

# Remap temporal internal paths from component image to new embedded location
RUN find ${CSGHUB_EMBEDDED}/etc/temporal -type f -exec sed -i 's|/opt/csghub/etc/temporal|/opt/csghub/embedded/etc/temporal|g' {} \;

## Install NATS
COPY --from=nats /nats-server ${CSGHUB_SRV_HOME}/nats/bin/

## Install Casdoor
COPY --from=casdoor /server ${CSGHUB_SRV_HOME}/casdoor/bin/casdoor
COPY --from=casdoor /web ${CSGHUB_HOME}/etc/casdoor/web
COPY --from=casdoor /web ${CSGHUB_EMBEDDED}/etc/casdoor/web

## Install Nginx
COPY --from=nginx /opt/csghub/. /opt/csghub/
COPY ./opt/csghub/etc/nginx/. /opt/csghub/etc/nginx/
COPY --from=nginx /opt/csghub/embedded/sv/nginx/. /opt/csghub/embedded/sv/nginx/
COPY --from=nginx /opt/csghub/etc/nginx/. /opt/csghub/embedded/etc/nginx/
COPY ./opt/csghub/embedded/etc/nginx/. /opt/csghub/embedded/etc/nginx/

## Install csghub-server
ENV GIN_MODE=release

COPY --from=server /starhub-bin/starhub ${CSGHUB_SRV_HOME}/server/bin/csghub-server
COPY --from=server /starhub-bin/. ${CSGHUB_HOME}/etc/server/
COPY --from=server /starhub-bin/. ${CSGHUB_EMBEDDED}/etc/server/
COPY --from=server /root/.duckdb ${CSGHUB_SRV_HOME}/server/.duckdb

RUN rm ${CSGHUB_HOME}/etc/server/starhub
RUN rm ${CSGHUB_EMBEDDED}/etc/server/starhub

## Install csghub-portal
COPY --from=portal /myapp/csghub-portal ${CSGHUB_SRV_HOME}/portal/bin/
Expand Down Expand Up @@ -275,7 +279,7 @@ RUN chmod +x -R /opt/csghub/bin && \
chmod +x -R /opt/csghub/embedded/sv/**/templates && \
chmod +x -R /scripts && \
ln -s /opt/csghub/bin/* /usr/bin/ && \
find /opt/csghub/etc/ -type f -name "*.sh" -exec chmod +x {} \;
find /opt/csghub/embedded/etc/ -type f -name "*.sh" -exec chmod +x {} \;

EXPOSE 80 443 2222 5000 8000 9000 9001
ENTRYPOINT ["/scripts/entrypoint.sh"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ Omnibus-CSGHub 是 OpenCSG CSGHub 的一键式 Docker Compose 部署方案,让

*Contains all configurable parameters, with minimal modifications typically required under default settings.*

- 默认参数文件 `/opt/csghub/etc/csghub/default.yaml`
- 默认参数文件 `/opt/csghub/embedded/etc/csghub/default.yaml`

定义了所有参数的默认值。

Expand Down
25 changes: 14 additions & 11 deletions ee.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ SHELL ["/bin/bash", "-c"]

RUN mkdir -p \
${CSGHUB_HOME}/{LICENSES,bin} \
${CSGHUB_EMBEDDED}/{bin,lib,sv} \
${CSGHUB_EMBEDDED}/{bin,lib,sv,etc} \
${CSGHUB_SRV_HOME}/{registry,nats,temporal,temporal_ui,casdoor,dnsmasq,consul,server,portal,prometheus,loki,xnet}/bin

## Install Runit Service Daemon
Expand Down Expand Up @@ -146,30 +146,30 @@ COPY --from=gitaly /usr/local/. ${CSGHUB_SRV_HOME}/gitaly/
COPY --from=gitlab-shell /srv/gitlab-shell/. ${CSGHUB_SRV_HOME}/gitlab_shell/

## Install Temporal & Temporal-ui
COPY --from=temporal ${CSGHUB_HOME}/etc/temporal/. ${CSGHUB_HOME}/etc/temporal/
COPY --from=temporal ${CSGHUB_HOME}/etc/temporal/. ${CSGHUB_EMBEDDED}/etc/temporal/
COPY --from=temporal ${CSGHUB_SRV_HOME}/temporal/. ${CSGHUB_SRV_HOME}/temporal/
COPY --from=temporal ${CSGHUB_HOME}/etc/temporal_ui/. ${CSGHUB_HOME}/etc/temporal_ui/
COPY --from=temporal ${CSGHUB_HOME}/etc/temporal_ui/. ${CSGHUB_EMBEDDED}/etc/temporal_ui/
COPY --from=temporal ${CSGHUB_SRV_HOME}/temporal_ui/. ${CSGHUB_SRV_HOME}/temporal_ui/

## Install NATS
COPY --from=nats /nats-server ${CSGHUB_SRV_HOME}/nats/bin/

## Install Casdoor
COPY --from=casdoor /server ${CSGHUB_SRV_HOME}/casdoor/bin/casdoor
COPY --from=casdoor /web ${CSGHUB_HOME}/etc/casdoor/web
COPY --from=casdoor /web ${CSGHUB_EMBEDDED}/etc/casdoor/web

## Install Nginx
COPY --from=nginx /opt/csghub/. /opt/csghub/
#COPY ./opt/csghub/etc/nginx/. /opt/csghub/etc/nginx/
COPY --from=nginx /opt/csghub/embedded/sv/nginx/. /opt/csghub/embedded/sv/nginx/
COPY --from=nginx /opt/csghub/etc/nginx/. /opt/csghub/embedded/etc/nginx/

## Install csghub-server
ENV GIN_MODE=release

COPY --from=server /starhub-bin/starhub ${CSGHUB_SRV_HOME}/server/bin/csghub-server
COPY --from=server /starhub-bin/. ${CSGHUB_HOME}/etc/server/
COPY --from=server /starhub-bin/. ${CSGHUB_EMBEDDED}/etc/server/
COPY --from=server /root/.duckdb ${CSGHUB_SRV_HOME}/server/.duckdb

RUN rm ${CSGHUB_HOME}/etc/server/starhub
RUN rm ${CSGHUB_EMBEDDED}/etc/server/starhub

## Install csghub-portal
COPY --from=portal /myapp/csghub-portal ${CSGHUB_SRV_HOME}/portal/bin/
Expand All @@ -187,16 +187,19 @@ COPY --from=loki /usr/bin/loki ${CSGHUB_SRV_HOME}/loki/bin/
## Install csgship-web
COPY --from=csgship /code/. ${CSGHUB_SRV_HOME}/web/
COPY --from=billing /app/. ${CSGHUB_SRV_HOME}/billing/bin/
COPY --from=frontend /usr/share/nginx/html ${CSGHUB_HOME}/etc/nginx/html
COPY --from=frontend /usr/share/nginx/html ${CSGHUB_EMBEDDED}/etc/nginx/html
COPY --from=agentic /code/. ${CSGHUB_SRV_HOME}/agentic/

# Using 8182 as temporal-ui default listen port
RUN sed -i 's/8080/8182/g' ${CSGHUB_HOME}/etc/temporal_ui/config-template.yaml && \
RUN sed -i 's/8080/8182/g' ${CSGHUB_EMBEDDED}/etc/temporal_ui/config-template.yaml && \
sed -i -e 's/:8000/:8183/g' \
-e 's|/code/logs/gunicorn.access.log|/dev/stdout|g' \
-e 's|/code/|/opt/csghub/embedded/sv/web/|g' \
${CSGHUB_EMBEDDED}/sv/web/project/{gunicorn_config.py,uwsgi.ini}

# Remap temporal internal paths from component image to new embedded location
RUN find ${CSGHUB_EMBEDDED}/etc/temporal -type f -exec sed -i 's|/opt/csghub/etc/temporal|/opt/csghub/embedded/etc/temporal|g' {} \;

ENV PATH=$PATH:/opt/csghub/embedded/bin
RUN if grep -q -i -E 'ubuntu|debian' /etc/os-release; then \
apt update && \
Expand Down Expand Up @@ -303,7 +306,7 @@ RUN chmod +x -R /opt/csghub/bin && \
chmod +x -R /opt/csghub/embedded/sv/**/templates && \
chmod +x -R /scripts && \
ln -s /opt/csghub/bin/* /usr/bin/ && \
find /opt/csghub/etc/ -type f -name "*.sh" -exec chmod +x {} \;
find /opt/csghub/embedded/etc/ -type f -name "*.sh" -exec chmod +x {} \;

EXPOSE 80 443 2222 5000 8000 9000 9001
ENTRYPOINT ["/scripts/entrypoint.sh"]
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ server:
## Casdoor (authentication) Integration
casdoor:
endpoint: "" ## Casdoor endpoint
certificate: "/opt/csghub/etc/casdoor/token_jwt_key.pem" ## SSL cert path
certificate: "/opt/csghub/embedded/etc/casdoor/token_jwt_key.pem" ## SSL cert path
organization_name: "OpenCSG" ## Organization name in Casdoor
application_name: "CSGHub" ## App name in Casdoor

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ csghub:
## Casdoor (authentication) Integration
# casdoor:
# endpoint: "http://csghub.example.com:8000" ## Casdoor endpoint
# certificate: "/opt/csghub/etc/casdoor/token_jwt_key.pem" ## SSL cert path
# certificate: "/opt/csghub/embedded/etc/casdoor/token_jwt_key.pem" ## SSL cert path
# organization_name: "OpenCSG" ## Organization name in Casdoor
# application_name: "CSGHub" ## App name in Casdoor

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ lfs_bucket = {{ $s3.bucket | quote }}
provider = ""

[license]
public_key_file = "/opt/csghub/etc/server/enterprise/public_key_ee.pem"
public_key_file = "/opt/csghub/embedded/etc/server/enterprise/public_key_ee.pem"

[jwt]
signing_key = {{ tmpl.Exec "GenSeed" . | crypto.SHA256 | quote }}
Expand Down
2 changes: 1 addition & 1 deletion ee/opt/csghub/embedded/sv/agentic/templates/run.sample
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ set -e

{{- $agentic := (datasource "config").agentic }}
cd /opt/csghub/embedded/sv/agentic
exec chpst -e /opt/csghub/etc/web/env -P \
exec chpst -e /opt/csghub/service/web/env -P \
-u root:root \
/opt/csghub/embedded/bin/hypercorn starship.main:starlette \
--bind {{ $agentic.listen }} \
Expand Down
4 changes: 2 additions & 2 deletions ee/opt/csghub/embedded/sv/billing/templates/run.sample
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ set -e

{{- $dataDir := (datasource "config").billing.data | default "/var/opt/csghub/billing" }}
cd {{ $dataDir }}
exec chpst -e /opt/csghub/etc/web/env -P \
exec chpst -e /opt/csghub/service/web/env -P \
-u root:root \
/opt/csghub/embedded/bin/billing -config={{ $dataDir }}/config.yaml
/opt/csghub/embedded/bin/billing -config=/opt/csghub/service/billing/etc/config.yaml
2 changes: 1 addition & 1 deletion ee/opt/csghub/embedded/sv/portal/templates/run.sample
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fi
set -e

readonly PORTAL_BIN="/opt/csghub/embedded/bin/csghub-portal"
readonly ENV_DIR="/opt/csghub/etc/portal/env"
readonly ENV_DIR="/opt/csghub/service/portal/env"

echo "Initializing database migrations..."
chpst -e "$ENV_DIR" -P \
Expand Down
2 changes: 1 addition & 1 deletion ee/opt/csghub/embedded/sv/producer/templates/run.sample
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ fi
set -e

cd /opt/csghub/embedded/sv/web/project
exec chpst -e /opt/csghub/etc/web/env -P \
exec chpst -e /opt/csghub/service/web/env -P \
-u root:root \
/opt/csghub/embedded/bin/celery -A config beat --loglevel=INFO
14 changes: 7 additions & 7 deletions ee/opt/csghub/embedded/sv/server/templates/pre-start.sample
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ exec 2>&1
# exit when error
set -e

{{- $configDir := "/opt/csghub/etc/server" }}
{{- $envDir := printf "%s/env" $configDir }}
{{- $configDir := "/opt/csghub/service/server/etc" }}
{{- $envDir := "/opt/csghub/service/server/env" }}

# Clear all environment variable files
# rm -rf {{ $envDir }}/* || true
Expand All @@ -26,8 +26,8 @@ set -e
{{- file.Write (printf "%s/STARHUB_SERVER_PUBLIC_ROOT_DOMAIN" $envDir) " " }}
{{- file.Write (printf "%s/DUCKDB_HOME" $envDir) "/opt/csghub/embedded/sv/server" }}
{{- file.Write (printf "%s/DUCKDB_EXTENSION_DIRECTORY" $envDir) "/opt/csghub/embedded/sv/server" }}
{{- file.Write (printf "%s/OPENCSG_LICENSE_PUBLIC_KEY_FILE" $envDir) "/opt/csghub/etc/server/enterprise/public_key_ee.pem" }}
{{- file.Write (printf "%s/OPENCSG_LICENSE_PRIVATE_KEY_FILE" $envDir) "/opt/csghub/etc/server/enterprise/private_key_ee.pem" }}
{{- file.Write (printf "%s/OPENCSG_LICENSE_PUBLIC_KEY_FILE" $envDir) "/opt/csghub/embedded/etc/server/enterprise/public_key_ee.pem" }}
{{- file.Write (printf "%s/OPENCSG_LICENSE_PRIVATE_KEY_FILE" $envDir) "/opt/csghub/embedded/etc/server/enterprise/private_key_ee.pem" }}
{{- file.Write (printf "%s/STARHUB_SERVER_RUNNER_KUBE_SCHEDULER" $envDir) "volcano" }}
{{- file.Write (printf "%s/STARHUB_SERVER_RUNNER_VGPU_NODE_RESOURCE_NAME" $envDir) "volcano.sh/node-vgpu-register" }}
{{- file.Write (printf "%s/STARHUB_SERVER_RUNNER_VGPU_POD_RESOURCE_NAME" $envDir) "volcano.sh/vgpu-ids-new" }}
Expand All @@ -46,11 +46,11 @@ set -e
{{- end }}

{{- $dataDir := (datasource "config").server.data | default "/var/opt/csghub/server" }}
{{- $configFile := printf "%s/config.toml" $dataDir }}
{{- $configFile := printf "%s/config.toml" $configDir }}

# Define constants
readonly SERVER_BIN="/opt/csghub/embedded/bin/csghub-server"
readonly ENV_DIR="/opt/csghub/etc/server/env"
readonly ENV_DIR="/opt/csghub/service/server/env"

# Build command arguments
## Migration init
Expand All @@ -69,7 +69,7 @@ cd {{ $dataDir }} && chpst -e "$ENV_DIR" -P -u root:root "$SERVER_BIN" "${args[@

# Load local sql scripts
cd /opt/csghub/service/server
[ -x "/opt/csghub/etc/csghub/scripts/pg_executor" ] && chpst -e {{ $envDir }} /opt/csghub/etc/csghub/scripts/pg_executor
[ -x "/opt/csghub/embedded/etc/csghub/scripts/pg_executor" ] && chpst -e {{ $envDir }} /opt/csghub/embedded/etc/csghub/scripts/pg_executor

{{- $minio := (datasource "config").minio }}
{{- if $minio.enable }}
Expand Down
Loading