Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sigsci executables to PATH #2

Merged
merged 2 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,23 @@ implementation based on our [sigsci-container project](https://github.com/thermo

## Quick Start

Add the buildpack to your Heroku app:
Get the `buildpack.tar.gz` download URL from [the latest release](https://github.com/thermondo/heroku-buildpack-sigsci/releases/latest).
It should look something like:

```bash
heroku buildpacks:add https://github.com/thermondo/heroku-buildpack-sigsci/releases/download/v0.0.1/buildpack.tar.gz
```plaintext
https://github.com/thermondo/heroku-buildpack-sigsci/releases/download/LATEST_VERSION_NUMBER/buildpack.tar.gz
```

🚨 _It's highly recommended that you use the **release tarball** URL instead of the GitHub repo URL._
Then run:

```bash
heroku buildpacks:add <the-buildpack-url>
```

Then in your app's [Procfile](https://devcenter.heroku.com/articles/procfile) add something like
this:
Then in your app's [Procfile](https://devcenter.heroku.com/articles/procfile) add something like this:

```plaintext
web: ./sigsci/bin/start <the command you want to execute>
web: sigsci-wrap <the command you want to execute>
```

The buildpack is configured the same way the container is (same environment variables, etc.). See
Expand Down
13 changes: 10 additions & 3 deletions bin/compile
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,21 @@ EOF
fi

step "Extracting SigSci Agent..."
layer_dir="${BUILD_DIR}/sigsci"
layer_dir="${BUILD_DIR}/.sigsci"
dest_bin_dir="${layer_dir}/bin"
mkdir --parent "${dest_bin_dir}"
tar --extract --gzip --to-stdout --file "${download_path}" "sigsci-agent" > "${dest_bin_dir}/sigsci-agent"
chmod ugo=rx "${dest_bin_dir}/sigsci-agent"
cp "${THIS_DIR}/sigsci-wrap" "${dest_bin_dir}"
chmod -R ugo=rx "${dest_bin_dir}"
"${dest_bin_dir}/sigsci-agent" --version | indent

cp "${THIS_DIR}/start" "${dest_bin_dir}"
step "Installing profile.d script"
local profile_dir="${BUILD_DIR}/.profile.d"
mkdir --parent "${profile_dir}"
cat <<EOF > "${profile_dir}/sigsci.sh"
export PATH="\${HOME}/.sigsci/bin:\${PATH}"
EOF
chmod ugo=rx "${profile_dir}/sigsci.sh"
}

main
4 changes: 2 additions & 2 deletions bin/start → bin/sigsci-wrap
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
# shellcheck disable=SC2317 # shellcheck thinks our trap has unreachable code
#
# usage: ./sigsci/bin/start <the command to execute>
# usage: sigsci-wrap <the command to execute>
#
# this script performs the following steps:
#
Expand Down Expand Up @@ -114,7 +114,7 @@ wait_for_response

# child process is running and responding to HTTP requests. almost done!
log "starting sigsci-agent..."
./sigsci/bin/sigsci-agent --config "${CONFIG_FILE}" &
sigsci-agent --config "${CONFIG_FILE}" &

# wait for ANY background job to exit; either the child process or the sigsci agent.
wait -n
Expand Down