From e2abaf8471ae7e2976be4f1c8faff88a84f88745 Mon Sep 17 00:00:00 2001 From: Tony Date: Thu, 14 Nov 2024 21:25:55 +0800 Subject: [PATCH 1/4] feat: add devcontainer tool --- .devcontainer/Dockerfile | 9 ++++++ .devcontainer/devcontainer.json | 27 +++++++++++++++++ .devcontainer/docker-compose.yml | 51 ++++++++++++++++++++++++++++++++ .devcontainer/post-install.sh | 4 +++ backend/Makefile | 2 +- 5 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 .devcontainer/Dockerfile create mode 100644 .devcontainer/devcontainer.json create mode 100644 .devcontainer/docker-compose.yml create mode 100644 .devcontainer/post-install.sh diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile new file mode 100644 index 00000000000..5d15166078d --- /dev/null +++ b/.devcontainer/Dockerfile @@ -0,0 +1,9 @@ +FROM mcr.microsoft.com/devcontainers/go:1-1.22-bookworm + +ENV PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib:/usr/local/lib/pkgconfig +ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib +ENV DEVLAKE_PLUGINS=bamboo,bitbucket,circleci,customize,dora,gitextractor,github,github_graphql,gitlab,jenkins,jira,org,pagerduty,refdiff,slack,sonarqube,trello,webhook + +RUN apt-get update -y +RUN apt-get install pkg-config python3-dev default-libmysqlclient-dev build-essential libpq-dev cmake -y +RUN git clone -b v1.3.0 https://github.com/libgit2/libgit2.git && cd libgit2 && mkdir build && cd build && cmake .. && make && make install diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json new file mode 100644 index 00000000000..457ab7b4c2c --- /dev/null +++ b/.devcontainer/devcontainer.json @@ -0,0 +1,27 @@ +{ + "name": "Go", + "dockerComposeFile": "docker-compose.yml", + "service": "devcontainer", + "workspaceFolder": "/workspace", + "features": { + "ghcr.io/jungaretti/features/make:1": {}, + "ghcr.io/devcontainers/features/docker-in-docker:2.12.0": {}, + "ghcr.io/devcontainers/features/python:1": { + "version": "3.9" + }, + "ghcr.io/devcontainers-extra/features/poetry:2": {}, + "ghcr.io/devcontainers/features/node:1": { + "version": "18" + } + }, + "forwardPorts": [4000,8080], + "postCreateCommand": "npm install commitizen -g", + "customizations": { + "vscode": { + "extensions": [ + "streetsidesoftware.code-spell-checker" + ] + } + }, + "remoteUser": "root" +} diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml new file mode 100644 index 00000000000..f024d1ef98f --- /dev/null +++ b/.devcontainer/docker-compose.yml @@ -0,0 +1,51 @@ +version: '3.8' +services: + devcontainer: + build: + dockerfile: Dockerfile + volumes: + - ..:/workspace + networks: + - default + command: sleep infinity + mysql: + image: mysql:8 + volumes: + - mysql-storage:/var/lib/mysql + restart: always + ports: + - 3306:3306 + environment: + MYSQL_ROOT_PASSWORD: admin + MYSQL_DATABASE: lake + MYSQL_USER: merico + MYSQL_PASSWORD: merico + TZ: UTC + command: --character-set-server=utf8mb4 + --collation-server=utf8mb4_bin + --skip-log-bin + networks: + - default + grafana: + image: devlake.docker.scarf.sh/apache/devlake-dashboard:latest + ports: + - 3002:3000 + volumes: + - grafana-storage:/var/lib/grafana + environment: + GF_SERVER_ROOT_URL: "http://localhost:4000/grafana" + GF_USERS_DEFAULT_THEME: "light" + MYSQL_URL: mysql:3306 + MYSQL_DATABASE: lake + MYSQL_USER: merico + MYSQL_PASSWORD: merico + TZ: UTC + restart: always + depends_on: + - mysql + networks: + - default + +volumes: + mysql-storage: + grafana-storage: diff --git a/.devcontainer/post-install.sh b/.devcontainer/post-install.sh new file mode 100644 index 00000000000..203356c01d0 --- /dev/null +++ b/.devcontainer/post-install.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +make dep +npm install commitizen -g diff --git a/backend/Makefile b/backend/Makefile index 554ecfe20d9..d9f2c7caccf 100644 --- a/backend/Makefile +++ b/backend/Makefile @@ -26,7 +26,7 @@ PYTHON_DIR ?= "./python" all: build go-dep: - go install github.com/vektra/mockery/v2@2.43.0 + go install github.com/vektra/mockery/v2@v2.43.0 go install github.com/swaggo/swag/cmd/swag@v1.16.1 go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.53.3 From 644370b7aee996a49d1f0f79303bd72352e2857b Mon Sep 17 00:00:00 2001 From: Tony Date: Thu, 14 Nov 2024 21:33:02 +0800 Subject: [PATCH 2/4] fix: file format --- .devcontainer/devcontainer.json | 5 ++++- .devcontainer/docker-compose.yml | 6 ++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 457ab7b4c2c..afcffa43235 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -14,7 +14,10 @@ "version": "18" } }, - "forwardPorts": [4000,8080], + "forwardPorts": [ + 4000, + 8080 + ], "postCreateCommand": "npm install commitizen -g", "customizations": { "vscode": { diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index f024d1ef98f..75812a64ee6 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -14,16 +14,14 @@ services: - mysql-storage:/var/lib/mysql restart: always ports: - - 3306:3306 + - 3306:3306 environment: MYSQL_ROOT_PASSWORD: admin MYSQL_DATABASE: lake MYSQL_USER: merico MYSQL_PASSWORD: merico TZ: UTC - command: --character-set-server=utf8mb4 - --collation-server=utf8mb4_bin - --skip-log-bin + command: --character-set-server=utf8mb4 --collation-server=utf8mb4_bin --skip-log-bin networks: - default grafana: From f8aade9eaff6ab7ae1eff55f2254b174db338734 Mon Sep 17 00:00:00 2001 From: Tony Date: Thu, 14 Nov 2024 21:39:35 +0800 Subject: [PATCH 3/4] fix: config-ui not connect to devlake --- config-ui/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config-ui/package.json b/config-ui/package.json index 9a69135161b..8c70b92677d 100644 --- a/config-ui/package.json +++ b/config-ui/package.json @@ -5,7 +5,7 @@ "packageManager": "yarn@3.4.1", "type": "module", "scripts": { - "start": "vite", + "start": "vite --host", "build": "vite build", "preview": "vite preview", "lint": "tsc && eslint . --fix", From 86d67057a938466d3269106fce3ad58819afe2fc Mon Sep 17 00:00:00 2001 From: Tony Date: Wed, 20 Nov 2024 12:59:54 +0800 Subject: [PATCH 4/4] fix: add apache license --- .devcontainer/Dockerfile | 15 +++++++++++++++ .devcontainer/devcontainer.json | 18 ++++++++++++++++++ .devcontainer/docker-compose.yml | 15 +++++++++++++++ .devcontainer/post-install.sh | 17 ++++++++++++++++- 4 files changed, 64 insertions(+), 1 deletion(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 5d15166078d..9bf60391349 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -1,3 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + FROM mcr.microsoft.com/devcontainers/go:1-1.22-bookworm ENV PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib:/usr/local/lib/pkgconfig diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index afcffa43235..a9e43722772 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,3 +1,21 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + { "name": "Go", "dockerComposeFile": "docker-compose.yml", diff --git a/.devcontainer/docker-compose.yml b/.devcontainer/docker-compose.yml index 75812a64ee6..0246b94536e 100644 --- a/.devcontainer/docker-compose.yml +++ b/.devcontainer/docker-compose.yml @@ -1,3 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + version: '3.8' services: devcontainer: diff --git a/.devcontainer/post-install.sh b/.devcontainer/post-install.sh index 203356c01d0..6350b63dd99 100644 --- a/.devcontainer/post-install.sh +++ b/.devcontainer/post-install.sh @@ -1,4 +1,19 @@ #!/bin/sh - +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# make dep npm install commitizen -g