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

Download stacks-node (instead of building it) #17

Open
friedger opened this issue Jul 17, 2020 · 10 comments
Open

Download stacks-node (instead of building it) #17

friedger opened this issue Jul 17, 2020 · 10 comments
Labels
enhancement New feature or request
Milestone

Comments

@friedger
Copy link

There are regular nightly builds that could be used.

@whoabuddy whoabuddy added the enhancement New feature or request label Jul 20, 2020
@whoabuddy
Copy link
Contributor

That is definitely a direction I considered, I wrote this script before the builds were setup. I would need to figure out how to grab the most current ones each time.

@whoabuddy
Copy link
Contributor

whoabuddy commented Jul 30, 2020

This may not be possible without being authenticated against GitHub, which is undesirable from the viewpoint of this script.

Some more info from searching the Internets:

Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the repo scope. GitHub Apps must have the actions:read permission to use this endpoint.

Sample code that fails:

curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/blockstack/stacks-blockchain/actions/artifacts/186057766/zip
{
  "message": "You must have the actions scope to download artifacts.",
  "documentation_url": "https://developer.github.com/v3/actions/artifacts/#download-an-artifact"
}

edit this may be a possible solution if Blockstack is interested: https://github.com/actions/upload-release-asset

@whoabuddy whoabuddy added the help wanted Extra attention is needed label Jul 30, 2020
@friedger
Copy link
Author

friedger commented Jul 30, 2020 via email

@whoabuddy
Copy link
Contributor

@friedger I agree, just not sure they are ready for it, see stacks-network/stacks-core#1780

If the artifacts could be automatically converted to assets under a release, then it would be much faster to use something pre-compiled for a tool like this shell script, and save us the time of building the code manually.

@whoabuddy
Copy link
Contributor

Update 20200906 - stacks-network/stacks-core#1821 is now merged that closes the issue linked above and contains two jobs that should create a release with distributables accessible via a (non-authenticated) script.

stacks-blockchain.yml#L131: # Create a new release if we're building a tag or a tag was passed in

stacks-blockchain.yml#L155: # Upload distributables to a new release if we're building a tag or a tag was passed in

However, at this time these two jobs have been skipped by every run since the master branch has not been updated yet, so we don't have a way to test. My guess is that once the new phase is released we will be able to try this out versus manually building everything! 👍

@whoabuddy whoabuddy added this to the Krypton milestone Sep 7, 2020
@whoabuddy whoabuddy removed the help wanted Extra attention is needed label Sep 25, 2020
@whoabuddy
Copy link
Contributor

whoabuddy commented Sep 25, 2020

Looks like this may officially be possible now!

https://github.com/blockstack/stacks-blockchain/releases/tag/v23.0.0.0-krypton

UPDATE: close, but not quite there, will require some investigation

  1. curl works for the download
    curl -sS -O https://github.com/blockstack/stacks-blockchain/releases/tag/v23.0.0.0-krypton/linux-x64.zip
  2. installed unzip utility (not there by default?)
    sudo apt-get install unzip
  3. received error unzipping the file
    unzip linux-x64.zip

results in:

Archive: linux-x64.zip
End-of-central-directory signature not found. Either this file is not a zipfile, or it constitutes one disk of a multi-part archive. In the latter case the central directory and zipfile comment will be found on the last disk(s) of this archive.
unzip: cannot find zipfile directory in one of linux-x64.zip or linuz-x64.zip.zip, and cannot find linux-x64.zip.ZIP, period.

I thought the period. was a nice touch at the end.

@whoabuddy
Copy link
Contributor

Link to "latest" release will always be:

https://github.com/blockstack/stacks-blockchain/releases/latest/download/linux-x64.zip

Testing with v23.0.0.3-krypton release from Linux Mint, able to extract via built-in file manager menu option Extract Here and using the command-line unzip utility.

Testing with same release from Ubuntu Server, turns out curl is downloading a 163 byte file rather than the actual zip file. Add option -L to get the correct file and unzip works as expected.

Time to implement this in a new version of the script!

@whoabuddy
Copy link
Contributor

Per GH documentation we can grab the latest release info via the API, which includes some info that might help prevent multiple downloads of the same version.

Example:

curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/blockstack/stacks-blockchain/releases/latest | jq .name

output: Release v23.0.0.3-krypton

Other notable fields:

  • tag_name = v23.0.0.3-krypton
  • created_at = 2020-10-06T14:47:50Z

Assets are available via the json as well, but each contains an ID and it may be easier to just use the URL listed in the previous comment. For example:

  • assets.name = linux-arm64.zip
  • assets.url = https://api.github.com/repos/blockstack/stacks-blockchain/releases/assets/26615114

@whoabuddy
Copy link
Contributor

First pass, seems to be working!

  1. unzip linux-x64.zip
  2. check for nvm, node, rustc and source env vars
  3. npx blockstack-cli (bundled version doesn't create same info with generate-sk --testnet, may be releated to Review stacks-gen for key generation #34)
  4. request BTC from faucet
  5. download krypton-miner-conf.toml from repo
  6. replace private key in krypton-miner-conf.toml
  7. start miner with:
    ./stacks-node start --config=krypton-miner-conf.toml

Per the last comment, storing/comparing tag_name and created_at would be a nice first step, followed by using the binary versus building the code.

Debug could still have an option to build the code from stacks-blockchain via #27 or similar.

@whoabuddy
Copy link
Contributor

Download could apply to Mac or Linux

Windows could use a separate batch script?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants