Skip to content

Commit c424943

Browse files
committed
perf: update terminal
1 parent dba4fb0 commit c424943

80 files changed

Lines changed: 18829 additions & 1101 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ build/*
33
logs/*
44
data/*
55
release/*
6-
ui/node_modules/
6+
ui/

.github/workflows/build-base-image.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ on:
77
paths:
88
- 'go.mod'
99
- 'Dockerfile-base'
10-
- 'ui/package.json'
11-
- 'package.json'
12-
- 'ui/yarn.lock'
13-
- 'yarn.lock'
1410
workflow_dispatch:
1511
inputs:
1612
branch:

.github/workflows/golangci-lint.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ jobs:
1717
steps:
1818
- uses: actions/checkout@v4
1919

20-
- name: Create ui/dist directory
21-
run: |
22-
mkdir -p ui/dist
23-
touch ui/dist/.gitkeep
24-
2520
- uses: actions/setup-go@v5
2621
with:
2722
go-version: stable

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,5 @@ pnpm-debug.log*
4747
*.sw?
4848
demo
4949

50-
docker-compose.yaml
50+
docker-compose.yaml
51+
.env

AGENTS.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Coding Rules
2+
3+
- Never generate sample code.
4+
- Never generate demo applications.
5+
- Modify only files necessary for the task.
6+
- Keep changes minimal.
7+
- Do not consume unconstrained CPU or RAM under any circumstances.

Dockerfile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ COPY . .
66
ARG VERSION
77
ENV VERSION=$VERSION
88

9-
WORKDIR /opt/koko/ui
10-
RUN yarn build
11-
129
WORKDIR /opt/koko
1310
RUN make build -s \
1411
&& set -x && ls -al . \

Dockerfile-base

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,5 @@
1-
FROM golang:1.26.3-trixie AS stage-go-build
2-
3-
FROM node:20-trixie
4-
COPY --from=stage-go-build /usr/local/go/ /usr/local/go/
5-
COPY --from=stage-go-build /go/ /go/
6-
ENV GOPATH=/go
7-
ENV PATH=/go/bin:/usr/local/go/bin:$PATH
1+
FROM golang:1.26.3-trixie
82
ARG TARGETARCH
9-
ARG NPM_REGISTRY="https://registry.npmmirror.com"
10-
ENV NPM_REGISTY=$NPM_REGISTRY
11-
12-
RUN set -ex \
13-
&& npm config set registry ${NPM_REGISTRY} \
14-
&& yarn config set registry ${NPM_REGISTRY}
153

164
WORKDIR /opt
175

@@ -64,16 +52,31 @@ RUN set -ex \
6452
;; \
6553
esac
6654

67-
WORKDIR /opt/koko/ui
68-
69-
RUN --mount=type=cache,target=/usr/local/share/.cache/yarn,sharing=locked,id=koko \
70-
--mount=type=bind,source=ui/package.json,target=package.json \
71-
--mount=type=bind,source=ui/yarn.lock,target=yarn.lock \
72-
yarn install
55+
ARG ZIG_VERSION=0.15.2
56+
ARG GHOSTTY_COMMIT=d4ac93a0395d321b043ee0116dc8a1a384f0fb83
57+
RUN set -ex \
58+
&& case "${TARGETARCH}" in \
59+
amd64) ZIG_ARCH=x86_64 ;; \
60+
arm64) ZIG_ARCH=aarch64 ;; \
61+
*) echo "Unsupported libghostty architecture: ${TARGETARCH}"; exit 1 ;; \
62+
esac \
63+
&& apt-get update \
64+
&& apt-get install -y --no-install-recommends pkg-config xz-utils \
65+
&& wget -O /tmp/zig.tar.xz https://ziglang.org/download/${ZIG_VERSION}/zig-${ZIG_ARCH}-linux-${ZIG_VERSION}.tar.xz \
66+
&& tar -xf /tmp/zig.tar.xz -C /opt \
67+
&& mv /opt/zig-${ZIG_ARCH}-linux-${ZIG_VERSION} /opt/zig \
68+
&& wget -O /tmp/ghostty.tar.gz https://github.com/ghostty-org/ghostty/archive/${GHOSTTY_COMMIT}.tar.gz \
69+
&& tar -xf /tmp/ghostty.tar.gz -C /tmp \
70+
&& cd /tmp/ghostty-${GHOSTTY_COMMIT} \
71+
&& /opt/zig/zig build -Demit-lib-vt -Doptimize=ReleaseFast --prefix /opt/libghostty-vt \
72+
&& rm -rf /opt/zig /tmp/zig.tar.xz /tmp/ghostty.tar.gz /tmp/ghostty-${GHOSTTY_COMMIT} \
73+
&& apt-get clean \
74+
&& rm -rf /var/lib/apt/lists/*
7375

7476
WORKDIR /opt/koko/
7577

76-
ENV CGO_ENABLED=0
78+
ENV CGO_ENABLED=1
79+
ENV PKG_CONFIG_PATH=/opt/libghostty-vt/share/pkgconfig
7780
ENV GO111MODULE=on
7881

7982
COPY go.mod go.sum ./

Dockerfile-ee

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ ARG APT_MIRROR=http://deb.debian.org
1414
RUN set -ex \
1515
&& sed -i "s@http://.*.debian.org@${APT_MIRROR}@g" /etc/apt/sources.list.d/debian.sources \
1616
&& apt-get update \
17+
&& apt-get upgrade -y \
1718
&& apt-get install -y --no-install-recommends ${DEPENDENCIES} \
1819
&& apt-get clean

Makefile

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ KOKOLDFLAGS+=-X 'main.Goversion=$(GOVERSION)'
2121
KOKOLDFLAGS+=-X 'main.Version=$(VERSION)'
2222
KOKOLDFLAGS+=-X 'github.com/jumpserver/koko/pkg/config.CipherKey=$(CipherKey)'
2323

24-
KOKOBUILD=CGO_ENABLED=0 go build -trimpath -ldflags "$(KOKOLDFLAGS) ${LDFLAGS}"
24+
KOKOBUILD=CGO_ENABLED=1 go build -trimpath -ldflags "$(KOKOLDFLAGS) ${LDFLAGS}"
2525

2626
UIDIR=ui
2727

@@ -43,7 +43,7 @@ endef
4343
build:
4444
GOARCH=$(GOARCH) GOOS=$(GOOS) $(KOKOBUILD) -o $(BUILDDIR)/$(NAME) $(KOKOSRCFILE)
4545

46-
all: koko-ui
46+
all:
4747
$(call make_artifact_full,darwin,amd64)
4848
$(call make_artifact_full,darwin,arm64)
4949
$(call make_artifact_full,linux,amd64)
@@ -54,34 +54,34 @@ all: koko-ui
5454
$(call make_artifact_full,linux,riscv64)
5555
$(call make_artifact_full,linux,loong64)
5656

57-
local: koko-ui
57+
local:
5858
$(call make_artifact_full,$(shell go env GOOS),$(shell go env GOARCH))
5959

60-
darwin-amd64: koko-ui
60+
darwin-amd64:
6161
$(call make_artifact_full,darwin,amd64)
6262

63-
darwin-arm64: koko-ui
63+
darwin-arm64:
6464
$(call make_artifact_full,darwin,arm64)
6565

66-
linux-amd64: koko-ui
66+
linux-amd64:
6767
$(call make_artifact_full,linux,amd64)
6868

69-
linux-arm64: koko-ui
69+
linux-arm64:
7070
$(call make_artifact_full,linux,arm64)
7171

72-
linux-loong64: koko-ui
72+
linux-loong64:
7373
$(call make_artifact_full,linux,loong64)
7474

75-
linux-mips64le: koko-ui
75+
linux-mips64le:
7676
$(call make_artifact_full,linux,mips64le)
7777

78-
linux-ppc64le: koko-ui
78+
linux-ppc64le:
7979
$(call make_artifact_full,linux,ppc64le)
8080

81-
linux-s390x: koko-ui
81+
linux-s390x:
8282
$(call make_artifact_full,linux,s390x)
8383

84-
linux-riscv64: koko-ui
84+
linux-riscv64:
8585
$(call make_artifact_full,linux,riscv64)
8686

8787
koko-ui:
@@ -109,4 +109,4 @@ run:
109109

110110
.PHONY: run-ui
111111
run-ui:
112-
cd $(UIDIR) && yarn run serve
112+
cd $(UIDIR) && yarn run serve

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,5 +89,13 @@ To build multi-platform images using Docker Buildx, you need to install Docker v
8989
make docker
9090
```
9191

92+
For local development and testing, export the bootstrap token used by JumpServer Core and start Koko with Docker Compose:
93+
94+
```shell
95+
docker compose up --build
96+
```
97+
98+
By default, Koko connects to `http://host.docker.internal:8080`, exposes SSH on port `2222` and HTTP on port `5000`. Set `CORE_HOST`, `KOKO_SSH_PORT`, or `KOKO_HTTP_PORT` to override them.
99+
92100
## Acknowledgments
93101
This project depends on [usql](https://github.com/xo/usql) for database connections. We appreciate their support.

0 commit comments

Comments
 (0)