Skip to content

Commit ac26bb0

Browse files
committed
初始化项目
0 parents  commit ac26bb0

File tree

403 files changed

+23113
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

403 files changed

+23113
-0
lines changed

.dockerignore

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
**/.classpath
2+
**/dist
3+
**/.dockerignore
4+
**/.env
5+
**/.git
6+
**/.gitignore
7+
**/.project
8+
**/.settings
9+
**/.toolstarget
10+
**/.vs
11+
**/.vscode
12+
**/*.*proj.user
13+
**/*.dbmdl
14+
**/*.jfm
15+
**/azds.yaml
16+
**/bin
17+
**/charts
18+
**/docker-compose*
19+
**/Dockerfile*
20+
**/node_modules
21+
**/npm-debug.log
22+
**/obj
23+
**/secrets.dev.yaml
24+
**/values.dev.yaml
25+
LICENSE
26+
README.md
27+
!**/.gitignore
28+
!.git/HEAD
29+
!.git/config
30+
!.git/packed-refs
31+
!.git/refs/heads/**

.gitattributes

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
*.dart text eol=lf
2+
*.md text eol=lf
3+
*.txt text eol=lf
4+
*.json text eol=lf
5+
*.cc text eol=lf
6+
*.cmake text eol=lf
7+
*.swift text eol=lf

.github/workflows/build.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: build
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
jobs:
10+
11+
build:
12+
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Build the Docker image
18+
run: |
19+
docker build . --file Dockerfile
20+
21+
22+
23+

.github/workflows/docker.yml

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: publish docker
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
jobs:
8+
9+
publish:
10+
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Build the Docker image
16+
run: |
17+
docker login --username=springhgui0127 registry.cn-hangzhou.aliyuncs.com --password=${{ secrets.PASSWORD }}
18+
version=$(grep "<Version>" src/Directory.Build.props | awk -F'[<>]' '{print $3}')
19+
echo $version
20+
appName=registry.cn-hangzhou.aliyuncs.com/hgui/opentask
21+
tag=$appName:$version-$(date +%s)
22+
latestTag=$appName:latest
23+
echo $tag
24+
docker build . --file Dockerfile --tag $tag
25+
docker push $tag
26+
docker tag $tag $latestTag
27+
docker push $latestTag
28+
29+
30+
31+

.github/workflows/nuget.yml

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: publish nuget
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
jobs:
9+
publish:
10+
name: publish-core
11+
runs-on: ubuntu-latest
12+
steps:
13+
14+
- uses: actions/checkout@v2
15+
16+
- name: Setup dotnet
17+
uses: actions/setup-dotnet@v1
18+
with:
19+
dotnet-version: 8.0.*
20+
include-prerelease: true
21+
- name: Package
22+
run: dotnet build -c Release -o . src/OpenTask.Core/OpenTask.Core.csproj
23+
- name: Publish
24+
run: dotnet nuget push *.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate
25+
26+
# Publish
27+
# - name: publish on version change
28+
# id: publish_nuget
29+
# uses: brandedoutcast/publish-nuget@v2
30+
# with:
31+
# # Filepath of the project to be packaged, relative to root of repository
32+
# PROJECT_FILE_PATH: src/OpenTask.Core/OpenTask.Core.csproj
33+
# VERSION_STATIC: ${{ github.ref }}
34+
35+
# NUGET_KEY: ${{secrets.NUGET_API_KEY}}
36+
37+
# Configuration to build and package
38+
# BUILD_CONFIGURATION: Release
39+
40+
# Platform target to compile (default is empty/AnyCPU)
41+
# BUILD_PLATFORM: x64
42+
43+
# NuGet package id, used for version detection & defaults to project name
44+
# PACKAGE_NAME: Core
45+
46+
# Filepath with version info, relative to root of repository & defaults to PROJECT_FILE_PATH
47+
# VERSION_FILE_PATH: Directory.Build.props
48+
49+
# Regex pattern to extract version info in a capturing group
50+
# VERSION_REGEX: ^\s*<Version>(.*)<\/Version>\s*$
51+
52+
# Useful with external providers like Nerdbank.GitVersioning, ignores VERSION_FILE_PATH & VERSION_REGEX
53+
# VERSION_STATIC: 1.0.0
54+
55+
# Flag to toggle git tagging, enabled by default
56+
# TAG_COMMIT: true
57+
58+
# Format of the git tag, [*] gets replaced with actual version
59+
# TAG_FORMAT: v*
60+
61+
# API key to authenticate with NuGet server
62+
# NUGET_KEY: ${{secrets.NUGET_API_KEY}}
63+
64+
# NuGet server uri hosting the packages, defaults to https://api.nuget.org
65+
# NUGET_SOURCE: https://api.nuget.org
66+
67+
# Flag to toggle pushing symbols along with nuget package to the server, disabled by default
68+
# INCLUDE_SYMBOLS: false
69+
70+

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/src/.vs
2+
obj
3+
bin
4+
logs

Dockerfile

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#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.
2+
3+
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
4+
USER app
5+
WORKDIR /app
6+
EXPOSE 8080
7+
EXPOSE 1883
8+
9+
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
10+
ARG BUILD_CONFIGURATION=Release
11+
WORKDIR /src
12+
COPY ["src/OpenTask.WebApi/OpenTask.WebApi.csproj", "OpenTask.WebApi/"]
13+
COPY ["src/OpenTask.Application/OpenTask.Application.csproj", "OpenTask.Application/"]
14+
COPY ["src/OpenTask.Core/OpenTask.Core.csproj", "OpenTask.Core/"]
15+
COPY ["src/OpenTask.Domain/OpenTask.Domain.csproj", "OpenTask.Domain/"]
16+
COPY ["src/OpenTask.Utility/OpenTask.Utility.csproj", "OpenTask.Utility/"]
17+
COPY ["src/OpenTask.Persistence/OpenTask.Persistence.csproj", "OpenTask.Persistence/"]
18+
RUN dotnet restore "OpenTask.WebApi/OpenTask.WebApi.csproj"
19+
COPY src .
20+
WORKDIR "/src/OpenTask.WebApi"
21+
RUN dotnet build "OpenTask.WebApi.csproj" -c $BUILD_CONFIGURATION -o /app/build
22+
23+
FROM build AS publish
24+
ARG BUILD_CONFIGURATION=Release
25+
RUN dotnet publish "OpenTask.WebApi.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
26+
27+
# ui
28+
FROM registry.cn-hangzhou.aliyuncs.com/hgui/node:20.12.0 AS ui
29+
WORKDIR /app
30+
COPY ["ui/vite-opentask", "./"]
31+
RUN rm -rf package-lock.json node_modules
32+
#RUN npm config set registry https://registry.npmmirror.com
33+
RUN npm i
34+
RUN npm run build
35+
36+
FROM base AS final
37+
WORKDIR /app
38+
39+
ENV TZ=Asia/Shanghai
40+
41+
RUN chmod 777 /app
42+
COPY --from=publish /app/publish .
43+
COPY --from=ui /app/dist ./wwwroot
44+
ENTRYPOINT ["dotnet", "OpenTask.WebApi.dll"]

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Gui.H
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# OpenTask
2+
3+
[![Build status](https://github.com/SpringHgui/OpenTask/workflows/build/badge.svg)](https://github.com/SpringHgui/OpenTask/actions)
4+
5+
去中心设计的分布式任务调度平台
6+
7+
# 快速开始
8+
## 1. 调度中心部署
9+
1. docker-compose
10+
```
11+
# 克隆本项目
12+
cd deploy/docker-compose
13+
docker-compose up -d
14+
```
15+
2. k8s
16+
17+
3. docker
18+
19+
4. 传统手动部署
20+
21+
## 2. 执行节点开发
22+
参考 [`src/OpenTask.Client`
23+
](https://github.com/SpringHgui/OpenTask/tree/f37696f51cf642a8dbf043fabb90568bdbf295e7/src/OpenTask.Client)
24+
## 高级配置
25+
1. 使用已有的数据库
26+
27+
28+
# 贡献指南
29+
1. 开发数据库搭建
30+
```
31+
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
32+
```
33+
2. 安装vs2022
34+
打开`OpenTask.sln`解决方案进行开发
35+
36+
# 开源协议
37+
MIT

SECURITY.md

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
Use this section to tell people about which versions of your project are
6+
currently being supported with security updates.
7+
8+
| Version | Supported |
9+
| ------- | ------------------ |
10+
| 5.1.x | :white_check_mark: |
11+
| 5.0.x | :x: |
12+
| 4.0.x | :white_check_mark: |
13+
| < 4.0 | :x: |
14+
15+
## Reporting a Vulnerability
16+
17+
Use this section to tell people how to report a vulnerability.
18+
19+
Tell them where to go, how often they can expect to get an update on a
20+
reported vulnerability, what to expect if the vulnerability is accepted or
21+
declined, etc.
+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
version: '3.9'
2+
services:
3+
mysql:
4+
restart: always
5+
image: registry.cn-hangzhou.aliyuncs.com/hgui/mysql:8.4.1
6+
container_name: mysql
7+
volumes:
8+
- /apps/mysql/mysql:/var/lib/mysql
9+
- /apps/mysql/conf.d:/etc/mysql/conf.d
10+
environment:
11+
- "MYSQL_ROOT_PASSWORD=OPEN_TASK_!@#"
12+
- "MYSQL_DATABASE=open_task"
13+
ports:
14+
- 3306:3306
15+
16+
api:
17+
restart: always
18+
image: registry.cn-hangzhou.aliyuncs.com/hgui/opentask:latest
19+
container_name: opentask
20+
depends_on:
21+
- mysql
22+
volumes:
23+
- /apps/opentask/logs:/app/Logs
24+
environment:
25+
- "ConnectionStrings__Core=server=mysql;Port=3306;user id=root;database=open_task;pooling=true;password=OPEN_TASK_!@#"
26+
- "TZ=Asia/Shanghai"
27+
ports:
28+
- 8080:8080
29+
links:
30+
- mysql

publish.sh

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
if command -v podman &> /dev/null; then
3+
alias docker=podman
4+
else
5+
echo "podman not installed"
6+
fi
7+
8+
# 读取文件内容,并使用grep和awk提取Version的值
9+
version=$(grep "<Version>" src/Directory.Build.props | awk -F'[<>]' '{print $3}')
10+
appName=registry.cn-hangzhou.aliyuncs.com/hgui/opentask:$version
11+
# 输出Version的值
12+
echo "Version: $version"
13+
14+
docker build . -t $appName
15+
if [ $? -ne 0 ]; then
16+
echo "docker image build fail 😭😭😭"
17+
else
18+
echo "docker image build success 🎉🎉🎉"
19+
fi
20+
21+
docker push $appName
22+
read
23+
exit 1

0 commit comments

Comments
 (0)