From 865fc082af1a9de3412499f10968717ea97750ae Mon Sep 17 00:00:00 2001 From: guergabo <65991626+guergabo@users.noreply.github.com> Date: Tue, 30 Apr 2024 11:43:18 -0400 Subject: [PATCH] release(changes): include new release pipeline and bug fix (#305) * Update release_verify_artifacts.yaml * Release 0.5 (#287) * Update release_verify_artifacts.yaml (#286) * Update release_verify_artifacts.yaml * Update README.md * build(deps): bump actions/checkout from 2 to 4 (#289) Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v2...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build(deps): bump google.golang.org/grpc from 1.62.1 to 1.63.2 (#290) Bumps [google.golang.org/grpc](https://github.com/grpc/grpc-go) from 1.62.1 to 1.63.2. - [Release notes](https://github.com/grpc/grpc-go/releases) - [Commits](https://github.com/grpc/grpc-go/compare/v1.62.1...v1.63.2) --- updated-dependencies: - dependency-name: google.golang.org/grpc dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Add Nix flake for Resonate and use Nix extensively in CI (#291) * Add Nix flake for Resonate * Add an envrc file for direnv * Add missing version field to derivation * Add a Docker image output * Add CA certificates to Docker image * Add more comments to Docker image derivation * Add Nix usage docs to CONTRIBUTING.md * Add initial CI configuration * Infer version from Git rev * Add testing and coverage to Nix CI workflow * Add harness to flake and complete nix-cicd workflow * Nixify dst workflow * Fix name of harness binary * Add Nix to scan workflow * Restore test harness binary immediately prior to linearizability check * Nixify release artifacts workflow * Upload checksum for tarballs * Overwrite now-Nixified workflows * Restore explicit permissions to cicd workflow * Remove nix prefix from job names * Rework testing job by removing build job * Streamline check job * Streamline variable names in release workflow * Simplify flake output references in Nix commands * Provide separate step for building server and harness * Ignore Nix in codecov.yml * Add nix flake check to CI * Install Nix prior to flake check * Add gomod2nix support for package build * Add CI check to ensure gomod2nix.toml is up to date * Add gomod2nix docs and mockgen dependency to dev shell * Add docs on direnv * Add additional note on gomod2nix in CI * Opt for more idiomatic diff checking for gomod2nix.toml * Add gomod2nix.toml to codecov.yml ignore (#292) * Remove unnecessary chmod operations in CI (#293) * Standardize all Actions runners to ubuntu-22.04 (#294) * Build static binary on Linux with Nix (#295) * Use go build for dst workflow * Change step name * Add ldflags * Make resonate package static on Linux * Build with glibc on Linux * Update README.md * Update README.md * Add Actions workflow to update gomod2nix.toml (#297) * Add Actions workflow to update gomod2nix.toml * Update name of workflow * Update connections.go (#300) * Update connections.go * Add timeout to http client --------- Co-authored-by: Gabriel Guerra * fix(release): workflow had small bugs here and there (#304) * Update release_publish_github_artifacts.yaml * Update release_publish_github_artifacts.yaml * Update release_publish_github_artifacts.yaml * Update release_publish_github_artifacts.yaml * Update release_publish_github_artifacts.yaml --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Luc Perkins Co-authored-by: Gabriel Guerra --- .envrc | 1 + .github/workflows/cicd.yaml | 137 ++++++------ .github/workflows/dependencies.yml | 46 ++++ .github/workflows/dst.yaml | 40 ++-- .../release_publish_github_artifacts.yaml | 108 ++++------ .../workflows/release_verify_artifacts.yaml | 10 +- .gitignore | 3 + CONTRIBUTING.md | 99 +++++++++ README.md | 12 +- codecov.yml | 3 + flake.lock | 95 +++++++++ flake.nix | 158 ++++++++++++++ go.mod | 5 +- go.sum | 15 +- gomod2nix.toml | 198 ++++++++++++++++++ .../aio/queuing/connections/connections.go | 5 +- 16 files changed, 749 insertions(+), 186 deletions(-) create mode 100644 .envrc create mode 100644 .github/workflows/dependencies.yml create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 gomod2nix.toml diff --git a/.envrc b/.envrc new file mode 100644 index 00000000..3550a30f --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.github/workflows/cicd.yaml b/.github/workflows/cicd.yaml index c48d0f05..82de5f5e 100644 --- a/.github/workflows/cicd.yaml +++ b/.github/workflows/cicd.yaml @@ -12,50 +12,49 @@ permissions: contents: read jobs: - build: - runs-on: ubuntu-latest - - env: - TEST_AIO_SUBSYSTEMS_STORE_CONFIG_POSTGRES_HOST: "localhost" - TEST_AIO_SUBSYSTEMS_STORE_CONFIG_POSTGRES_PORT: "5432" - TEST_AIO_SUBSYSTEMS_STORE_CONFIG_POSTGRES_USERNAME: "username" - TEST_AIO_SUBSYSTEMS_STORE_CONFIG_POSTGRES_PASSWORD: "password" - TEST_AIO_SUBSYSTEMS_STORE_CONFIG_POSTGRES_DATABASE: "resonate_test" - - services: - postgres: - image: postgres:15 - env: - POSTGRES_USER: ${{ env.TEST_AIO_SUBSYSTEMS_STORE_CONFIG_POSTGRES_USERNAME }} - POSTGRES_PASSWORD: ${{ env.TEST_AIO_SUBSYSTEMS_STORE_CONFIG_POSTGRES_PASSWORD }} - POSTGRES_DB: ${{ env.TEST_AIO_SUBSYSTEMS_STORE_CONFIG_POSTGRES_DATABASE }} - options: >- - --health-cmd pg_isready - --health-interval 10s - --health-timeout 5s - --health-retries 5 - ports: - - 5432:5432 - + checks: + runs-on: ubuntu-22.04 steps: - - name: Checkout repository + - name: Check out repository uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version-file: go.mod - cache: false + - name: Check Nixpkgs input + uses: DeterminateSystems/flake-checker-action@v5 - - name: Install and run golangci-lint - uses: golangci/golangci-lint-action@v4 # nosemgrep - with: - version: v1.54 - args: --verbose --timeout=3m + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@v10 + + # basic check to verify that all Nix flake outputs are soundly typed + - name: Check flake + run: | + nix flake check \ + --all-systems \ + --no-build + + # If running `gomod2nix` changes `gomod2nix.toml`, that means that the + # file is not up to date and the build needs to fail. If that happens, + # run `gomod2nix` inside the Nix development environment to regenerate + # that file and then commit the changes to Git. + - name: Ensure gomod2nix dependencies are up to date + run: | + nix develop --command gomod2nix + git diff --exit-code gomod2nix.toml + + - name: Run golangci-lint + run: | + nix develop --command \ + golangci-lint run \ + --verbose \ + --timeout=3m - name: Run go test and generate coverage report run: | - go test -v -coverprofile=coverage.out -coverpkg=./... ./... + nix develop --command \ + go test \ + -v \ + -coverprofile=coverage.out \ + -coverpkg=./... \ + ./... - name: Upload coverage report to Codecov uses: codecov/codecov-action@v4 # nosemgrep @@ -63,44 +62,33 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} codecov_yml_path: codecov.yml - - name: Build resonate - run: go build -o resonate - - - name: Cache resonate binary - uses: actions/cache/save@v4 - with: - path: resonate - key: resonate-${{ github.sha }} - test: - runs-on: ubuntu-latest - needs: [build] + runs-on: ubuntu-22.04 steps: - - name: Restore resonate binary - uses: actions/cache/restore@v4 - with: - path: resonate - key: resonate-${{ github.sha }} - fail-on-cache-miss: true + - name: Check out repository + uses: actions/checkout@v4 - - name: Run resonate server + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@v10 + + - name: Use Magic Nix Cache + uses: DeterminateSystems/magic-nix-cache-action@v4 + + - name: Build server and harness run: | - chmod +x resonate - ./resonate serve --aio-store-sqlite-path :memory: & + nix build ".#resonate" + cp ./result/bin/resonate resonate - - name: Checkout test harness - uses: actions/checkout@v4 - with: - repository: resonatehq/durable-promise-test-harness + nix build ".#durable-promise-test-harness" + cp ./result/bin/durable-promise-test-harness durable-promise-test-harness - - name: Build test harness + - name: Run resonate server run: | - go build -o harness + ./resonate serve --aio-store-sqlite-path :memory: & - name: Run linearizability check run: | - chmod +x harness - ./harness verify -r 1000 -c 10 + ./durable-promise-test-harness verify -r 1000 -c 10 - uses: actions/upload-artifact@v4 if: ${{ always() }} @@ -110,13 +98,22 @@ jobs: scan: name: semgrep - needs: [build] runs-on: ubuntu-20.04 + needs: [test] env: SEMGREP_RULES: "auto semgrep.yml" - container: - image: returntocorp/semgrep if: (github.actor != 'dependabot[bot]') steps: - - uses: actions/checkout@v4 - - run: semgrep ci + - name: Check out repository + uses: actions/checkout@v4 + + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@v10 + + - name: Use Magic Nix Cache + uses: DeterminateSystems/magic-nix-cache-action@v4 + + - name: semgrep + run: | + nix develop --command \ + semgrep ci diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml new file mode 100644 index 00000000..cb702efb --- /dev/null +++ b/.github/workflows/dependencies.yml @@ -0,0 +1,46 @@ +# this approach is indebted to this blog post from GitHub user hallettj: +# https://sitr.us/2024/03/08/nix-npm-and-dependabot.html + +name: Update gomod2nix.toml upon Dependabot changes to Go dependencies + +on: + push: + branches: + - "dependabot/go_modules/*" + +jobs: + update_gomod2nix_toml_file: + name: Update gomod2nix.toml if Go dependencies have changed + runs-on: ubuntu-22.04 + if: github.actor == 'dependabot[bot]' || github.actor == 'dependabot-preview[bot]' + permissions: + contents: write + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@v10 + + - name: Use Magic Nix Cache + uses: DeterminateSystems/magic-nix-cache-action@v4 + + - name: Update gomod2nix.toml (if go.mod has changed) + run: | + nix develop --command gomod2nix + + - name: Set up Git config + run: | + git config user.name "${GITHUB_ACTOR}" + git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" + + - name: Commit changes + run: | + git add . + if [[ $(git status -s) ]]; then + git commit -m "build(deps): update gomod2nix.toml [dependabot skip]" --no-verify + git push + echo "pushed an update to gomod2nix.toml" + else + echo "go dependencies have not changed" + fi diff --git a/.github/workflows/dst.yaml b/.github/workflows/dst.yaml index a22d918c..c110c696 100644 --- a/.github/workflows/dst.yaml +++ b/.github/workflows/dst.yaml @@ -14,34 +14,30 @@ permissions: jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - - id: cache - uses: actions/cache/restore@v4 - with: - path: resonate - key: resonate-${{ github.sha }} - - name: Checkout repository - if: steps.cache.outputs.cache-hit != 'true' + - name: Check out repository uses: actions/checkout@v4 - - name: Set up Go - if: steps.cache.outputs.cache-hit != 'true' - uses: actions/setup-go@v5 - with: - go-version-file: go.mod - cache: false - - name: Build resonate - if: steps.cache.outputs.cache-hit != 'true' - run: go build -o resonate + + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@v10 + + - name: Use Magic Nix Cache + uses: DeterminateSystems/magic-nix-cache-action@v4 + + - name: Build resonate binary + run: | + nix build ".#resonate" + cp ./result/bin/resonate resonate + - name: Cache resonate binary - if: steps.cache.outputs.cache-hit != 'true' uses: actions/cache/save@v4 with: path: resonate key: resonate-${{ github.sha }} seed: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - id: seed name: Set random seed @@ -50,7 +46,7 @@ jobs: seed: ${{ inputs.seed || steps.seed.outputs.seed }} dst: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 needs: [build, seed] timeout-minutes: 150 @@ -95,7 +91,6 @@ jobs: fail-on-cache-miss: true - name: Run dst (seed=${{ needs.seed.outputs.seed }}, scenario=${{ matrix.scenario }}, store=${{ matrix.store }}) run: | - chmod +x resonate ./resonate dst run --seed ${{ needs.seed.outputs.seed }} --scenario ${{ matrix.scenario }} --aio-store ${{ matrix.store }} > logs.txt 2>&1 - name: Create issue if dst failed env: @@ -118,7 +113,7 @@ jobs: path: logs.txt diff: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 needs: [build, seed, dst] strategy: @@ -162,7 +157,6 @@ jobs: GITHUB_TOKEN: ${{ secrets.github_token }} if: ${{ failure() }} run: | - chmod +x resonate ./resonate dst issue \ --seed ${{ needs.seed.outputs.seed }} \ --scenario ${{ matrix.scenario }} \ diff --git a/.github/workflows/release_publish_github_artifacts.yaml b/.github/workflows/release_publish_github_artifacts.yaml index 4a865c8d..2bb13fed 100644 --- a/.github/workflows/release_publish_github_artifacts.yaml +++ b/.github/workflows/release_publish_github_artifacts.yaml @@ -14,76 +14,60 @@ permissions: contents: write jobs: - release-linux-artifact: - runs-on: ubuntu-latest + release-artifacts-nix: + runs-on: ${{ matrix.systems.runner }} + strategy: + matrix: + systems: + - os: linux + arch: x86_64 + runner: ubuntu-22.04 + - os: linux + arch: aarch64 + runner: ubuntu-22.04 + - os: darwin + arch: x86_64 + runner: macos-12 + - os: darwin + arch: aarch64 + runner: macos-12 steps: - - name: Checkout repository + - name: Check out repository uses: actions/checkout@v4 - - name: Set up Go 1.21 - uses: actions/setup-go@v5 - with: - go-version: 1.21 - - name: Install cross-compiler for linux/arm64 - run: | - sudo apt-get update - sudo apt-get install -y gcc-aarch64-linux-gnu - - name: Build for both amd64 and arm64 - run: | - # Build resonate binaries - GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -o ./bin/linux-x86_64/ ./... - CC=aarch64-linux-gnu-gcc GOOS=linux GOARCH=arm64 CGO_ENABLED=1 go build -o ./bin/linux-aarch64/ ./... - - # Change permissions - chmod +x ./bin/linux-x86_64/resonate - chmod +x ./bin/linux-aarch64/resonate + + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@v10 - # Compress binaries - tar -czvf resonate_linux_x86_64.tar.gz ./bin/linux-x86_64/resonate - tar -czvf resonate_linux_aarch64.tar.gz ./bin/linux-aarch64/resonate - - # Create checksums - sha256sum resonate_linux_x86_64.tar.gz > resonate_linux_x86_64.tar.gz.sha256 - sha256sum resonate_linux_aarch64.tar.gz > resonate_linux_aarch64.tar.gz.sha256 - - name: Upload Artifacts - env: - GH_TOKEN: ${{ github.token }} + - name: Use Magic Nix Cache + uses: DeterminateSystems/magic-nix-cache-action@v4 + + - name: Build Resonate binary run: | - gh release upload ${{ inputs.tag }} resonate_linux_x86_64.tar.gz --clobber - gh release upload ${{ inputs.tag }} resonate_linux_x86_64.tar.gz.sha256 --clobber - gh release upload ${{ inputs.tag }} resonate_linux_aarch64.tar.gz --clobber - gh release upload ${{ inputs.tag }} resonate_linux_aarch64.tar.gz.sha256 --clobber + TARBALL="resonate_${{ matrix.systems.os }}_${{ matrix.systems.arch }}.tar.gz" + TARBALL_CHECKSUM="${TARBALL}.sha256" - release-darwin-artifact: - runs-on: macos-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: 1.21 - - name: Build for both amd64 and arm64 - run: | - # Build resonate binaries - GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 go build -o ./bin/darwin-x86_64/ ./... - GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 go build -o ./bin/darwin-aarch64/ ./... + # Build resonate binary + nix build ".#resonate" + + # Copy into root + cp ./result/bin/resonate resonate - # Change permissions - chmod +x ./bin/darwin-x86_64/resonate - chmod +x ./bin/darwin-aarch64/resonate + # Compress binary + tar -czvf "${TARBALL}" resonate - # Compress binaries - tar -czvf resonate_darwin_x86_64.tar.gz ./bin/darwin-x86_64/resonate - tar -czvf resonate_darwin_aarch64.tar.gz ./bin/darwin-aarch64/resonate + # Create checksum + if [[ "${{ matrix.systems.os }}" == "darwin" ]]; then + shasum -a 256 "${TARBALL}" > "${TARBALL_CHECKSUM}" + else + sha256sum "${TARBALL}" > "${TARBALL_CHECKSUM}" + fi - # Create checksums - shasum -a 256 resonate_darwin_x86_64.tar.gz > resonate_darwin_x86_64.tar.gz.sha256 - shasum -a 256 resonate_darwin_aarch64.tar.gz > resonate_darwin_aarch64.tar.gz.sha256 - - name: Upload Artifacts + - name: Upload binary env: GH_TOKEN: ${{ github.token }} run: | - gh release upload ${{ inputs.tag }} resonate_darwin_x86_64.tar.gz --clobber - gh release upload ${{ inputs.tag }} resonate_darwin_x86_64.tar.gz.sha256 --clobber - gh release upload ${{ inputs.tag }} resonate_darwin_aarch64.tar.gz --clobber - gh release upload ${{ inputs.tag }} resonate_darwin_aarch64.tar.gz.sha256 --clobber + TARBALL="resonate_${{ matrix.systems.os }}_${{ matrix.systems.arch }}.tar.gz" + TARBALL_CHECKSUM="${TARBALL}.sha256" + + gh release upload ${{ inputs.tag }} "${TARBALL}" --clobber + gh release upload ${{ inputs.tag }} "${TARBALL_CHECKSUM}" --clobber diff --git a/.github/workflows/release_verify_artifacts.yaml b/.github/workflows/release_verify_artifacts.yaml index 3dd3c73a..92a389a8 100644 --- a/.github/workflows/release_verify_artifacts.yaml +++ b/.github/workflows/release_verify_artifacts.yaml @@ -21,7 +21,7 @@ permissions: jobs: seed: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - id: seed name: Set random seed @@ -31,11 +31,11 @@ jobs: verify-github-image: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 needs: [seed] steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Download and test GHCR image run: | # Login to GHCR @@ -49,11 +49,11 @@ jobs: verify-github-release: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 needs: [seed] steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Download and test GH release run: | # Download the release artifact diff --git a/.gitignore b/.gitignore index 21dcafe5..1e44d6cc 100644 --- a/.gitignore +++ b/.gitignore @@ -27,3 +27,6 @@ coverage.out # ignore goland files .idea + +# Nix artifacts +result* diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 944272d6..45058467 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -92,6 +92,95 @@ project. git branch -D awesome_branch ``` +## Working with Nix + +This repo currently has some optional [Nix] stuff that you can experiment with. + +### Getting started + +To get started, [install Nix][nix-install] on either Linux or macOS (the install script infers which system you're on): + +```bash +curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install +``` + +This could take a few minutes. +If you need to cleanly uninstall Nix and all of its system dependencies at any time: + +```bash +/nix/nix-installer uninstall +``` + +### The development environment + +Once Nix is on your system, you can activate the Nix [development environment][dev-env] in this repo: + +```bash +nix develop +``` + +With that command, you enter a project-specific shell with pinned packages for all of the tools required for the project (Go 1.21, protoc plus plugins, etc.). +All the `make` commands in the [`Makefile`](./Makefile), for example, should just work inside the shell. + +In order to [streamline][nix-direnv-post] activating the development shell, it's recommended to [install direnv][direnv-install]. +If you install [direnv] and run `direnv allow` in this repo, the Nix development shell will be activated automatically every time you `cd` into the repo, which makes explicitly running `nix develop` unnecessary. +If you'd like to disable direnv in this repo, you can run `direnv revoke`. + +Optionally, you can install [nix-direnv] in addition to [direnv]. +nix-direnv provides a faster implementation of direnv's Nix functionality (though direnv should work just fine in this repo without it). + +### Building the server as a package + +In addition to the development environment, you can build the Resonate server as a Nix package: + +```bash +nix build +``` + +When that succeeds, the binary will be available at `./result/bin/resonate`: + +```bash +./result/bin/resonate serve +``` + +`result` is actually a symlink to a Nix store path: + +```bash +realpath result +/nix/store/xmjcz2rm3l8k8wjnvm4yk7m8fkp59apj-resonate-0.5.0 # the hash will differ on your system +``` + +In order to handle Go dependencies, this project uses a tool called [gomod2nix]. +What this tool essentially does is inspect [`go.mod`](./go.mod) and generate a [`gomod2nix.toml`](./gomod2nix.toml) file that Nix can use to generate [derivations] for each Go dependency. + +Whenever you update the `go.mod` file, you need to run `gomod2nix` (included in the Nix development environment) to regenerate `gomod2nix.toml`. +If you update `go.mod` but forget to regenerate `gomod2nix.toml`, the [`Ensure gomod2nix dependencies are up to date`](./.github/workflows/cicd.yaml) job will fail in CI. + +### Running the server directly using Nix + +As an alternative, you can run the server directly using Nix: + +```bash +nix run + +# To pass in args +nix run . -- serve +``` + +### Building the Docker image with Nix + +For x64 Linux users, you can even build the Resonate Docker image using Nix (with no dependence on the `Dockerfile` or the Docker CLI): + +```bash +nix build .#dockerImages.x86_64-linux.default +``` + +To load the image: + +```bash +docker load < result +``` + ## What to contribute to? Here are some areas where your contributions would be valuable: @@ -102,3 +191,13 @@ Here are some areas where your contributions would be valuable: * Add support for the following databases: MySQL, Elasticsearch, MongoDB. Thank you for your contributions and support in building a better Resonate! 🚀 + +[derivations]: https://zero-to-nix.com/concepts/derivations +[dev-env]: https://zero-to-nix.com/concepts/dev-env +[direnv]: https://direnv.net +[direnv-install]: https://direnv.net/docs/installation.html +[gomod2nix]: https://github.com/nix-community/gomod2nix +[nix]: https://nixos.org +[nix-direnv]: https://github.com/nix-community/nix-direnv +[nix-direnv-post]: https://determinate.systems/posts/nix-direnv +[nix-install]: https://zero-to-nix.com/start/install diff --git a/README.md b/README.md index 6ae46b8d..646ca89e 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,3 @@ -> Resonate is in the **Design Phase** -> -> Our code base is constantly evolving as we are exploring Resonate's programming model. If you are passionate about a dead simple developer experience, join us on this journey of discovery and share your thoughts. -> -> [Join our slack](https://resonatehq.io/slack) - - -

-

@@ -17,7 +8,6 @@ [![ci](https://github.com/resonatehq/resonate/actions/workflows/cicd.yaml/badge.svg)](https://github.com/resonatehq/resonate/actions/workflows/cicd.yaml) [![dst](https://github.com/resonatehq/resonate/actions/workflows/dst.yaml/badge.svg)](https://github.com/resonatehq/resonate/actions/workflows/dst.yaml) -[![codecov](https://codecov.io/gh/resonatehq/resonate/branch/main/graph/badge.svg)](https://codecov.io/gh/resonatehq/resonate) [![Go Report Card](https://goreportcard.com/badge/github.com/resonatehq/resonate)](https://goreportcard.com/report/github.com/resonatehq/resonate) [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) @@ -42,7 +32,7 @@ Resonate's Distributed Async Await is a new programming model that simplifies co ## Why Resonate? -- **Cloud Computing Made Dead Simple**: Resonate offers a dead simple programming model that simplifies coding for the cloud using an intuitive paradigm you already know — async await. +- **Cloud Computing Made Dead Simple**: Resonate simplifies coding for the cloud using an intuitive paradigm you already know — async await. - **Single Binary**: Resonate simplifies your deployment and operations with a single binary. diff --git a/codecov.yml b/codecov.yml index b717a750..790ec2e7 100644 --- a/codecov.yml +++ b/codecov.yml @@ -3,3 +3,6 @@ ignore: - "pkg/client" - "*.pb.go" - "test/*" + - "**/*.nix" + - "flake.lock" + - "gomod2nix.toml" diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..0d29b519 --- /dev/null +++ b/flake.lock @@ -0,0 +1,95 @@ +{ + "nodes": { + "flake-schemas": { + "locked": { + "lastModified": 1697467827, + "narHash": "sha256-j8SR19V1SRysyJwpOBF4TLuAvAjF5t+gMiboN4gYQDU=", + "rev": "764932025c817d4e500a8d2a4d8c565563923d29", + "revCount": 29, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-schemas/0.1.2/018b3da8-4cc3-7fbb-8ff7-1588413c53e2/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/%2A" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gomod2nix": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1710154385, + "narHash": "sha256-4c3zQ2YY4BZOufaBJB4v9VBBeN2dH7iVdoJw8SDNCfI=", + "owner": "nix-community", + "repo": "gomod2nix", + "rev": "872b63ddd28f318489c929d25f1f0a3c6039c971", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "gomod2nix", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1713145326, + "narHash": "sha256-m7+IWM6mkWOg22EC5kRUFCycXsXLSU7hWmHdmBfmC3s=", + "rev": "53a2c32bc66f5ae41a28d7a9a49d321172af621e", + "revCount": 557721, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.2311.557721%2Brev-53a2c32bc66f5ae41a28d7a9a49d321172af621e/018ee413-6e9c-72d4-be11-b9bef24c16bc/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/NixOS/nixpkgs/%2A" + } + }, + "root": { + "inputs": { + "flake-schemas": "flake-schemas", + "gomod2nix": "gomod2nix", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..6486251c --- /dev/null +++ b/flake.nix @@ -0,0 +1,158 @@ +# This flake was initially generated by fh, the CLI for FlakeHub (version 0.1.10) +{ + # A helpful description of the flake + description = "Resonate: a dead simple programming model for modern applications"; + + # Flake inputs + inputs = { + nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/*"; + gomod2nix = { + url = "github:nix-community/gomod2nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/*"; + }; + + # Flake outputs that other flakes can use + outputs = { self, nixpkgs, gomod2nix, flake-schemas }: + let + # Version inference + lastModifiedDate = self.lastModifiedDate or self.lastModified or "19700101"; + version = "${builtins.substring 0 8 lastModifiedDate}-${self.shortRev or "dirty"}"; + + # Helpers for producing system-specific outputs + supportedSystems = [ "x86_64-linux" "aarch64-darwin" "x86_64-darwin" "aarch64-linux" ]; + forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f { + pkgs = import nixpkgs { + inherit system; + overlays = [ self.overlays.default ]; + }; + inherit system; + }); + in + { + # Schemas tell Nix about the structure of your flake's outputs + inherit (flake-schemas) schemas; + + # Custom attributes for Nixpkgs + overlays.default = final: prev: { + buildGoApplication = gomod2nix.legacyPackages.${prev.stdenv.system}.buildGoApplication; + gomod2nixPkg = gomod2nix.packages.${prev.stdenv.system}.default; + }; + + # Development environments + devShells = forEachSupportedSystem ({ pkgs, system }: { + default = pkgs.mkShell { + # Pinned packages available in the environment + packages = with pkgs; [ + # Go + go_1_21 + gotools # goimports, godoc, etc. + golangci-lint # Go linter + + # Nix + Go dependency management + gomod2nixPkg + + # Tool for generating mocks + mockgen + + # protoc + protobuf + protoc-gen-go + protoc-gen-go-grpc + + # OpenAPI generator + oapi-codegen + + # Nix formatter + nixpkgs-fmt + ] + # Broken on aarch64-linux + ++ pkgs.lib.optional (system != "aarch64-linux") (with pkgs; [ semgrep ]); + }; + }); + + # Package outputs + packages = forEachSupportedSystem ({ pkgs, ... }: rec { + # The Resonate server + resonate = pkgs.buildGoApplication rec { + pname = "resonate"; + inherit version; + src = self; + modules = ./gomod2nix.toml; + + # Required for SQLite on Linux + CGO_ENABLED = 1; + + # Make the binary static on Linux + ldflags = [ + "-s" + "-w" + ] ++ pkgs.lib.optional (pkgs.stdenv.isLinux) [ + "-extldflags=-static" + "-linkmode=external" + ]; + + # Use glibc on Linux + buildInputs = pkgs.lib.optional + (pkgs.stdenv.isLinux) + (with pkgs; [ glibc glibc.static ]); + + # Provides the `installShellCompletion` shell function + nativeBuildInputs = with pkgs; [ installShellFiles ]; + + # Provides shell completion for bash, zsh, and fish + postInstall = '' + installShellCompletion --cmd ${pname} \ + --bash <($out/bin/${pname} completion bash) \ + --zsh <($out/bin/${pname} completion zsh) \ + --fish <($out/bin/${pname} completion fish) + ''; + }; + + # Test harness (TODO: make this a flake as well) + durable-promise-test-harness = pkgs.buildGo121Module rec { + name = "durable-promise-test-harness"; + src = pkgs.fetchFromGitHub { + owner = "resonatehq"; + repo = name; + rev = "43a2b602ca1ed5a019f0e9341efdab3484b3e2e0"; + hash = "sha256-9IfrHQ+8CB/yLHtmZwcajvQ2yWrqZJi2frS+wBRsGfY="; + }; + vendorHash = "sha256-n15ECdUjvwg8H0uVZzP40E9vpNSJrkvqxQWBTGkqcs8="; + }; + + # This enables you to use the shorthand `nix build` to build the server + default = resonate; + }); + + # Docker image outputs + dockerImages = forEachSupportedSystem ({ pkgs, ... }: rec { + # The Resonate server as an image + resonate = + let + # A version of Nixpkgs solely for x86_64 Linux (the built image's system) + linuxPkgs = pkgs.legacyPackages.x86_64-linux; + in + pkgs.dockerTools.buildLayeredImage { + name = "resonate-${version}"; + + # Extra packages for the image + contents = with linuxPkgs.dockerTools; [ + # Standard requirement for HTTP and the like + caCertificates + ]; + + config = { + # The image ENTRYPOINT (Nix automatically builds this path) + Entrypoint = [ "${self.packages.x86_64-linux.default}/bin/resonate" ]; + # EXPOSE statements for ports + ExposedPorts = { + "8001" = { }; + "50051" = { }; + }; + }; + }; + }); + }; +} diff --git a/go.mod b/go.mod index 3cf4fe08..d6bc6a05 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/spf13/cobra v1.8.0 github.com/spf13/viper v1.18.2 github.com/stretchr/testify v1.9.0 - google.golang.org/grpc v1.62.1 + google.golang.org/grpc v1.63.2 google.golang.org/protobuf v1.33.0 ) @@ -36,7 +36,6 @@ require ( github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect github.com/goccy/go-json v0.10.2 // indirect - github.com/golang/protobuf v1.5.3 // indirect github.com/hashicorp/hcl v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/json-iterator/go v1.1.12 // indirect @@ -69,7 +68,7 @@ require ( golang.org/x/net v0.21.0 // indirect golang.org/x/sys v0.17.0 // indirect golang.org/x/text v0.14.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index f9b1d187..109229d1 100644 --- a/go.sum +++ b/go.sum @@ -47,10 +47,6 @@ github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keL github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs= -github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= -github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -183,14 +179,11 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 h1:AjyfHzEPEFp/NpvfN5g+KDla3EMojjhRVZc1i7cj+oM= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80/go.mod h1:PAREbraiVEVGVdTZsVWjSbbTtSyGbAgIIvni8a8CD5s= -google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= -google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= -google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= -google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de h1:cZGRis4/ot9uVm639a+rHCUaG0JJHEsdyzSQTMX+suY= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:H4O17MA/PE9BsGx3w+a+W2VOLLD1Qf7oJneAoU6WktY= +google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= +google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/gomod2nix.toml b/gomod2nix.toml new file mode 100644 index 00000000..f4f47ed2 --- /dev/null +++ b/gomod2nix.toml @@ -0,0 +1,198 @@ +schema = 3 + +[mod] + [mod."github.com/apapsch/go-jsonmerge/v2"] + version = "v2.0.0" + hash = "sha256-xp/1B6XUN2EbddBfoUkTV3oTk+34m4kOZP+66HhfLg4=" + [mod."github.com/beorn7/perks"] + version = "v1.0.1" + hash = "sha256-h75GUqfwJKngCJQVE5Ao5wnO3cfKD9lSIteoLp/3xJ4=" + [mod."github.com/bytedance/sonic"] + version = "v1.10.1" + hash = "sha256-CwIbTJyLWmB0nAApjoo/DizvWX6rvf5r5GIT7k1qOFU=" + [mod."github.com/cespare/xxhash/v2"] + version = "v2.2.0" + hash = "sha256-nPufwYQfTkyrEkbBrpqM3C2vnMxfIz6tAaBmiUP7vd4=" + [mod."github.com/chenzhuoyu/base64x"] + version = "v0.0.0-20230717121745-296ad89f973d" + hash = "sha256-o1qbpdkfbXE/DWW1ZFgTLPS2HGS0Ib69dbd6zO8CCWk=" + [mod."github.com/chenzhuoyu/iasm"] + version = "v0.9.0" + hash = "sha256-xlZIAcRAD9dufk7JZfyKyiBzw6Gzfj4oKh2wbjKukQg=" + [mod."github.com/davecgh/go-spew"] + version = "v1.1.2-0.20180830191138-d8f796af33cc" + hash = "sha256-fV9oI51xjHdOmEx6+dlq7Ku2Ag+m/bmbzPo6A4Y74qc=" + [mod."github.com/fsnotify/fsnotify"] + version = "v1.7.0" + hash = "sha256-MdT2rQyQHspPJcx6n9ozkLbsktIOJutOqDuKpNAtoZY=" + [mod."github.com/gabriel-vasile/mimetype"] + version = "v1.4.3" + hash = "sha256-EDmlRi3av27dq/ISVTglv08z4yZzMQ/SxL1c46EJro0=" + [mod."github.com/gin-contrib/sse"] + version = "v0.1.0" + hash = "sha256-zYbMTao+1F+385Lvsba9roLmmt9eYqr57sUWo0LCVhw=" + [mod."github.com/gin-gonic/gin"] + version = "v1.9.1" + hash = "sha256-3FHywH5QuhTeQcdF8v06jt9vIkH0ON6ydpMYciAc8xQ=" + [mod."github.com/go-chi/chi/v5"] + version = "v5.0.12" + hash = "sha256-PhCb3wVSzuIXxZxM7aB3MdMLK3nnvUMhaMXk+p+H6Ec=" + [mod."github.com/go-playground/locales"] + version = "v0.14.1" + hash = "sha256-BMJGAexq96waZn60DJXZfByRHb8zA/JP/i6f/YrW9oQ=" + [mod."github.com/go-playground/universal-translator"] + version = "v0.18.1" + hash = "sha256-2/B2qP51zfiY+k8G0w0D03KXUc7XpWj6wKY7NjNP/9E=" + [mod."github.com/go-playground/validator/v10"] + version = "v10.19.0" + hash = "sha256-qlHNGcvdIMdiDpitAWkS2LD34LesgLgk6hXTVmA/WPE=" + [mod."github.com/goccy/go-json"] + version = "v0.10.2" + hash = "sha256-6fMD2/Rku8HT0zDdeA23pX0YxbohiIOC8OJNYbylJTQ=" + [mod."github.com/golang-jwt/jwt"] + version = "v3.2.2+incompatible" + hash = "sha256-LOkpuXhWrFayvVf1GOaOmZI5YKEsgqVSb22aF8LnCEM=" + [mod."github.com/golang/mock"] + version = "v1.6.0" + hash = "sha256-fWdnMQisRbiRzGT3ISrUHovquzLRHWvcv1JEsJFZRno=" + [mod."github.com/google/uuid"] + version = "v1.6.0" + hash = "sha256-VWl9sqUzdOuhW0KzQlv0gwwUQClYkmZwSydHG2sALYw=" + [mod."github.com/hashicorp/hcl"] + version = "v1.0.0" + hash = "sha256-xsRCmYyBfglMxeWUvTZqkaRLSW+V2FvNodEDjTGg1WA=" + [mod."github.com/inconshreveable/mousetrap"] + version = "v1.1.0" + hash = "sha256-XWlYH0c8IcxAwQTnIi6WYqq44nOKUylSWxWO/vi+8pE=" + [mod."github.com/json-iterator/go"] + version = "v1.1.12" + hash = "sha256-To8A0h+lbfZ/6zM+2PpRpY3+L6725OPC66lffq6fUoM=" + [mod."github.com/klauspost/cpuid/v2"] + version = "v2.2.5" + hash = "sha256-/M8CHNah2/EPr0va44r1Sx+3H6E+jN8bGFi5jQkLBrM=" + [mod."github.com/leodido/go-urn"] + version = "v1.4.0" + hash = "sha256-Q6kplWkY37Tzy6GOme3Wut40jFK4Izun+ij/BJvcEu0=" + [mod."github.com/lib/pq"] + version = "v1.10.9" + hash = "sha256-Gl6dLtL+yk6UrTTWfas43aM4lP/pNa2l7+ITXnjQyKs=" + [mod."github.com/magiconair/properties"] + version = "v1.8.7" + hash = "sha256-XQ2bnc2s7/IH3WxEO4GishZurMyKwEclZy1DXg+2xXc=" + [mod."github.com/mattn/go-isatty"] + version = "v0.0.20" + hash = "sha256-qhw9hWtU5wnyFyuMbKx+7RB8ckQaFQ8D+8GKPkN3HHQ=" + [mod."github.com/mattn/go-sqlite3"] + version = "v1.14.22" + hash = "sha256-CWF2Hjg43658NhaePWbGzS19gHJXjuTroG5c0W3hgYQ=" + [mod."github.com/mitchellh/mapstructure"] + version = "v1.5.0" + hash = "sha256-ztVhGQXs67MF8UadVvG72G3ly0ypQW0IRDdOOkjYwoE=" + [mod."github.com/modern-go/concurrent"] + version = "v0.0.0-20180306012644-bacd9c7ef1dd" + hash = "sha256-OTySieAgPWR4oJnlohaFTeK1tRaVp/b0d1rYY8xKMzo=" + [mod."github.com/modern-go/reflect2"] + version = "v1.0.2" + hash = "sha256-+W9EIW7okXIXjWEgOaMh58eLvBZ7OshW2EhaIpNLSBU=" + [mod."github.com/oapi-codegen/runtime"] + version = "v1.1.1" + hash = "sha256-GRvzpQngQPAy59KvvcwhjYqjx4gttIhOtQKjqfQcNvI=" + [mod."github.com/pelletier/go-toml/v2"] + version = "v2.1.0" + hash = "sha256-0u6oV8YMM26y2bw1oe3gLmEJc/whpNaFtEe4yOkN24c=" + [mod."github.com/pmezard/go-difflib"] + version = "v1.0.1-0.20181226105442-5d4384ee4fb2" + hash = "sha256-XA4Oj1gdmdV/F/+8kMI+DBxKPthZ768hbKsO3d9Gx90=" + [mod."github.com/prometheus/client_golang"] + version = "v1.19.0" + hash = "sha256-YV8sxMPR+xorTUCriTfcFsaV2b7PZfPJDQmOgUYOZJo=" + [mod."github.com/prometheus/client_model"] + version = "v0.5.0" + hash = "sha256-/sXlngf8AoEIeLIiaLg6Y7uYPVq7tI0qnLt0mUyKid4=" + [mod."github.com/prometheus/common"] + version = "v0.48.0" + hash = "sha256-gXer/9So7DxDP3cBQp8sIzJXP5whT8sk31FURoij5Do=" + [mod."github.com/prometheus/procfs"] + version = "v0.12.0" + hash = "sha256-Y4ZZmxIpVCO67zN3pGwSk2TcI88zvmGJkgwq9DRTwFw=" + [mod."github.com/robfig/cron/v3"] + version = "v3.0.1" + hash = "sha256-FUdqNbWYi5biQc/tjCeqzxu4iy4ot1ZvDU1M1wRf/6k=" + [mod."github.com/rogpeppe/go-internal"] + version = "v1.11.0" + hash = "sha256-BucSndJVnqX9e6p5PfA6Z8N2bGfIeRfxAxYLUDXTbIo=" + [mod."github.com/sagikazarmark/locafero"] + version = "v0.4.0" + hash = "sha256-7I1Oatc7GAaHgAqBFO6Tv4IbzFiYeU9bJAfJhXuWaXk=" + [mod."github.com/sagikazarmark/slog-shim"] + version = "v0.1.0" + hash = "sha256-F92BQXXmn3mCwu3mBaGh+joTRItQDSDhsjU6SofkYdA=" + [mod."github.com/sourcegraph/conc"] + version = "v0.3.0" + hash = "sha256-mIdMs9MLAOBKf3/0quf1iI3v8uNWydy7ae5MFa+F2Ko=" + [mod."github.com/spf13/afero"] + version = "v1.11.0" + hash = "sha256-+rV3cDZr13N8E0rJ7iHmwsKYKH+EhV+IXBut+JbBiIE=" + [mod."github.com/spf13/cast"] + version = "v1.6.0" + hash = "sha256-hxioqRZfXE0AE5099wmn3YG0AZF8Wda2EB4c7zHF6zI=" + [mod."github.com/spf13/cobra"] + version = "v1.8.0" + hash = "sha256-oAE+fEaRfZPE541IPWE0GMeBBYgH2DMhtZNxzp7DFlY=" + [mod."github.com/spf13/pflag"] + version = "v1.0.5" + hash = "sha256-w9LLYzxxP74WHT4ouBspH/iQZXjuAh2WQCHsuvyEjAw=" + [mod."github.com/spf13/viper"] + version = "v1.18.2" + hash = "sha256-MXYbK6w1LEaoZ2/L/STF3WU1tbK+7NwGVxUCLKPkwks=" + [mod."github.com/stretchr/testify"] + version = "v1.9.0" + hash = "sha256-uUp/On+1nK+lARkTVtb5RxlW15zxtw2kaAFuIASA+J0=" + [mod."github.com/subosito/gotenv"] + version = "v1.6.0" + hash = "sha256-LspbjTniiq2xAICSXmgqP7carwlNaLqnCTQfw2pa80A=" + [mod."github.com/twitchyliquid64/golang-asm"] + version = "v0.15.1" + hash = "sha256-HLk6oUe7EoITrNvP0y8D6BtIgIcmDZYtb/xl/dufIoY=" + [mod."github.com/ugorji/go/codec"] + version = "v1.2.11" + hash = "sha256-hfcj+YsznH6MeERSdIPjSrsM7gbDcIzH/TbgHzYbPww=" + [mod."go.uber.org/atomic"] + version = "v1.9.0" + hash = "sha256-D8OtLaViqPShz1w8ijhIHmjw9xVaRu0qD2hXKj63r4Q=" + [mod."go.uber.org/multierr"] + version = "v1.9.0" + hash = "sha256-tlDRooh/V4HDhZohsUrxot/Y6uVInVBtRWCZbj/tPds=" + [mod."golang.org/x/arch"] + version = "v0.5.0" + hash = "sha256-IHgBWsb3b7fIrlrJWXbPmEuMwDy4cYQ+fmssU4AGB80=" + [mod."golang.org/x/crypto"] + version = "v0.19.0" + hash = "sha256-Vi6vY/eWNlYQ9l3Y+gA+X2+h2CmzEOrBRVFO/cnrPWc=" + [mod."golang.org/x/exp"] + version = "v0.0.0-20230905200255-921286631fa9" + hash = "sha256-CyeVwjp12Wqh4ptqfi3KHCWPzOFhE8fSrP3sMjMXvec=" + [mod."golang.org/x/net"] + version = "v0.21.0" + hash = "sha256-LfiqMpPtqvW/eLkfx6Ebr5ksqKbQli6uq06c/+XrBsw=" + [mod."golang.org/x/sys"] + version = "v0.17.0" + hash = "sha256-e0qnE+SitE02IzvnJKI4Uzpq9EOZY+zvE8Wf5b2e6Kg=" + [mod."golang.org/x/text"] + version = "v0.14.0" + hash = "sha256-yh3B0tom1RfzQBf1RNmfdNWF1PtiqxV41jW1GVS6JAg=" + [mod."google.golang.org/genproto/googleapis/rpc"] + version = "v0.0.0-20240227224415-6ceb2ff114de" + hash = "sha256-XF1eaB8Uwjuii1SVpiZABBhrpszJy5ujOtN+7qAAouM=" + [mod."google.golang.org/grpc"] + version = "v1.63.2" + hash = "sha256-RmtVjYLam97k7IHTHU7Gn16xNX+GvA9AiLKlQwOiZXU=" + [mod."google.golang.org/protobuf"] + version = "v1.33.0" + hash = "sha256-cWwQjtUwSIEkAlAadrlxK1PYZXTRrV4NKzt7xDpJgIU=" + [mod."gopkg.in/ini.v1"] + version = "v1.67.0" + hash = "sha256-V10ahGNGT+NLRdKUyRg1dos5RxLBXBk1xutcnquc/+4=" + [mod."gopkg.in/yaml.v3"] + version = "v3.0.1" + hash = "sha256-FqL9TKYJ0XkNwJFnq9j0VvJ5ZUU1RvH/52h/f5bkYAU=" diff --git a/internal/app/subsystems/aio/queuing/connections/connections.go b/internal/app/subsystems/aio/queuing/connections/connections.go index 222dcf8f..ca2cddbb 100644 --- a/internal/app/subsystems/aio/queuing/connections/connections.go +++ b/internal/app/subsystems/aio/queuing/connections/connections.go @@ -4,6 +4,7 @@ import ( "errors" "fmt" "net/http" + "time" http_conn "github.com/resonatehq/resonate/internal/app/subsystems/aio/queuing/connections/http" "github.com/resonatehq/resonate/internal/app/subsystems/aio/queuing/connections/t_conn" @@ -50,7 +51,9 @@ func NewConnection(tasks <-chan *t_conn.ConnectionSubmission, cfg *t_conn.Connec switch cfg.Kind { case t_conn.HTTP: - param := &http.Client{} + param := &http.Client{ + Timeout: 10 * time.Second, + } conn = http_conn.New(param) err = conn.Init(tasks, cfg) default: