Skip to content
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

Import ui-server. #1112

Merged
merged 41 commits into from
Feb 14, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
bcce14a
Import ui-server.
robholland Feb 3, 2023
202152e
Fix setup-go paths.
robholland Feb 3, 2023
de94c08
Lint.
robholland Feb 3, 2023
28057b6
Lint.
robholland Feb 3, 2023
41c773e
Lint.
robholland Feb 3, 2023
26fceff
Correct path in Dockerfile.
robholland Feb 6, 2023
9ec40e0
Path fixes.
robholland Feb 6, 2023
86940c3
Refactor asset handling.
robholland Feb 6, 2023
2826d50
Fix /openapi regression.
robholland Feb 6, 2023
c675c2e
Switch to UI_PUBLIC_PATH.
robholland Feb 8, 2023
0f83c58
Merge branch 'main' into rh-ui-server-merge-2
robholland Feb 8, 2023
9d41179
Add action to sync with ui-server.
robholland Feb 10, 2023
a312185
Lint.
robholland Feb 10, 2023
b13623e
Add push event to workflow for now while testing.
robholland Feb 10, 2023
d21cc71
Don't delete the whole directory :)
robholland Feb 10, 2023
3ac314d
Change directory.
robholland Feb 10, 2023
9094cc3
Don't spew the whole diff.
robholland Feb 10, 2023
a1d1d9f
Remove accidentally commited rubbish.
robholland Feb 10, 2023
88a93a9
Stage files.
robholland Feb 10, 2023
d45125c
After staging we need differences versus head.
robholland Feb 10, 2023
f29aeea
Shuffle gitignore lines so UI Server sync adds files.
robholland Feb 10, 2023
5a17a3b
Need protoc.
robholland Feb 10, 2023
bfc8da7
Need submodules to build.
robholland Feb 10, 2023
fdb0623
Remove leftover gitignore.
robholland Feb 10, 2023
f0a75f4
Debug why ui assets aren't being committed.
robholland Feb 10, 2023
632b4bf
Remove submodule which will no longer exist.
robholland Feb 10, 2023
a91dca5
Merge branch 'main' into rh-ui-server-merge-2
stevekinney Feb 10, 2023
ec762e5
Push server changes to a branch ready for review.
robholland Feb 13, 2023
5c5b58e
Adjust git auth.
robholland Feb 13, 2023
582ff45
Avoid rate limiting.
robholland Feb 13, 2023
3e8420d
Bring in changes from ui-server main.
robholland Feb 14, 2023
743e3bf
Bump API.
robholland Feb 14, 2023
fd63f07
Remove submodule git dir.
robholland Feb 14, 2023
e19d44d
Remove UI building from server code.
robholland Feb 14, 2023
ceb9830
Switch away from Makefile target for UI build.
robholland Feb 14, 2023
ea6d5c5
Add LICENSE to server.
robholland Feb 14, 2023
493f7fd
Tidy up workflows/Makefile.
robholland Feb 14, 2023
d9b0ddf
Merge branch 'main' into rh-ui-server-merge-2
robholland Feb 14, 2023
73b8baa
Lint.
robholland Feb 14, 2023
d8a31e1
Try reverting cypress workflow.
robholland Feb 14, 2023
a9ff5ee
Update port in default config.
robholland Feb 14, 2023
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
Next Next commit
Import ui-server.
  • Loading branch information
robholland committed Feb 3, 2023
commit bcce14a74626cfc72e21ba0f1766fce40e35afc6
9 changes: 9 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.github
.husky
.svelte-kit
.vscode
build
cypress
e2e
node_modules
server/ui/assets
60 changes: 60 additions & 0 deletions .github/workflows/docker-cloud.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Publish Docker image for Cloud

on:
workflow_dispatch:
release:
types:
- released

jobs:
publish_to_docker_hub:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-go@v3
with:
go-version-file: "go.mod"
cache: true
check-latest: true

- name: Set up Protoc
uses: arduino/setup-protoc@v1
with:
version: "3.x"

- name: Build GRPC
working-directory: server
run: make install-utils build-grpc

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Docker meta for Cloud Release image
id: meta_release_cloud
uses: docker/metadata-action@v3
with:
images: temporalio/cloud-ui
tags: |
type=semver,pattern={{version}}
latest

- name: Push Cloud Release image to DockerHub
uses: docker/build-push-action@v2
with:
push: true
file: Dockerfile
build-args: |
UI_TARGET=cloud
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta_release_cloud.outputs.tags }}
labels: ${{ steps.meta_release_cloud.outputs.labels }}
79 changes: 79 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Publish Docker image

on:
push:
branches:
- main
release:
types:
- released

jobs:
publish_to_docker_hub:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-go@v3
with:
go-version-file: "go.mod"
cache: true
check-latest: true

- name: Set up Protoc
uses: arduino/setup-protoc@v1
with:
version: "3.x"

- name: Build GRPC
run: make install-utils build-grpc

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Docker meta for Commit image
id: meta_commit
uses: docker/metadata-action@v3
if: github.event_name == 'push'
with:
images: temporaliotest/ui
tags: |
type=sha,format=short,event=branch
latest

- name: Push Commit image to DockerHub
uses: docker/build-push-action@v2
if: github.event_name == 'push'
with:
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta_commit.outputs.tags }}
labels: ${{ steps.meta_commit.outputs.labels }}

- name: Docker meta for Release image
id: meta_release
uses: docker/metadata-action@v3
if: github.event_name == 'release'
with:
images: temporalio/ui
tags: |
type=semver,pattern={{version}}
latest

- name: Push Release image to DockerHub
uses: docker/build-push-action@v2
if: github.event_name == 'release'
with:
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta_release.outputs.tags }}
labels: ${{ steps.meta_release.outputs.labels }}
40 changes: 40 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Server Test

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: actions/setup-go@v3
with:
go-version-file: "server/go.mod"
cache: true
check-latest: true

- name: Set up Protoc
uses: arduino/setup-protoc@v1
with:
version: "3.x"

- uses: actions/setup-node@v1
with:
node-version: 16

- uses: pnpm/action-setup@v2.2.2
with:
version: 7

- name: build
working-directory: server
run: make install build

- name: test
working-directory: server
run: make test
26 changes: 0 additions & 26 deletions .github/workflows/trigger-ui-server-update.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "server/proto/dependencies/api"]
path = server/proto/dependencies/api
url = https://github.com/temporalio/api
53 changes: 53 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
ARG BASE_SERVER_IMAGE=temporalio/base-server:1.10.0
ARG BASE_BUILDER_IMAGE=temporalio/base-builder:1.9.0

##### UI builder #####
FROM ${BASE_BUILDER_IMAGE} AS ui-builder

WORKDIR /home/ui-builder

RUN apk add --update --no-cache npm
RUN npm install -g pnpm

COPY package.json pnpm-lock.yaml ./
RUN pnpm install

COPY .babelrc .npmrc *.json *.yaml *.cjs *.js *.ts ./
COPY src src

ARG TEMPORAL_PUBLIC_PATH
ARG UI_TARGET=local
robholland marked this conversation as resolved.
Show resolved Hide resolved
ENV VITE_PUBLIC_PATH=$TEMPORAL_PUBLIC_PATH
ENV VITE_TEMPORAL_UI_BUILD_TARGET=$UI_TARGET
RUN pnpm build:server

FROM ${BASE_BUILDER_IMAGE} AS server-builder

WORKDIR /home/server-builder

COPY server/Makefile ./
RUN make install-utils

COPY server/go.mod server/go.sum ./
RUN go mod download

COPY server ./
COPY --from=ui-builder /home/ui-builder/server/ui/assets ./server/ui/assets

RUN make build-server

##### UI server #####
FROM ${BASE_SERVER_IMAGE} AS ui-server
WORKDIR /home/ui-server

RUN addgroup -g 5000 temporal
RUN adduser -u 5000 -G temporal -D temporal

COPY --from=server-builder /home/server-builder/ui-server ./
COPY server/docker/start-ui-server.sh ./start-ui-server.sh
COPY server/docker/config_template.yaml ./config/config_template.yaml

RUN chown temporal:temporal /home/ui-server -R

EXPOSE 8080
ENTRYPOINT ["./start-ui-server.sh"]
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"build:local": "vite build",
"build:docker": "VITE_API=http://localhost:8080 vite build",
"build:cloud": "VITE_TEMPORAL_UI_BUILD_TARGET=cloud vite build",
"build:server": "VITE_API= BUILD_PATH=server/ui/assets vite build",
"test": "TZ=UTC vitest",
"preview:local": "VITE_TEMPORAL_UI_BUILD_TARGET=local vite preview --port 3000",
"preview:docker": "VITE_API=http://localhost:8080 VITE_TEMPORAL_UI_BUILD_TARGET=local vite preview --port 3000",
Expand Down
4 changes: 4 additions & 0 deletions server/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ui-server
api
openapi/assets/temporal
ui/assets
87 changes: 87 additions & 0 deletions server/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
.ONESHELL:
.PHONY:

all: install build

##### Variables ######

ifndef GOPATH
GOPATH := $(shell go env GOPATH)
endif

GOBIN := $(if $(shell go env GOBIN),$(shell go env GOBIN),$(GOPATH)/bin)
PATH := $(GOBIN):$(PATH)

COLOR := "\e[1;36m%s\e[0m\n"

PROTO_ROOT := proto/api
PROTO_FILES = $(shell find $(PROTO_ROOT) -name "*.proto")
PROTO_DIRS = $(sort $(dir $(PROTO_FILES)))
PROTO_OUT := api
PROTO_IMPORTS := \
-I $(PROTO_ROOT) \
-I ./proto/dependencies/github.com/grpc-ecosystem/grpc-gateway/ \
-I ./proto/dependencies/github.com/gogo/googleapis/ \
-I ./proto/dependencies/api/ \
-I ./proto/dependencies/
PROTO_REFS := Mgoogle/protobuf/wrappers.proto=github.com/gogo/protobuf/types,Mgoogle/protobuf/duration.proto=github.com/gogo/protobuf/types,Mgoogle/protobuf/empty.proto=github.com/gogo/protobuf/types,Mgoogle/protobuf/descriptor.proto=github.com/gogo/protobuf/protoc-gen-gogo/descriptor,Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,Mgoogle/api/annotations.proto=github.com/gogo/googleapis/google/api
OPENAPI_OUT := openapi/assets
UI_OUT := ui/assets

##### Build #####
build: build-ui build-grpc build-server

build-cloud: build-ui-cloud build-grpc build-server

build-ui:
rm -rf $(UI_OUT)
go generate ./ui

build-ui-cloud:
rm -rf $(UI_OUT)
VITE_TEMPORAL_UI_BUILD_TARGET=cloud go generate ./ui

build-server:
go mod tidy
go build -o ui-server ./cmd/server/main.go

build-grpc:
@printf $(COLOR) "Compiling gRPC..."
rm -rf $(PROTO_OUT)
mkdir -p $(PROTO_OUT)
$(foreach PROTO_DIR,$(PROTO_DIRS),\
protoc $(PROTO_IMPORTS) \
--gogoslick_out=plugins=grpc,paths=source_relative,$(PROTO_REFS):$(PROTO_OUT) \
--grpc-gateway_out=allow_patch_feature=false,paths=source_relative:$(PROTO_OUT) \
--openapiv2_out=$(OPENAPI_OUT) \
$(PROTO_DIR)*.proto \
;)
@printf $(COLOR) "Fixing gRPC output paths"
mv -f $(PROTO_OUT)/temporal/api/* $(PROTO_OUT) && rm -rf $(PROTO_OUT)/temporal

##### Install dependencies #####
install: install-submodules install-utils install-ui

install-utils:
@go install github.com/temporalio/gogo-protobuf/protoc-gen-gogoslick@latest
@GO111MODULE=off go get github.com/temporalio/gogo-protobuf/protoc-gen-gogoslick
@go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest

@go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@latest
@go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@latest

install-submodules:
@printf $(COLOR) "fetching submodules..."
git submodule update --init

install-ui:
(cd ../ && pnpm install)

##### Test #####
test: clean-test-results
@printf $(COLOR) "Running unit tests..."
go test ./... -race

clean-test-results:
@rm -f test.log
@go clean -testcache
Loading