From 723fd11324b171a166b0a95dcc89c13fd1b62be5 Mon Sep 17 00:00:00 2001 From: NDuncan Date: Wed, 9 Oct 2024 11:29:20 +0200 Subject: [PATCH 1/7] Update README.md README update: adding precision about the auto-scaling mode and updating feedback request demand via Discord. --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5274fb0..b986abd 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,11 @@ > [!CAUTION] -> ## This project is owned by the Upsun Advocacy team. It is in early stage of development [experimental] and only intended to be used with caution by Upsun customers/community.

This project is not supported by Upsun and does not qualify for Support plans. Use this repository at your own risks, it is provided without guarantee or warranty! -> Don’t hesitate to join our [Discord](https://discord.com/invite/platformsh) to share your thoughts about this project. - +> ## This project is owned by the Upsun Advocacy team. It is in early stage of development [experimental] and only intended to be used with caution by Upsun customers/community.

This project is not supported by Upsun and does not qualify for Support plans. Use this repository at your own risks, it is provided without guarantee or warranty! +> **PS: if you have downloaded that binary and appreciated it, I kindly ask you to let us know on [Discord](https://discord.com/invite/platformsh) (you can then later discuss with one of our Product manager to share your feedback on it).** ScalSun ========= -This tool provide simple auto-scaling on upsun project. +This tool provide simple auto horizontal scaling on upsun project for your application containers. ## Usage/install From 482c33697ba448191f2bec0862cc03f202958c34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=B3bert=20Hubin=C3=A1k?= Date: Fri, 10 Jan 2025 09:52:33 +0100 Subject: [PATCH 2/7] Fixed typo in README.md Small thing, but it was burning my eyes. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b986abd..94a3c56 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Add to build hook : Add cron task every minute : ``` crons: - autoscaller: + autoscaler: spec: "*/1 * * * *" commands: start: | From 8067d3e418b7ae3880689a99c1687a403c683b97 Mon Sep 17 00:00:00 2001 From: Mickael Gaillard Date: Fri, 10 Jan 2025 10:18:16 +0100 Subject: [PATCH 3/7] Move caution section after summary --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b986abd..4133514 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,13 @@ -> [!CAUTION] -> ## This project is owned by the Upsun Advocacy team. It is in early stage of development [experimental] and only intended to be used with caution by Upsun customers/community.

This project is not supported by Upsun and does not qualify for Support plans. Use this repository at your own risks, it is provided without guarantee or warranty! -> **PS: if you have downloaded that binary and appreciated it, I kindly ask you to let us know on [Discord](https://discord.com/invite/platformsh) (you can then later discuss with one of our Product manager to share your feedback on it).** - ScalSun ========= This tool provide simple auto horizontal scaling on upsun project for your application containers. +> [!CAUTION] +> **This project is owned by the Upsun Advocacy team. It is in early stage of development [experimental] and only intended to be used with caution by Upsun customers/community.

This project is not supported by Upsun and does not qualify for Support plans. Use this repository at your own risks, it is provided without guarantee or warranty!** +> +> PS: if you have downloaded that binary and appreciated it, I kindly ask you to let us know on [Discord](https://discord.com/invite/platformsh) (you can then later discuss with one of our Product manager to share your feedback on it). + ## Usage/install Deploy the **scalsun** and **Upsun CLI** binary into your project From b0d08090c1f8ebfb385fa1bb59b0a9697cb894df Mon Sep 17 00:00:00 2001 From: Mickael Gaillard Date: Mon, 10 Feb 2025 12:44:08 +0100 Subject: [PATCH 4/7] Update libraries --- go.mod | 4 ++-- go.sum | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index b92146d..9e05313 100644 --- a/go.mod +++ b/go.mod @@ -1,10 +1,10 @@ module github.com/upsun/scalsun -go 1.22.6 +go 1.23.5 require ( github.com/spf13/pflag v1.0.5 - github.com/upsun/lib-sun v0.3.12 + github.com/upsun/lib-sun v0.3.14 ) require ( diff --git a/go.sum b/go.sum index fe673b2..7b0f1c8 100644 --- a/go.sum +++ b/go.sum @@ -16,8 +16,8 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/upsun/lib-sun v0.3.12 h1:+npDh43Uy2BE450fcUjfBqkzvCeUimLaCpFXi+oKUh0= -github.com/upsun/lib-sun v0.3.12/go.mod h1:8AtRNv0L+c9qCS/maO/OVFIn2VDi89LTkWwpB7YKTDE= +github.com/upsun/lib-sun v0.3.14 h1:qD36j2bPMbGMmDH7Gu8lI8KZtTt+HnmeO/O/kRZ08ec= +github.com/upsun/lib-sun v0.3.14/go.mod h1:8AtRNv0L+c9qCS/maO/OVFIn2VDi89LTkWwpB7YKTDE= golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= From 3ddd400f936e1fd94d5745e2c601653d8f5f8365 Mon Sep 17 00:00:00 2001 From: Mickael Gaillard Date: Tue, 8 Apr 2025 15:47:43 +0200 Subject: [PATCH 5/7] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a67261a..cda697a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ScalSun ========= -This tool provide simple auto horizontal scaling on upsun project for your application containers. +This tool provide simple auto horizontal scaling on Upsun project for your application containers. > [!CAUTION] > **This project is owned by the Upsun Advocacy team. It is in early stage of development [experimental] and only intended to be used with caution by Upsun customers/community.

This project is not supported by Upsun and does not qualify for Support plans. Use this repository at your own risks, it is provided without guarantee or warranty!** From 1f7c7cc77c58c64bd74b6daef30f459f7350703b Mon Sep 17 00:00:00 2001 From: Mickael Gaillard Date: Wed, 23 Apr 2025 17:26:37 +0200 Subject: [PATCH 6/7] Remove private repository (SEC-589) --- .github/workflows/build.yaml | 15 --------------- .github/workflows/release.yaml | 7 ------- 2 files changed, 22 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index e47ac82..872f786 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -11,9 +11,6 @@ on: permissions: contents: read -env: - GOPRIVATE: github.com/upsun/lib-sun - jobs: lint: @@ -24,10 +21,6 @@ jobs: with: go-version: '1.22' check-latest: true - - name: Run config private repo - env: - TOKEN: ${{ secrets.MICK_GITHUB_TOKEN }} - run: git config --global url."https://user:${TOKEN}@github.com".insteadOf https://github.com - name: Run Go Format run: gofmt -s -w . && git diff --exit-code - name: Run Go Tidy @@ -47,10 +40,6 @@ jobs: steps: - uses: actions/checkout@v4 - uses: actions/setup-go@v4 - - name: Run config private repo - env: - TOKEN: ${{ secrets.MICK_GITHUB_TOKEN }} - run: git config --global url."https://user:${TOKEN}@github.com".insteadOf https://github.com - name: Run tests run: go test -v -count=1 -race -shuffle=on -coverprofile=coverage.txt ./... - name: Go Benchmark @@ -75,9 +64,5 @@ jobs: - uses: actions/setup-go@v4 with: go-version: '1.22' - - name: Run config private repo - env: - TOKEN: ${{ secrets.MICK_GITHUB_TOKEN }} - run: git config --global url."https://user:${TOKEN}@github.com".insteadOf https://github.com - name: Build run: go build -o /dev/null -v ./... diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index f2162f4..2b05e82 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -8,7 +8,6 @@ permissions: contents: write packages: write - jobs: release-linux-amd64: name: release linux/amd64 @@ -17,12 +16,6 @@ jobs: - uses: actions/checkout@v4 - uses: wangyoucao577/go-release-action@v1 with: - pre_command: | - echo "machine github.com login ${{ github.actor }} password ${{ secrets.MICK_GITHUB_TOKEN }}" > ~/.netrc - chmod 600 ~/.netrc - git config --global --add url."https://github.com/".insteadOf "ssh://git@github.com/" - git config --global --add url."https://github.com/".insteadOf "git@github.com" - go env -w GOPRIVATE=github.com/upsun/* github_token: ${{ secrets.GITHUB_TOKEN }} goos: linux goarch: amd64 From bc005d537d0149ef424cca5934e3da6020174bb8 Mon Sep 17 00:00:00 2001 From: Mickael Gaillard Date: Mon, 30 Jun 2025 16:08:28 +0200 Subject: [PATCH 7/7] Add support of name app --- internal/logic/scaling_resource.go | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/internal/logic/scaling_resource.go b/internal/logic/scaling_resource.go index c6fdbaf..0a0623b 100644 --- a/internal/logic/scaling_resource.go +++ b/internal/logic/scaling_resource.go @@ -84,24 +84,26 @@ func ScalingInstance(projectContext entity.ProjectGlobal) { // Parse output apps = strings.Split(output, "\n") for _, app_str := range apps[:len(apps)-1] { - app := strings.Split(app_str, ",") + app_raw := strings.Split(app_str, ",") // Normalize - name := app[0] - instance, err := strconv.Atoi(app[1]) + name := app_raw[0] + instance, err := strconv.Atoi(app_raw[1]) if err != nil { break } // Get or create app/service usage - usage, found := usages[name] - if !found { - usage = UsageApp{Name: name} - } + if app.ArgsS.Name == "" || app.ArgsS.Name == name { + usage, found := usages[name] + if !found { + usage = UsageApp{Name: name} + } - // Assign - usage.InstanceOld = instance - usages[name] = usage + // Assign + usage.InstanceOld = instance + usages[name] = usage + } } if !app.ArgsS.IncludeServices {