Skip to content

Commit 00bd8be

Browse files
authored
Merge pull request #32 from r4ulcl/dev
Dev to main v0.2
2 parents d93108c + 58cc8cb commit 00bd8be

69 files changed

Lines changed: 3972 additions & 2622 deletions

Some content is hidden

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

‎.dockerignore‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# .dockerignore: exclude files/directories from build context
2+
.git
3+
.gitignore
4+
.dockerignore
5+
Dockerfile
6+
vendor/
7+
*.md
8+
*.exe
9+
*.exe~
10+
*.dll
11+
*.so
12+
*.dylib
13+
*.swp
14+
*~
15+
.DS_Store
16+
db/
17+
*.conf
18+
*.md

‎.env‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Manager
2+
MANAGER_IMAGE=ntask_manager:latest
3+
MANAGER_HTTP_PORT=8080
4+
MANAGER_HTTPS_PORT=8443
5+
6+
# Worker
7+
WORKER_IMAGE=ntask_worker:latest
8+
WORKER_REPLICAS=2
9+
WORKER_REPLICAS_DEV=2
10+
WORKER_REPLICAS_TEST=100
11+
12+
# Database
13+
MYSQL_VERSION=8.0
14+
DB_PORT=3306
15+
MYSQL_ROOT_PASSWORD=your_password_root
16+
MYSQL_USER=your_username
17+
MYSQL_PASSWORD=your_password
18+
MYSQL_DATABASE=manager
19+
MYSQL_ROOT_HOST=0.0.0.0
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Build and Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
go-version: [1.21.6] # Add more versions if needed
14+
os: [windows, linux, darwin]
15+
arch: [amd64, arm64, 386, arm]
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v2
20+
21+
- name: Set up Go
22+
uses: actions/setup-go@v2
23+
with:
24+
go-version: ${{ matrix.go-version }}
25+
# Set other Go-related options as needed
26+
27+
- name: Build binary
28+
run: |
29+
if [ "${{ runner.os }}" = "Windows" ]; then
30+
go build -o ${GITHUB_REPOSITORY}-${{ matrix.os }}-${{ matrix.arch }}.exe
31+
else
32+
go build -o ${GITHUB_REPOSITORY}-${{ matrix.os }}-${{ matrix.arch }}
33+
fi
34+
35+
release:
36+
needs: build
37+
runs-on: ubuntu-latest
38+
39+
steps:
40+
- name: Create Release Draft
41+
if: startsWith(github.ref, 'refs/tags/v')
42+
id: create_release
43+
uses: actions/create-release@v1
44+
with:
45+
tag_name: ${{ github.ref }}
46+
release_name: Release ${{ github.ref }}
47+
draft: true
48+
body: |
49+
Release notes for version ${{ github.ref }}
50+
51+
- name: Upload Release Assets
52+
if: startsWith(github.ref, 'refs/tags/v')
53+
id: upload-release-assets
54+
uses: actions/upload-release-asset@v1
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
with:
58+
upload_url: ${{ steps.create_release.outputs.upload_url }}
59+
asset_path: |
60+
${GITHUB_REPOSITORY}-windows-amd64.exe
61+
${GITHUB_REPOSITORY}-windows-386.exe
62+
${GITHUB_REPOSITORY}-linux-amd64
63+
${GITHUB_REPOSITORY}-linux-arm64
64+
${GITHUB_REPOSITORY}-linux-386
65+
${GITHUB_REPOSITORY}-darwin-amd64
66+
${GITHUB_REPOSITORY}-darwin-arm64
67+
asset_name: ${GITHUB_REPOSITORY}-${{ matrix.arch }}

‎.github/workflows/build-manager-dev.yml‎

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,46 +10,47 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Set up QEMU
13-
uses: docker/setup-qemu-action@v1
13+
uses: docker/setup-qemu-action@v3
1414

1515
- name: Set up Docker Buildx
16-
uses: docker/setup-buildx-action@v1
16+
uses: docker/setup-buildx-action@v3
1717

1818
- name: Checkout
1919
uses: actions/checkout@v3
2020

21-
# manager docker
21+
- name: Set lowercase repository name
22+
id: set_lowercase_repo
23+
run: |
24+
LOWERCASE_REPO=$(echo "${GITHUB_REPOSITORY}" | tr '[:upper:]' '[:lower:]')
25+
echo "::set-output name=lowercase_repo::${LOWERCASE_REPO}"
26+
27+
# Docker
2228
- name: Extract metadata (tags, labels) for Docker
2329
id: meta
2430
uses: docker/metadata-action@v5
2531
with:
26-
images: ${{ github.actor }}/ntask-manager
32+
images: ${{ steps.set_lowercase_repo.outputs.lowercase_repo }}-manager
2733

2834
- name: Login to DockerHub
29-
uses: docker/login-action@v1
35+
uses: docker/login-action@v3
3036
with:
3137
username: ${{ github.actor }}
3238
password: ${{ secrets.DOCKERHUB_TOKEN }}
33-
- name: Build and push docker
34-
id: docker_build
35-
uses: docker/build-push-action@v2
36-
with:
37-
context: .
38-
file: ./manager/Dockerfile
39-
platforms: linux/amd64
40-
push: true
41-
tags: ${{ secrets.DOCKERHUB_USERNAME }}/ntask-manager:dev
4239

4340
- name: Login to GitHub Container Registry
4441
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
4542

46-
- name: Build and push docker
47-
id: docker_build_ghcr
43+
# Push
44+
- name: Build and push
45+
id: docker_build
4846
uses: docker/build-push-action@v5
4947
with:
5048
context: .
5149
file: ./manager/Dockerfile
52-
platforms: linux/amd64
50+
platforms: linux/amd64,linux/arm64
5351
push: true
54-
tags: ghcr.io/${{ github.actor }}/ntask-manager:dev
52+
tags: |
53+
${{ steps.set_lowercase_repo.outputs.lowercase_repo }}-manager:dev
54+
ghcr.io/${{ steps.set_lowercase_repo.outputs.lowercase_repo }}-manager:dev
55+
labels: ${{ steps.meta.outputs.labels }}
5556

‎.github/workflows/build-manager.yml‎

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ name: Docker Build and Publish Manager
22

33
on:
44
push:
5-
branches:
6-
- 'main'
75
tags:
86
- 'v*'
97

@@ -12,47 +10,47 @@ jobs:
1210
runs-on: ubuntu-latest
1311
steps:
1412
- name: Set up QEMU
15-
uses: docker/setup-qemu-action@v1
13+
uses: docker/setup-qemu-action@v3
1614

1715
- name: Set up Docker Buildx
18-
uses: docker/setup-buildx-action@v1
16+
uses: docker/setup-buildx-action@v3
1917

2018
- name: Checkout
2119
uses: actions/checkout@v3
2220

21+
- name: Set lowercase repository name
22+
id: set_lowercase_repo
23+
run: |
24+
LOWERCASE_REPO=$(echo "${GITHUB_REPOSITORY}" | tr '[:upper:]' '[:lower:]')
25+
echo "::set-output name=lowercase_repo::${LOWERCASE_REPO}"
26+
2327
# manager docker
2428
- name: Extract metadata (tags, labels) for Docker
2529
id: meta
2630
uses: docker/metadata-action@v5
2731
with:
28-
images: ${{ github.actor }}/ntask-manager
32+
images: ${{ steps.set_lowercase_repo.outputs.lowercase_repo }}-manager
2933

3034
- name: Login to DockerHub
31-
uses: docker/login-action@v1
35+
uses: docker/login-action@v3
3236
with:
3337
username: ${{ github.actor }}
3438
password: ${{ secrets.DOCKERHUB_TOKEN }}
35-
- name: Build and push docker
36-
id: docker_build
37-
uses: docker/build-push-action@v2
38-
with:
39-
context: .
40-
file: ./manager/Dockerfile
41-
platforms: linux/amd64
42-
push: true
43-
tags: ${{ steps.meta.outputs.tags }}
44-
labels: ${{ steps.meta.outputs.labels }}
4539

4640
- name: Login to GitHub Container Registry
4741
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
4842

49-
- name: Build and push docker
50-
id: docker_build_ghcr
43+
# Push
44+
- name: Build and push
45+
id: docker_build
5146
uses: docker/build-push-action@v5
5247
with:
5348
context: .
5449
file: ./manager/Dockerfile
55-
platforms: linux/amd64
50+
platforms: linux/amd64,linux/arm64
5651
push: true
57-
tags: ghcr.io/${{ github.actor }}/ntask-manager:latest, ghcr.io/${{ steps.meta.outputs.tags }}
58-
labels: ${{ steps.meta.outputs.labels }}
52+
tags: |
53+
${{ steps.meta.outputs.tags }}
54+
ghcr.io/${{ steps.set_lowercase_repo.outputs.lowercase_repo }}-manager:latest
55+
ghcr.io/${{ steps.meta.outputs.tags }}
56+
labels: ${{ steps.meta.outputs.labels }}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Docker Build and Publish Worker DEV
2+
3+
on:
4+
push:
5+
branches:
6+
- 'dev'
7+
8+
jobs:
9+
docker:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Set up QEMU
13+
uses: docker/setup-qemu-action@v3
14+
15+
- name: Set up Docker Buildx
16+
uses: docker/setup-buildx-action@v3
17+
18+
- name: Checkout
19+
uses: actions/checkout@v3
20+
21+
- name: Set lowercase repository name
22+
id: set_lowercase_repo
23+
run: |
24+
LOWERCASE_REPO=$(echo "${GITHUB_REPOSITORY}" | tr '[:upper:]' '[:lower:]')
25+
echo "::set-output name=lowercase_repo::${LOWERCASE_REPO}"
26+
27+
# Docker
28+
- name: Extract metadata (tags, labels) for Docker
29+
id: meta
30+
uses: docker/metadata-action@v5
31+
with:
32+
images: ${{ steps.set_lowercase_repo.outputs.lowercase_repo }}-worker
33+
34+
- name: Login to DockerHub
35+
uses: docker/login-action@v3
36+
with:
37+
username: ${{ github.actor }}
38+
password: ${{ secrets.DOCKERHUB_TOKEN }}
39+
40+
- name: Login to GitHub Container Registry
41+
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
42+
43+
# Push
44+
- name: Build and push
45+
id: docker_build
46+
uses: docker/build-push-action@v5
47+
with:
48+
context: .
49+
file: ./worker/Dockerfile
50+
platforms: linux/amd64,linux/arm64
51+
push: true
52+
tags: |
53+
${{ steps.set_lowercase_repo.outputs.lowercase_repo }}-worker:dev
54+
ghcr.io/${{ steps.set_lowercase_repo.outputs.lowercase_repo }}-worker:dev
55+
labels: ${{ steps.meta.outputs.labels }}
56+

‎.github/workflows/build-worker.yml‎

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ name: Docker Build and Publish Worker
22

33
on:
44
push:
5-
branches:
6-
- 'main'
75
tags:
86
- 'v*'
97

@@ -12,47 +10,47 @@ jobs:
1210
runs-on: ubuntu-latest
1311
steps:
1412
- name: Set up QEMU
15-
uses: docker/setup-qemu-action@v1
13+
uses: docker/setup-qemu-action@v3
1614

1715
- name: Set up Docker Buildx
18-
uses: docker/setup-buildx-action@v1
16+
uses: docker/setup-buildx-action@v3
1917

2018
- name: Checkout
2119
uses: actions/checkout@v3
2220

21+
- name: Set lowercase repository name
22+
id: set_lowercase_repo
23+
run: |
24+
LOWERCASE_REPO=$(echo "${GITHUB_REPOSITORY}" | tr '[:upper:]' '[:lower:]')
25+
echo "::set-output name=lowercase_repo::${LOWERCASE_REPO}"
26+
2327
# worker docker
2428
- name: Extract metadata (tags, labels) for Docker
2529
id: meta
2630
uses: docker/metadata-action@v5
2731
with:
28-
images: ${{ github.actor }}/ntask-worker
32+
images: ${{ steps.set_lowercase_repo.outputs.lowercase_repo }}-worker
2933

3034
- name: Login to DockerHub
31-
uses: docker/login-action@v1
35+
uses: docker/login-action@v3
3236
with:
3337
username: ${{ github.actor }}
3438
password: ${{ secrets.DOCKERHUB_TOKEN }}
35-
- name: Build and push docker
36-
id: docker_build
37-
uses: docker/build-push-action@v2
38-
with:
39-
context: .
40-
file: ./worker/Dockerfile
41-
platforms: linux/amd64
42-
push: true
43-
tags: ${{ steps.meta.outputs.tags }}
44-
labels: ${{ steps.meta.outputs.labels }}
4539

4640
- name: Login to GitHub Container Registry
4741
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
4842

49-
- name: Build and push docker
50-
id: docker_build_ghcr
43+
# Push
44+
- name: Build and push
45+
id: docker_build
5146
uses: docker/build-push-action@v5
5247
with:
5348
context: .
5449
file: ./worker/Dockerfile
55-
platforms: linux/amd64
50+
platforms: linux/amd64,linux/arm64
5651
push: true
57-
tags: ghcr.io/${{ github.actor }}/ntask-worker:latest, ghcr.io/${{ steps.meta.outputs.tags }}
58-
labels: ${{ steps.meta.outputs.labels }}
52+
tags: |
53+
${{ steps.meta.outputs.tags }}
54+
ghcr.io/${{ steps.set_lowercase_repo.outputs.lowercase_repo }}-worker:latest
55+
ghcr.io/${{ steps.meta.outputs.tags }}
56+
labels: ${{ steps.meta.outputs.labels }}

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,5 @@
2121
go.work
2222
db/*
2323
output/*
24+
nTask
25+
.vscode/*

0 commit comments

Comments
 (0)