Skip to content

Commit f1673c1

Browse files
hatchedraviciousjakuleavatusmdwn
authored
[v10] Enable building with the new UI location (#21226)
* Changes necessary to get v10 building after the webapps merge. * move tsconfig.json to root dir, remove web makefile and dockerfile. * Remove web/packages/build from ignored files (#20400) * Run webassets build in Docker as current OS user (#20426) Set the current user when running webassets builds. In this way, the build artifacts will have correct permissions. * Add .prettierrc to teleport root (#20448) * Add nodejs to the fips dockerfile. (#20487) * Conditionally build the UI if there are changes. (#20489) * Conditionally build the UI if there are changes. `ensure-webassets` and `ensure-webassets-e` will now build the UI if the hash-of-hashes has changed since the last time the webassets were built. * Update Makefile Co-authored-by: Jeff Pihach <[email protected]> * Check for the existence of the make command. * Choose a shasum exec from a preconfigured list or use an override. * Shellcheck fix. * Remove yarn.lock from sha calculation. * Recalc SHA on successful build. * Fix linting issues. * Use Python instead of shasum. * Remove unnecessary comments from sh file. * Unconditionally rebuild if Python executable is not found. * Revert "Unconditionally rebuild if Python executable is not found." This reverts commit 9d2b0e3. * Revert "Remove unnecessary comments from sh file." This reverts commit 600e028. * Revert use of Python, use simplified shell scripting. * Linting fixes. * Apply suggestions from code review Co-authored-by: Edoardo Spadolini <[email protected]> * Remove reference to realpath as apparently the MacOS builder doesn't have it. * calculate_sha must return 0. * Use echo in calculate_sha or else set -o pipefail causes failures. * Suppress SC2005. --------- Co-authored-by: Jeff Pihach <[email protected]> Co-authored-by: Edoardo Spadolini <[email protected]> * Add BUILDARCH arg to fips dockerfile. (#20495) * Resolve issues to enable passing CI tests. (#20582) * Move lint commands to root package.json * Correctly resolve e-teleport paths. * Fix prettier issues. * move eslint configuration files to root. * resolve lint errors. * Update xterm-addon-fit (#20696) This resolves an issue when starting an SSH session from the web UI, and also fixes the out-of-date lock file. * Move jest, eslint & prettier to the root (#20698) * Move jest, eslint & prettier to the root * Update e ref * Move storybook to root package.json and fix config so e components are rendered. (#20723) * update yarn lock. --------- Co-authored-by: Rafał Cieślak <[email protected]> Co-authored-by: Jakub Nyckowski <[email protected]> Co-authored-by: Michael <[email protected]> Co-authored-by: Michael Wilson <[email protected]> Co-authored-by: Edoardo Spadolini <[email protected]> Co-authored-by: Zac Bergquist <[email protected]> Co-authored-by: Ryan Clark <[email protected]>
1 parent f1369e4 commit f1673c1

38 files changed

+411
-892
lines changed

.drone.yml

+28-86
Large diffs are not rendered by default.

web/.eslintignore .eslintignore

File renamed without changes.

.eslintrc.js

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
const eslint = require('./web/packages/build/.eslintrc');
2+
module.exports = eslint;

.gitignore

+5
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ darwin
2020
# Compiled binaries, Object files, Static and Dynamic libs (Shared Objects)
2121
out
2222
build
23+
!/web/packages/build
2324
*.o
2425
*.a
2526
*.so
@@ -82,3 +83,7 @@ go.work.sum
8283

8384
# Buf side-effects
8485
/github.com
86+
node_modules
87+
88+
.air.toml
89+
webassets/

.gitmodules

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
[submodule "e"]
22
path = e
33
url = [email protected]:gravitational/teleport.e.git
4-
[submodule "webassets"]
5-
path = webassets
6-
url = https://github.com/gravitational/webassets.git
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Ignore directories:
2-
packages/design/src/assets/**
3-
packages/**/dist/**
2+
*/packages/design/src/assets/**
3+
*/packages/**/dist/**
44

55
# Ignore protobuf files:
66
**/*_pb.*

web/.prettierrc .prettierrc

File renamed without changes.

Makefile

+34-32
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ DOCKER_IMAGE ?= teleport
1717

1818
GOPATH ?= $(shell go env GOPATH)
1919

20+
# This directory will be the real path of the directory of the first Makefile in the list.
21+
MAKE_DIR := $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
22+
2023
# These are standard autotools variables, don't change them please
2124
ifneq ("$(wildcard /bin/bash)","")
2225
SHELL := /bin/bash -o pipefail
@@ -221,10 +224,10 @@ CLANG_FORMAT_STYLE = '{ColumnLimit: 100, IndentWidth: 4, Language: Proto}'
221224
#
222225
# 'make all' builds all 3 executables and places them in the current directory.
223226
#
224-
# IMPORTANT: the binaries will not contain the web UI assets and `teleport`
225-
# won't start without setting the environment variable DEBUG=1
226-
# This is the default build target for convenience of working on
227-
# a web UI.
227+
# IMPORTANT:
228+
# Unless called with the `WEBASSETS_TAG` env variable set to "webassets_embed"
229+
# the binaries will not contain the web UI assets and `teleport` won't start
230+
# without setting the environment variable DEBUG=1.
228231
.PHONY: all
229232
all: version
230233
@echo "---> Building OSS binaries."
@@ -324,7 +327,7 @@ endif
324327
# make full-ent - Builds Teleport enterprise binaries
325328
#
326329
.PHONY:full-ent
327-
full-ent:
330+
full-ent: ensure-webassets-e
328331
ifneq ("$(OS)", "windows")
329332
@if [ -f e/Makefile ]; then \
330333
rm $(ASSETS_BUILDDIR)/webassets; \
@@ -335,7 +338,7 @@ endif
335338
# make clean - Removes all build artifacts.
336339
#
337340
.PHONY: clean
338-
clean:
341+
clean: clean-ui
339342
@echo "---> Cleaning up OSS build artifacts."
340343
rm -rf $(BUILDDIR)
341344
rm -rf $(ER_BPF_BUILDDIR)
@@ -348,13 +351,18 @@ clean:
348351
rm -f gitref.go
349352
rm -rf build.assets/tooling/bin
350353

354+
.PHONY: clean-ui
355+
clean-ui:
356+
rm -rf webassets/*
357+
find . -type d -name node_modules -prune -exec rm -rf {} \;
358+
351359
#
352360
# make release - Produces a binary release tarball.
353361
#
354362
.PHONY:
355363
export
356364
release:
357-
@echo "---> $(RELEASE_MESSAGE)"
365+
@echo "---> OSS $(RELEASE_MESSAGE)"
358366
ifeq ("$(OS)", "windows")
359367
$(MAKE) --no-print-directory release-windows
360368
else ifeq ("$(OS)", "darwin")
@@ -1137,39 +1145,17 @@ test-compat:
11371145

11381146
.PHONY: ensure-webassets
11391147
ensure-webassets:
1140-
@if [ ! -d $(shell pwd)/webassets/teleport/ ]; then \
1141-
$(MAKE) init-webapps-submodules; \
1142-
fi;
1148+
@MAKE="$(MAKE)" "$(MAKE_DIR)/build.assets/build-webassets-if-changed.sh" OSS webassets/oss-sha build-ui web
11431149

11441150
.PHONY: ensure-webassets-e
11451151
ensure-webassets-e:
1146-
@if [ ! -d $(shell pwd)/webassets/e/teleport ]; then \
1147-
$(MAKE) init-webapps-submodules-e; \
1148-
fi;
1149-
1150-
.PHONY: init-webapps-submodules
1151-
init-webapps-submodules:
1152-
echo "init webassets submodule"
1153-
git submodule update --init webassets
1154-
1155-
.PHONY: init-webapps-submodules-e
1156-
init-webapps-submodules-e:
1157-
echo "init webassets oss and enterprise submodules"
1158-
git submodule update --init --recursive webassets
1152+
@MAKE="$(MAKE)" "$(MAKE_DIR)/build.assets/build-webassets-if-changed.sh" Enterprise webassets/e/e-sha build-ui-e web e/web
11591153

11601154
.PHONY: init-submodules-e
1161-
init-submodules-e: init-webapps-submodules-e
1155+
init-submodules-e:
11621156
git submodule init e
11631157
git submodule update
11641158

1165-
# update-webassets updates the minified code in the webassets repo using the latest webapps
1166-
# repo and creates a PR in the teleport repo to update webassets submodule.
1167-
.PHONY: update-webassets
1168-
update-webassets: WEBAPPS_BRANCH ?= 'master'
1169-
update-webassets: TELEPORT_BRANCH ?= 'master'
1170-
update-webassets:
1171-
build.assets/webapps/update-teleport-webassets.sh -w $(WEBAPPS_BRANCH) -t $(TELEPORT_BRANCH)
1172-
11731159
# dronegen generates .drone.yml config
11741160
#
11751161
# Usage:
@@ -1187,3 +1173,19 @@ dronegen:
11871173
.PHONY: backport
11881174
backport:
11891175
(cd ./assets/backport && go run main.go -pr=$(PR) -to=$(TO))
1176+
1177+
.PHONY: ensure-js-deps
1178+
ensure-js-deps:
1179+
yarn install --ignore-scripts
1180+
1181+
.PHONY: build-ui
1182+
build-ui: ensure-js-deps
1183+
yarn build-ui-oss
1184+
1185+
.PHONY: build-ui-e
1186+
build-ui-e: ensure-js-deps
1187+
yarn build-ui-e
1188+
1189+
.PHONY: docker-ui
1190+
docker-ui:
1191+
$(MAKE) -C build.assets ui

README.md

+38-41
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,21 @@ SSH, HTTPS, RDP, Kubernetes API, MySQL, MongoDB and PostgreSQL wire protocols.
4242
On the server-side, Teleport is a single binary which enables convenient secure
4343
access to behind-NAT resources such as:
4444

45-
* [SSH nodes](https://goteleport.com/docs/getting-started/) - SSH works in browsers too!
46-
* [Kubernetes clusters](https://goteleport.com/docs/kubernetes-access/introduction/)
47-
* [PostgreSQL, MongoDB, CockroachDB and MySQL databases](https://goteleport.com/docs/database-access/introduction/)
48-
* [Internal Web apps](https://goteleport.com/docs/application-access/introduction/)
49-
* [Windows Hosts](https://goteleport.com/docs/desktop-access/introduction/)
50-
* [Networked servers](https://goteleport.com/docs/server-access/introduction/)
45+
- [SSH nodes](https://goteleport.com/docs/getting-started/) - SSH works in browsers too!
46+
- [Kubernetes clusters](https://goteleport.com/docs/kubernetes-access/introduction/)
47+
- [PostgreSQL, MongoDB, CockroachDB and MySQL databases](https://goteleport.com/docs/database-access/introduction/)
48+
- [Internal Web apps](https://goteleport.com/docs/application-access/introduction/)
49+
- [Windows Hosts](https://goteleport.com/docs/desktop-access/introduction/)
50+
- [Networked servers](https://goteleport.com/docs/server-access/introduction/)
5151

5252
Teleport is trivial to set up as a Linux daemon or in a Kubernetes pod. It's rapidly
5353
replacing legacy `sshd`-based setups at organizations who need:
5454

55-
* Developer convenience of having instant secure access to everything they need
55+
- Developer convenience of having instant secure access to everything they need
5656
across many environments and cloud providers.
57-
* Audit log with session recording/replay for multiple protocols
58-
* Easily manage trust between teams, organizations and data centers.
59-
* Role-based access control (RBAC) and flexible access workflows (one-time [access requests](https://goteleport.com/features/access-requests/))
57+
- Audit log with session recording/replay for multiple protocols
58+
- Easily manage trust between teams, organizations and data centers.
59+
- Role-based access control (RBAC) and flexible access workflows (one-time [access requests](https://goteleport.com/features/access-requests/))
6060

6161
In addition to its hallmark features, Teleport is interesting for smaller teams
6262
because it facilitates easy adoption of the best infrastructure security
@@ -72,16 +72,15 @@ Teleport is built upon the high-quality [Golang SSH](https://godoc.org/golang.or
7272
implementation. It is _fully compatible with OpenSSH_,
7373
`sshd` servers, and `ssh` clients.
7474

75-
|Project Links| Description
76-
|---|----
77-
| [Teleport Website](https://goteleport.com/) | The official website of the project. |
78-
| [Documentation](https://goteleport.com/docs/) | Admin guide, user manual and more. |
79-
| [Demo Video](https://www.youtube.com/watch?v=b1WHFW0NIoM) | 3-minute video overview of Teleport. |
80-
| [Blog](https://goteleport.com/blog/) | Our blog where we publish Teleport news. |
81-
| [Forum](https://github.com/gravitational/teleport/discussions) | Ask us a setup question, post your tutorial, feedback, or idea on our forum. |
82-
| [Slack](https://goteleport.com/slack) | Need help with your setup? Ping us in our Slack channel. |
83-
| [Cloud-hosted](https://goteleport.com/pricing) | We offer Enterprise with a Cloud-hosted option. For teams that require easy and secure access to their computing environments. |
84-
75+
| Project Links | Description |
76+
| -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
77+
| [Teleport Website](https://goteleport.com/) | The official website of the project. |
78+
| [Documentation](https://goteleport.com/docs/) | Admin guide, user manual and more. |
79+
| [Demo Video](https://www.youtube.com/watch?v=b1WHFW0NIoM) | 3-minute video overview of Teleport. |
80+
| [Blog](https://goteleport.com/blog/) | Our blog where we publish Teleport news. |
81+
| [Forum](https://github.com/gravitational/teleport/discussions) | Ask us a setup question, post your tutorial, feedback, or idea on our forum. |
82+
| [Slack](https://goteleport.com/slack) | Need help with your setup? Ping us in our Slack channel. |
83+
| [Cloud-hosted](https://goteleport.com/pricing) | We offer Enterprise with a Cloud-hosted option. For teams that require easy and secure access to their computing environments. |
8584

8685
## Installing and Running
8786

@@ -101,7 +100,7 @@ In a production environment, Teleport must run as `root`. For testing or non-pro
101100

102101
`chown $USER /var/lib/teleport`
103102

104-
* In this case, you will not be able to log in as another user.
103+
- In this case, you will not be able to log in as another user.
105104

106105
## Docker
107106

@@ -110,10 +109,12 @@ In a production environment, Teleport must run as `root`. For testing or non-pro
110109
### Deploy Teleport
111110

112111
If you wish to deploy Teleport inside a Docker container:
112+
113113
```
114114
# This command will pull the Teleport container image for version 8
115115
docker pull public.ecr.aws/gravitational/teleport:8
116116
```
117+
117118
View latest tags on [Amazon ECR Public | gravitational/teleport](https://gallery.ecr.aws/gravitational/teleport)
118119

119120
### For Local Testing and Development
@@ -127,8 +128,8 @@ and a web UI written in Javascript (a git submodule located in the `webassets/`
127128
directory).
128129

129130
If your intention is to build and deploy for use in a production infrastructure
130-
a released tag should be used. The default branch, `master`, is the current
131-
development branch for an upcoming major version. Get the latest release tags
131+
a released tag should be used. The default branch, `master`, is the current
132+
development branch for an upcoming major version. Get the latest release tags
132133
listed at https://goteleport.com/download/ and then use that tag in the `git clone`.
133134
For example `git clone https://github.com/gravitational/teleport.git -b v9.1.2` gets release v9.1.2.
134135

@@ -164,32 +165,29 @@ If the build succeeds, the installer will place the binaries in the `build` dire
164165

165166
**Important:**
166167

167-
* The Go compiler is somewhat sensitive to the amount of memory: you will need
168+
- The Go compiler is somewhat sensitive to the amount of memory: you will need
168169
**at least** 1GB of virtual memory to compile Teleport. A 512MB instance
169170
without swap will **not** work.
170-
* This will build the latest version of Teleport, **regardless** of whether it
171+
- This will build the latest version of Teleport, **regardless** of whether it
171172
is stable. If you want to build the latest stable release, run `git checkout`
172173
to the corresponding tag (for example, run `git checkout v8.0.0`) **before**
173174
running `make full`.
174175

175176
### Web UI
176177

177-
The Teleport Web UI resides in the [Gravitational Webapps](https://github.com/gravitational/webapps) repo.
178+
The Teleport Web UI resides in the [web](web) directory.
178179

179180
#### Rebuilding Web UI for development
180181

181-
To clone this repository and rebuild the Teleport UI package, run the following commands:
182+
To rebuild the Teleport UI package, run the following command:
182183

183184
```bash
184-
$ git clone [email protected]:gravitational/webapps.git
185-
$ cd webapps
186-
$ make build-teleport
185+
make docker-ui
187186
```
188187

189188
Then you can replace Teleport Web UI files with the files from the newly-generated `/dist` folder.
190189

191-
To enable speedy iterations on the Web UI, you can run a
192-
[local web-dev server](https://github.com/gravitational/webapps/tree/master/packages/teleport).
190+
To enable speedy iterations on the Web UI, you can run a [local web-dev server](web#web-ui)
193191

194192
You can also tell Teleport to load the Web UI assets from the source directory.
195193
To enable this behavior, set the environment variable `DEBUG=1` and rebuild with the default target:
@@ -200,7 +198,7 @@ $ DEBUG=1 ./build/teleport start -d
200198
```
201199

202200
Keep the server running in this mode, and make your UI changes in `/dist` directory.
203-
For instructions about how to update the Web UI, read [the `webapps` README](https://github.com/gravitational/webapps/blob/master/README.md.) file.
201+
For instructions about how to update the Web UI, read [the `web` README](web#readme).
204202

205203
#### Updating Web UI assets
206204

@@ -228,7 +226,6 @@ go get github.com/new/dependency
228226

229227
and update the source to use this dependency.
230228

231-
232229
To get a specific version, use `go get github.com/new/dependency@version` instead.
233230

234231
#### Set dependency to a specific version
@@ -271,18 +268,18 @@ We had a choice, either start a security consulting business or build a solution
271268

272269
## More Information
273270

274-
* [Teleport Getting Started](https://goteleport.com/docs/getting-started/)
275-
* [Teleport Architecture](https://goteleport.com/teleport/docs/architecture)
276-
* [Reference](https://goteleport.com/docs/setup/reference/)
277-
* [FAQ](https://goteleport.com/docs/faq)
271+
- [Teleport Getting Started](https://goteleport.com/docs/getting-started/)
272+
- [Teleport Architecture](https://goteleport.com/teleport/docs/architecture)
273+
- [Reference](https://goteleport.com/docs/setup/reference/)
274+
- [FAQ](https://goteleport.com/docs/faq)
278275

279276
## Support and Contributing
280277

281278
We offer a few different options for support. First of all, we try to provide clear and comprehensive documentation. The docs are also in Github, so feel free to create a PR or file an issue if you have ideas for improvements. If you still have questions after reviewing our docs, you can also:
282279

283-
* Join [Teleport Discussions](https://github.com/gravitational/teleport/discussions) to ask questions. Our engineers are available there to help you.
284-
* If you want to contribute to Teleport or file a bug report/issue, you can create an issue here in Github.
285-
* If you are interested in Teleport Enterprise or more responsive support during a POC, we can also create a dedicated Slack channel for you during your POC. You can [reach out to us through our website](https://goteleport.com/pricing/) to arrange for a POC.
280+
- Join [Teleport Discussions](https://github.com/gravitational/teleport/discussions) to ask questions. Our engineers are available there to help you.
281+
- If you want to contribute to Teleport or file a bug report/issue, you can create an issue here in Github.
282+
- If you are interested in Teleport Enterprise or more responsive support during a POC, we can also create a dedicated Slack channel for you during your POC. You can [reach out to us through our website](https://goteleport.com/pricing/) to arrange for a POC.
286283

287284
## Is Teleport Secure and Production Ready?
288285

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const baseCfg = require('@gravitational/build/.babelrc');
2-
module.exports = function(api) {
2+
module.exports = function (api) {
33
api.cache(true);
44
return baseCfg;
55
};

build.assets/Dockerfile-fips

+14
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,20 @@ ENV GOEXPERIMENT=boringcrypto \
6767
GOROOT="/opt/go" \
6868
PATH="$PATH:/opt/go/bin:/go/bin:/go/src/github.com/gravitational/teleport/build"
6969

70+
ARG BUILDARCH
71+
72+
# Install Nodejs
73+
ARG NODE_VERSION
74+
ENV NODE_URL="https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-${BUILDARCH}.tar.xz"
75+
ENV NODE_PATH="/usr/local/lib/nodejs-linux"
76+
ENV PATH="$PATH:${NODE_PATH}/bin"
77+
RUN export NODE_ARCH=$(if [ "$BUILDARCH" = "amd64" ]; then echo "x64"; else echo "arm64"; fi) && \
78+
export NODE_URL="https://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-${NODE_ARCH}.tar.xz" && \
79+
mkdir -p ${NODE_PATH} && \
80+
curl -o /tmp/nodejs.tar.xz -L ${NODE_URL} && \
81+
tar -xJf /tmp/nodejs.tar.xz -C /usr/local/lib/nodejs-linux --strip-components=1
82+
RUN corepack enable yarn
83+
7084
# Install libbpf
7185
ARG LIBBPF_VERSION
7286
RUN mkdir -p /opt && cd /opt && curl -L https://github.com/gravitational/libbpf/archive/refs/tags/v${LIBBPF_VERSION}.tar.gz | tar xz && \

0 commit comments

Comments
 (0)