From 131261fe1dae29d05620f541497001857500aa8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hl=C3=B6=C3=B0ver=20Sigur=C3=B0sson?= Date: Fri, 19 Jul 2024 17:15:28 +0200 Subject: [PATCH] feat(s3): allocate larger buffer-chunk size --- .github/workflows/release.docker.yml | 48 +++++++---------- .github/workflows/release.linux.yml | 81 ---------------------------- s3/replica_client.go | 1 + 3 files changed, 20 insertions(+), 110 deletions(-) delete mode 100644 .github/workflows/release.linux.yml diff --git a/.github/workflows/release.docker.yml b/.github/workflows/release.docker.yml index dcc92a39..3a19d7d8 100644 --- a/.github/workflows/release.docker.yml +++ b/.github/workflows/release.docker.yml @@ -1,51 +1,41 @@ on: - release: - types: - - published -# pull_request: -# types: -# - opened -# - synchronize -# - reopened -# branches-ignore: -# - "dependabot/**" + workflow_dispatch: name: Release (Docker) + +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + jobs: docker: runs-on: ubuntu-latest env: PLATFORMS: "linux/amd64,linux/arm64,linux/arm/v7" - VERSION: "${{ github.event_name == 'release' && github.event.release.name || github.sha }}" + VERSION: "${{ github.sha }}" steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: docker/setup-qemu-action@v1 - uses: docker/setup-buildx-action@v1 - - uses: docker/login-action@v1 + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 with: - username: benbjohnson - password: ${{ secrets.DOCKERHUB_TOKEN }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - - id: meta - uses: docker/metadata-action@v3 + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 with: - images: litestream/litestream - tags: | - type=ref,event=branch - type=ref,event=pr - type=sha - type=sha,format=long - type=semver,pattern={{version}} - type=semver,pattern={{major}}.{{minor}} + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - uses: docker/build-push-action@v2 + - name: Build and push Docker image + uses: docker/build-push-action@v5 with: context: . push: true - platforms: ${{ env.PLATFORMS }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - build-args: | - LITESTREAM_VERSION=${{ env.VERSION }} diff --git a/.github/workflows/release.linux.yml b/.github/workflows/release.linux.yml deleted file mode 100644 index 3c4ec9ad..00000000 --- a/.github/workflows/release.linux.yml +++ /dev/null @@ -1,81 +0,0 @@ -on: - release: - types: - - created - -name: release (linux) -jobs: - build: - runs-on: ubuntu-latest - strategy: - matrix: - include: - - arch: amd64 - cc: gcc - - arch: arm64 - cc: aarch64-linux-gnu-gcc - - arch: arm - arm: 6 - cc: arm-linux-gnueabi-gcc - - arch: arm - arm: 7 - cc: arm-linux-gnueabihf-gcc - - env: - GOOS: linux - GOARCH: ${{ matrix.arch }} - GOARM: ${{ matrix.arm }} - CC: ${{ matrix.cc }} - - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-go@v2 - with: - go-version: '1.21' - - - id: release - uses: bruceadams/get-release@v1.2.2 - env: - GITHUB_TOKEN: ${{ github.token }} - - - name: Install cross-compilers - run: | - sudo apt-get update - sudo apt-get install -y gcc-aarch64-linux-gnu gcc-arm-linux-gnueabihf gcc-arm-linux-gnueabi - - - name: Install nfpm - run: | - wget https://github.com/goreleaser/nfpm/releases/download/v2.2.3/nfpm_2.2.3_Linux_x86_64.tar.gz - tar zxvf nfpm_2.2.3_Linux_x86_64.tar.gz - - - name: Build litestream - run: | - rm -rf dist - mkdir -p dist - cp etc/litestream.yml etc/litestream.service dist - cat etc/nfpm.yml | LITESTREAM_VERSION=${{ steps.release.outputs.tag_name }} envsubst > dist/nfpm.yml - CGO_ENABLED=1 go build -ldflags "-s -w -extldflags "-static" -X 'main.Version=${{ steps.release.outputs.tag_name }}'" -tags osusergo,netgo,sqlite_omit_load_extension -o dist/litestream ./cmd/litestream - - cd dist - tar -czvf litestream-${{ steps.release.outputs.tag_name }}-${{ env.GOOS }}-${{ env.GOARCH }}${{ env.GOARM }}.tar.gz litestream - ../nfpm pkg --config nfpm.yml --packager deb --target litestream-${{ steps.release.outputs.tag_name }}-${{ env.GOOS }}-${{ env.GOARCH }}${{ env.GOARM }}.deb - - - name: Upload release tarball - uses: actions/upload-release-asset@v1.0.2 - env: - GITHUB_TOKEN: ${{ github.token }} - with: - upload_url: ${{ steps.release.outputs.upload_url }} - asset_path: ./dist/litestream-${{ steps.release.outputs.tag_name }}-${{ env.GOOS }}-${{ env.GOARCH }}${{ env.GOARM }}.tar.gz - asset_name: litestream-${{ steps.release.outputs.tag_name }}-${{ env.GOOS }}-${{ env.GOARCH }}${{ env.GOARM }}.tar.gz - asset_content_type: application/gzip - - - name: Upload debian package - uses: actions/upload-release-asset@v1.0.2 - env: - GITHUB_TOKEN: ${{ github.token }} - with: - upload_url: ${{ steps.release.outputs.upload_url }} - asset_path: ./dist/litestream-${{ steps.release.outputs.tag_name }}-${{ env.GOOS }}-${{ env.GOARCH }}${{ env.GOARM }}.deb - asset_name: litestream-${{ steps.release.outputs.tag_name }}-${{ env.GOOS }}-${{ env.GOARCH }}${{ env.GOARM }}.deb - asset_content_type: application/octet-stream diff --git a/s3/replica_client.go b/s3/replica_client.go index 7b513750..e1e7900c 100644 --- a/s3/replica_client.go +++ b/s3/replica_client.go @@ -99,6 +99,7 @@ func (c *ReplicaClient) Init(ctx context.Context) (err error) { } c.s3 = s3.New(sess) c.uploader = s3manager.NewUploader(sess) + c.uploader.PartSize = 1024 * 1024 * 50 return nil }