-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ac26bb0
Showing
403 changed files
with
23,113 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
**/.classpath | ||
**/dist | ||
**/.dockerignore | ||
**/.env | ||
**/.git | ||
**/.gitignore | ||
**/.project | ||
**/.settings | ||
**/.toolstarget | ||
**/.vs | ||
**/.vscode | ||
**/*.*proj.user | ||
**/*.dbmdl | ||
**/*.jfm | ||
**/azds.yaml | ||
**/bin | ||
**/charts | ||
**/docker-compose* | ||
**/Dockerfile* | ||
**/node_modules | ||
**/npm-debug.log | ||
**/obj | ||
**/secrets.dev.yaml | ||
**/values.dev.yaml | ||
LICENSE | ||
README.md | ||
!**/.gitignore | ||
!.git/HEAD | ||
!.git/config | ||
!.git/packed-refs | ||
!.git/refs/heads/** |
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,7 @@ | ||
*.dart text eol=lf | ||
*.md text eol=lf | ||
*.txt text eol=lf | ||
*.json text eol=lf | ||
*.cc text eol=lf | ||
*.cmake text eol=lf | ||
*.swift text eol=lf |
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,23 @@ | ||
name: build | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
|
||
jobs: | ||
|
||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Build the Docker image | ||
run: | | ||
docker build . --file Dockerfile | ||
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,31 @@ | ||
name: publish docker | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
jobs: | ||
|
||
publish: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Build the Docker image | ||
run: | | ||
docker login --username=springhgui0127 registry.cn-hangzhou.aliyuncs.com --password=${{ secrets.PASSWORD }} | ||
version=$(grep "<Version>" src/Directory.Build.props | awk -F'[<>]' '{print $3}') | ||
echo $version | ||
appName=registry.cn-hangzhou.aliyuncs.com/hgui/opentask | ||
tag=$appName:$version-$(date +%s) | ||
latestTag=$appName:latest | ||
echo $tag | ||
docker build . --file Dockerfile --tag $tag | ||
docker push $tag | ||
docker tag $tag $latestTag | ||
docker push $latestTag | ||
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,70 @@ | ||
name: publish nuget | ||
|
||
on: | ||
push: | ||
tags: | ||
- v* | ||
|
||
jobs: | ||
publish: | ||
name: publish-core | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- uses: actions/checkout@v2 | ||
|
||
- name: Setup dotnet | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: 8.0.* | ||
include-prerelease: true | ||
- name: Package | ||
run: dotnet build -c Release -o . src/OpenTask.Core/OpenTask.Core.csproj | ||
- name: Publish | ||
run: dotnet nuget push *.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate | ||
|
||
# Publish | ||
# - name: publish on version change | ||
# id: publish_nuget | ||
# uses: brandedoutcast/publish-nuget@v2 | ||
# with: | ||
# # Filepath of the project to be packaged, relative to root of repository | ||
# PROJECT_FILE_PATH: src/OpenTask.Core/OpenTask.Core.csproj | ||
# VERSION_STATIC: ${{ github.ref }} | ||
|
||
# NUGET_KEY: ${{secrets.NUGET_API_KEY}} | ||
|
||
# Configuration to build and package | ||
# BUILD_CONFIGURATION: Release | ||
|
||
# Platform target to compile (default is empty/AnyCPU) | ||
# BUILD_PLATFORM: x64 | ||
|
||
# NuGet package id, used for version detection & defaults to project name | ||
# PACKAGE_NAME: Core | ||
|
||
# Filepath with version info, relative to root of repository & defaults to PROJECT_FILE_PATH | ||
# VERSION_FILE_PATH: Directory.Build.props | ||
|
||
# Regex pattern to extract version info in a capturing group | ||
# VERSION_REGEX: ^\s*<Version>(.*)<\/Version>\s*$ | ||
|
||
# Useful with external providers like Nerdbank.GitVersioning, ignores VERSION_FILE_PATH & VERSION_REGEX | ||
# VERSION_STATIC: 1.0.0 | ||
|
||
# Flag to toggle git tagging, enabled by default | ||
# TAG_COMMIT: true | ||
|
||
# Format of the git tag, [*] gets replaced with actual version | ||
# TAG_FORMAT: v* | ||
|
||
# API key to authenticate with NuGet server | ||
# NUGET_KEY: ${{secrets.NUGET_API_KEY}} | ||
|
||
# NuGet server uri hosting the packages, defaults to https://api.nuget.org | ||
# NUGET_SOURCE: https://api.nuget.org | ||
|
||
# Flag to toggle pushing symbols along with nuget package to the server, disabled by default | ||
# INCLUDE_SYMBOLS: false | ||
|
||
|
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 @@ | ||
/src/.vs | ||
obj | ||
bin | ||
logs |
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,44 @@ | ||
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging. | ||
|
||
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base | ||
USER app | ||
WORKDIR /app | ||
EXPOSE 8080 | ||
EXPOSE 1883 | ||
|
||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build | ||
ARG BUILD_CONFIGURATION=Release | ||
WORKDIR /src | ||
COPY ["src/OpenTask.WebApi/OpenTask.WebApi.csproj", "OpenTask.WebApi/"] | ||
COPY ["src/OpenTask.Application/OpenTask.Application.csproj", "OpenTask.Application/"] | ||
COPY ["src/OpenTask.Core/OpenTask.Core.csproj", "OpenTask.Core/"] | ||
COPY ["src/OpenTask.Domain/OpenTask.Domain.csproj", "OpenTask.Domain/"] | ||
COPY ["src/OpenTask.Utility/OpenTask.Utility.csproj", "OpenTask.Utility/"] | ||
COPY ["src/OpenTask.Persistence/OpenTask.Persistence.csproj", "OpenTask.Persistence/"] | ||
RUN dotnet restore "OpenTask.WebApi/OpenTask.WebApi.csproj" | ||
COPY src . | ||
WORKDIR "/src/OpenTask.WebApi" | ||
RUN dotnet build "OpenTask.WebApi.csproj" -c $BUILD_CONFIGURATION -o /app/build | ||
|
||
FROM build AS publish | ||
ARG BUILD_CONFIGURATION=Release | ||
RUN dotnet publish "OpenTask.WebApi.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false | ||
|
||
# ui | ||
FROM registry.cn-hangzhou.aliyuncs.com/hgui/node:20.12.0 AS ui | ||
WORKDIR /app | ||
COPY ["ui/vite-opentask", "./"] | ||
RUN rm -rf package-lock.json node_modules | ||
#RUN npm config set registry https://registry.npmmirror.com | ||
RUN npm i | ||
RUN npm run build | ||
|
||
FROM base AS final | ||
WORKDIR /app | ||
|
||
ENV TZ=Asia/Shanghai | ||
|
||
RUN chmod 777 /app | ||
COPY --from=publish /app/publish . | ||
COPY --from=ui /app/dist ./wwwroot | ||
ENTRYPOINT ["dotnet", "OpenTask.WebApi.dll"] |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Gui.H | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,37 @@ | ||
# OpenTask | ||
|
||
[![Build status](https://github.com/SpringHgui/OpenTask/workflows/build/badge.svg)](https://github.com/SpringHgui/OpenTask/actions) | ||
|
||
去中心设计的分布式任务调度平台 | ||
|
||
# 快速开始 | ||
## 1. 调度中心部署 | ||
1. docker-compose | ||
``` | ||
# 克隆本项目 | ||
cd deploy/docker-compose | ||
docker-compose up -d | ||
``` | ||
2. k8s | ||
|
||
3. docker | ||
|
||
4. 传统手动部署 | ||
|
||
## 2. 执行节点开发 | ||
参考 [`src/OpenTask.Client` | ||
](https://github.com/SpringHgui/OpenTask/tree/f37696f51cf642a8dbf043fabb90568bdbf295e7/src/OpenTask.Client) | ||
## 高级配置 | ||
1. 使用已有的数据库 | ||
|
||
|
||
# 贡献指南 | ||
1. 开发数据库搭建 | ||
``` | ||
docker run -e MYSQL_DATABASE=open_task -e MYSQL_ROOT_PASSWORD=OPEN_TASK_!@# -p 3308:3306 --name=mysql8 -d registry.cn-hangzhou.aliyuncs.com/hgui/mysql:8.4.1 | ||
``` | ||
2. 安装vs2022 | ||
打开`OpenTask.sln`解决方案进行开发 | ||
|
||
# 开源协议 | ||
MIT |
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,21 @@ | ||
# Security Policy | ||
|
||
## Supported Versions | ||
|
||
Use this section to tell people about which versions of your project are | ||
currently being supported with security updates. | ||
|
||
| Version | Supported | | ||
| ------- | ------------------ | | ||
| 5.1.x | :white_check_mark: | | ||
| 5.0.x | :x: | | ||
| 4.0.x | :white_check_mark: | | ||
| < 4.0 | :x: | | ||
|
||
## Reporting a Vulnerability | ||
|
||
Use this section to tell people how to report a vulnerability. | ||
|
||
Tell them where to go, how often they can expect to get an update on a | ||
reported vulnerability, what to expect if the vulnerability is accepted or | ||
declined, etc. |
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,30 @@ | ||
version: '3.9' | ||
services: | ||
mysql: | ||
restart: always | ||
image: registry.cn-hangzhou.aliyuncs.com/hgui/mysql:8.4.1 | ||
container_name: mysql | ||
volumes: | ||
- /apps/mysql/mysql:/var/lib/mysql | ||
- /apps/mysql/conf.d:/etc/mysql/conf.d | ||
environment: | ||
- "MYSQL_ROOT_PASSWORD=OPEN_TASK_!@#" | ||
- "MYSQL_DATABASE=open_task" | ||
ports: | ||
- 3306:3306 | ||
|
||
api: | ||
restart: always | ||
image: registry.cn-hangzhou.aliyuncs.com/hgui/opentask:latest | ||
container_name: opentask | ||
depends_on: | ||
- mysql | ||
volumes: | ||
- /apps/opentask/logs:/app/Logs | ||
environment: | ||
- "ConnectionStrings__Core=server=mysql;Port=3306;user id=root;database=open_task;pooling=true;password=OPEN_TASK_!@#" | ||
- "TZ=Asia/Shanghai" | ||
ports: | ||
- 8080:8080 | ||
links: | ||
- mysql |
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,23 @@ | ||
#!/bin/bash | ||
if command -v podman &> /dev/null; then | ||
alias docker=podman | ||
else | ||
echo "podman not installed" | ||
fi | ||
|
||
# 读取文件内容,并使用grep和awk提取Version的值 | ||
version=$(grep "<Version>" src/Directory.Build.props | awk -F'[<>]' '{print $3}') | ||
appName=registry.cn-hangzhou.aliyuncs.com/hgui/opentask:$version | ||
# 输出Version的值 | ||
echo "Version: $version" | ||
|
||
docker build . -t $appName | ||
if [ $? -ne 0 ]; then | ||
echo "docker image build fail 😭😭😭" | ||
else | ||
echo "docker image build success 🎉🎉🎉" | ||
fi | ||
|
||
docker push $appName | ||
read | ||
exit 1 |
Oops, something went wrong.