-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[v9] Backport initial Teleport Connect PR + fixes (#12205)
* teleterm (alpha) * Add grpc-teleterm Makefile target The grpc-tools package is needed to generate gRPC files for JavaScript. However, at the moment it can't be installed on M1 MacBooks because of missing prebuilt binaries for arm64. [1] One of them, protoc, is already installed in our buildbox. We still need to compile grpc_node_plugin from source though. This adds significant overhead as we need to pull in cmake, build-essential and then about 300 MB of git repos from protocolbuffers/protobuf. Initially, those Teleterm gRPC were generated within `make grpc` with other files. M1 users who don't work on Teleterm would not be happy about incurring that additional overhead, hence I extracted everything into separate target and Dockerfile. Teleterm proto files don't depend on any other proto files. Once grpc-tools adds support for arm64, we'll be able to essentially almost revert this commit and generate Teleterm gRPC files within `make grpc`. [1] grpc/grpc-node#1405 * Use oneof for LoginRequest params The login is either local or SSO but not both. * Use db name for URI in Teleterm rather than db server host ID The previous version of the code used GetHostId return value for the URI. That caused problems as a single host can run multiple database servers. This in turn resulted in stuff like Teleterm not listing all databases. There's `Database.GetURI` function which I decided not to use, because it's an URI on its own which might include stuff like port numbers and what not. I wanted to avoid a situation in which the database URI creates some potential conflicts with the Teleterm URIs. I noticed that the Web UI code runs `DeduplicateDatabases` already and it uses `Database.GetName` underneath, so I deemed it a good candidate to be a part of a database URI in Teleterm. Fixes gravitational/webapps.e#127 * Remove PAM build tag from tsh target in Makefile (#11666) The PAM tag is not needed when building tsh. Moreover, it was causing the push-build-windows-amd64 pipeline to fail since lib/teleterm imports lib/srv/alpnproxy which in turn indirectly depends on lib/pam. * Move WebConfig from lib/web/ui to api/client/webclient (#11690) * Move WebConfig from lib/web/ui to api/client/webclient Web config was shared with the Web UI through the dynamically generated /web/config.js file available on the cluster. With the addition of Teleport Terminal (RFD 63), the Electron app needs to get a hold of this config as well. However, unlike the Web UI which directly loads the file and injects the config this way, any communication between the cluster and Teleport Terminal is done through the tsh daemon (RFD 63). The tsh daemon needs to essentially pipe this config from /web/config.js to the gRPC response it gives to Teleport Terminal. To achieve this, a GetWebConfig function was added to TeleportClient. Unfortunately, this breaks the build on Windows as lib/web (where WebConfig resides) includes code which is not meant to be compiled or run on Windows. Since we need to share the web config with another frontend application, it only makes sense to move it to the webclient package. We already have types shared between the server and the client there, for example the PingResponse struct. Co-authored-by: Alexey Kontsevoy <[email protected]>
- Loading branch information
1 parent
eef8b5a
commit 0e016e7
Showing
94 changed files
with
19,182 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
ARG BUILDBOX_VERSION | ||
# GRPC_NODE_PLUGIN_BINARY_TYPE can be "prebuilt" or "compiled" | ||
ARG GRPC_NODE_PLUGIN_BINARY_TYPE | ||
FROM quay.io/gravitational/teleport-buildbox:$BUILDBOX_VERSION as base | ||
|
||
ARG BUILDARCH | ||
|
||
# Install buf | ||
RUN BIN="/usr/local/bin" && \ | ||
VERSION="1.0.0-rc1" && \ | ||
BINARY_NAME="buf" && \ | ||
curl -sSL \ | ||
"https://github.com/bufbuild/buf/releases/download/v${VERSION}/${BINARY_NAME}-$(uname -s)-$(uname -m)" \ | ||
-o "${BIN}/${BINARY_NAME}" && \ | ||
chmod +x "${BIN}/${BINARY_NAME}" | ||
|
||
# Install node | ||
ARG NODE_VERSION=v15.14.0 | ||
ENV NODE_URL="https://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}-linux-${BUILDARCH}.tar.xz" | ||
ENV NODE_PATH="/usr/local/lib/node-${NODE_VERSION}-linux-${BUILDARCH}" | ||
ENV PATH="$PATH:${NODE_PATH}/bin" | ||
RUN (curl -o /tmp/nodejs.tar.xz -L ${NODE_URL} && tar -xJf /tmp/nodejs.tar.xz -C /usr/local/lib) | ||
|
||
# Install js proto tools | ||
RUN (npm install --global [email protected]) | ||
RUN go install github.com/golang/protobuf/[email protected] | ||
|
||
FROM base as grpc_node_plugin_binary_prebuilt | ||
ONBUILD RUN (npm install --global [email protected]) | ||
|
||
FROM base as grpc_node_plugin_binary_compiled | ||
ONBUILD RUN apt-get update -y && \ | ||
apt-get install -q -y --no-install-recommends build-essential cmake jq && \ | ||
apt-get clean -y && \ | ||
rm -rf /var/lib/apt/lists/* | ||
ONBUILD RUN (npm install --global --ignore-scripts [email protected]) | ||
ONBUILD COPY teleterm_linux_arm64.toolchain.cmake ./linux_arm64.toolchain.cmake | ||
ONBUILD RUN git clone --depth=1 [email protected] https://github.com/grpc/grpc-node.git && \ | ||
mv linux_arm64.toolchain.cmake grpc-node/packages/grpc-tools/. && \ | ||
cd grpc-node && \ | ||
git submodule update --init --recursive && \ | ||
cd packages/grpc-tools && \ | ||
cmake -DCMAKE_TOOLCHAIN_FILE=linux_arm64.toolchain.cmake . && \ | ||
cmake --build . --target clean && cmake --build . --target grpc_node_plugin -- -j 12 && \ | ||
cp grpc_node_plugin $(npm root -g)/grpc-tools/bin/. && \ | ||
# grpc-tools requires both protoc and grpc_node_plugin, but protoc is already installed by | ||
# the buildbox image. | ||
ln -s $(which protoc) $(npm root -g)/grpc-tools/bin/protoc && \ | ||
cd ../../.. && \ | ||
rm -rf grpc-node | ||
|
||
# Choose an appropriate image and run ONBUILD instructions from it. | ||
FROM grpc_node_plugin_binary_${GRPC_NODE_PLUGIN_BINARY_TYPE} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# CMake toolchain used to build grpc_node_plugin for arm64 which is needed by grpc-tools. | ||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=armv8-a" CACHE STRING "c++ flags") | ||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=armv8-a" CACHE STRING "c flags") | ||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -march=armv8-a" CACHE STRING "ld flags") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
version: v1 | ||
lint: | ||
use: | ||
- DEFAULT | ||
except: | ||
- RPC_RESPONSE_STANDARD_NAME | ||
breaking: | ||
use: | ||
- FILE |
Oops, something went wrong.