Merge pull request #1 from braydonf/binary-distribution
Download and upload binary distribution.
This commit is contained in:
commit
e378d544cd
19
README.md
19
README.md
|
@ -32,12 +32,6 @@ If Node.js v0.12 isn't installed, it can be installed using "nvm", it can be don
|
|||
nvm install v0.12
|
||||
```
|
||||
|
||||
Install node-pre-gyp to allow you to get the binaries for bindings or to build the objects from source:
|
||||
|
||||
```bash
|
||||
npm install node-pre-gyp -g
|
||||
```
|
||||
|
||||
To build Bitcoin Core and bindings development packages are needed:
|
||||
|
||||
```bash
|
||||
|
@ -85,12 +79,6 @@ If Node.js v0.12 and associated commands "node", "npm" and "nvm" are not already
|
|||
nvm install v0.12
|
||||
```
|
||||
|
||||
Install node-pre-gyp to allow you to get the binaries for bindings or to build the objects from source:
|
||||
|
||||
```bash
|
||||
npm install node-pre-gyp -g
|
||||
```
|
||||
|
||||
Clone the bitcore-node repository locally:
|
||||
|
||||
```bash
|
||||
|
@ -123,8 +111,7 @@ To run tests against the bindings, as defined in `bindings.gyp` the regtest feat
|
|||
|
||||
```bash
|
||||
export BITCORENODE_ENV=test
|
||||
node-pre-gyp clean
|
||||
npm install
|
||||
npm run build
|
||||
```
|
||||
|
||||
If you do not already have mocha installed:
|
||||
|
@ -142,9 +129,11 @@ mocha -R spec integration/regtest.js
|
|||
If any changes have been made to the bindings in the "src" directory, manually compile the Node.js bindings, as defined in `bindings.gyp`, you can run (-d for debug):
|
||||
|
||||
```bash
|
||||
$ node-pre-gyp -d rebuild
|
||||
$ node-gyp -d rebuild
|
||||
```
|
||||
|
||||
Note: `node-gyp` can be installed with `npm install node-gyp -g`
|
||||
|
||||
To be able to debug you'll need to have `gdb` and `node` compiled for debugging with gdb using `--gdb` (sometimes called node_g), and you can then run:
|
||||
|
||||
```bash
|
||||
|
|
24
RELEASE.md
24
RELEASE.md
|
@ -1,30 +1,34 @@
|
|||
## Release Notes
|
||||
## Release Process
|
||||
|
||||
Binaries for the C++ binding file (which includes libbitcoind statically linked in) are distributed with the help of node-pre-gyp. Node-pre-gyp publishes pre-built binaries to S3 for later download and installation. Source files can also be built if binaries are not desired.
|
||||
Binaries for the C++ binding file (which includes libbitcoind statically linked in) are distributed for convenience. The binary binding file `bitcoind.node` is published to S3 for later download and installation. Source files can also be built if binaries are not desired.
|
||||
|
||||
## How to release
|
||||
### How to Release
|
||||
|
||||
Ensure you've followed the instructions in the README.md for building the project from source. You will be using the node-pre-gyp to package and publish the project to S3. You will also need credentials for Bitpay's bitcore-node S3 bucket and be listed as an author for the bitcore-node's npm module.
|
||||
Ensure you've followed the instructions in the README.md for building the project from source. You will be using the node-gyp to build buildings and a script upload the binary to S3. You will also need credentials for BitPay's bitcore-node S3 bucket and be listed as an author for the bitcore-node's npm module.
|
||||
|
||||
- Create a file, ".node_pre_gyprc" in your home directory
|
||||
- Create a file `.bitcore-node-upload.json` in your home directory
|
||||
- The format of this file should be:
|
||||
|
||||
|
||||
```json
|
||||
{
|
||||
"region": "us-east-1",
|
||||
"accessKeyId": "xxx",
|
||||
"secretAccessKey": "yyy"
|
||||
}
|
||||
```
|
||||
|
||||
- then run the commands to push binaries corresponding to the version in package.json to S3 and npm
|
||||
To make a release, bump the version of the package.json:
|
||||
|
||||
```bash
|
||||
git commit -a -m "Bump package version to <version>"
|
||||
npm install
|
||||
node-pre-gyp package publish
|
||||
npm run upload
|
||||
npm publish
|
||||
```
|
||||
|
||||
|
||||
|
||||
And then update the version of the package.json for development (e.g. "0.3.2-dev"):
|
||||
|
||||
```bash
|
||||
git commit -a -m "Bump development version to <version>"
|
||||
git push upstream master
|
||||
```
|
||||
|
|
|
@ -148,3 +148,16 @@ apply the current patch from "${root_dir}"/etc/bitcoin.patch? (y/N): "
|
|||
else
|
||||
echo 'Using existing static library.'
|
||||
fi
|
||||
|
||||
# Building the Bindings
|
||||
|
||||
set -e
|
||||
|
||||
cd "${root_dir}"
|
||||
|
||||
debug=
|
||||
if test x"$1" = x'debug'; then
|
||||
debug=--debug
|
||||
fi
|
||||
|
||||
node-gyp ${debug} rebuild
|
|
@ -1,14 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.."
|
||||
cd "${root_dir}"
|
||||
|
||||
debug=
|
||||
if test x"$1" = x'debug'; then
|
||||
debug=--debug
|
||||
fi
|
||||
|
||||
node-pre-gyp ${debug} rebuild --fallback-to-build
|
||||
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
'use strict';
|
||||
|
||||
var bindings = require('bindings');
|
||||
var packageRoot = bindings.getRoot(bindings.getFileName());
|
||||
var version = require(packageRoot + '/package.json').version;
|
||||
var platform = process.platform;
|
||||
var arch = process.arch;
|
||||
var tarballName = 'libbitcoind-' + version + '-' + platform + '-' + arch + '.tgz';
|
||||
|
||||
if (require.main === module) {
|
||||
process.stdout.write(tarballName);
|
||||
}
|
|
@ -0,0 +1,22 @@
|
|||
#!/bin/bash
|
||||
|
||||
root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/.."
|
||||
|
||||
cd "${root_dir}"
|
||||
|
||||
tarball_name=`node bin/get-tarball-name.js`
|
||||
bucket_name="bitcore-node"
|
||||
binary_url="https://${bucket_name}.s3.amazonaws.com/${tarball_name}"
|
||||
|
||||
echo "Downloading binary: ${binary_url}"
|
||||
|
||||
wget -N $binary_url
|
||||
|
||||
if test -e "${tarball_name}"; then
|
||||
echo "Unpacking binary distribution"
|
||||
tar -xvzf $tarball_name
|
||||
exit 0;
|
||||
else
|
||||
echo "Prebuild binary could not be downloaded, building from source..."
|
||||
./bin/build
|
||||
fi
|
|
@ -0,0 +1,77 @@
|
|||
'use strict';
|
||||
|
||||
var fs = require('fs');
|
||||
var chainlib = require('chainlib');
|
||||
var log = chainlib.log;
|
||||
var AWS = require('aws-sdk');
|
||||
|
||||
var config = require(process.env.HOME + '/.bitcore-node-upload.json');
|
||||
|
||||
AWS.config.region = config.region;
|
||||
AWS.config.update({
|
||||
accessKeyId: config.accessKeyId,
|
||||
secretAccessKey: config.secretAccessKey
|
||||
});
|
||||
|
||||
var bindings = require('bindings');
|
||||
var packageRoot = bindings.getRoot(bindings.getFileName());
|
||||
var binaryPath = bindings({
|
||||
path: true,
|
||||
bindings: 'bitcoind.node'
|
||||
});
|
||||
|
||||
var relativeBinaryPath = binaryPath.replace(packageRoot + '/', '');
|
||||
var exec = require('child_process').exec;
|
||||
var version = require(packageRoot + '/package.json').version;
|
||||
var platform = process.platform;
|
||||
var arch = process.arch;
|
||||
var tarballName = 'libbitcoind-' + version + '-' + platform + '-' + arch + '.tgz';
|
||||
var bucketName = 'bitcore-node';
|
||||
var url = 'https://' + bucketName + '.s3.amazonaws.com/' + tarballName;
|
||||
|
||||
var child = exec('tar -C ' + packageRoot + ' -cvzf ' + tarballName + ' ' + relativeBinaryPath,
|
||||
function (error, stdout, stderr) {
|
||||
|
||||
if (error) {
|
||||
throw error;
|
||||
}
|
||||
|
||||
if (stdout) {
|
||||
log.info('Tar:', stdout);
|
||||
}
|
||||
|
||||
if (stderr) {
|
||||
log.error(stderr);
|
||||
}
|
||||
|
||||
var fileStream = fs.createReadStream(packageRoot + '/' + tarballName);
|
||||
|
||||
fileStream.on('error', function(err) {
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
});
|
||||
|
||||
fileStream.on('open', function() {
|
||||
|
||||
var s3 = new AWS.S3();
|
||||
|
||||
var params = {
|
||||
ACL: 'public-read',
|
||||
Key: tarballName,
|
||||
Body: fileStream,
|
||||
Bucket: bucketName
|
||||
};
|
||||
|
||||
s3.putObject(params, function(err, data) {
|
||||
if (err) {
|
||||
throw err;
|
||||
} else {
|
||||
log.info('Successfully uploaded to: ' + url);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
);
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"targets": [
|
||||
{
|
||||
"target_name": "<(module_name)",
|
||||
"target_name": "libbitcoind",
|
||||
"include_dirs" : [
|
||||
"<!(node -e \"require('nan')\")",
|
||||
"<!(./bin/variables.sh cache_dir)/src",
|
||||
|
@ -48,17 +48,6 @@
|
|||
"<!(./bin/variables.sh load_archive)"
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"target_name": "action_after_build",
|
||||
"type": "none",
|
||||
"dependencies": [ "<(module_name)" ],
|
||||
"copies": [
|
||||
{
|
||||
"files": [ "<(PRODUCT_DIR)/<(module_name).node" ],
|
||||
"destination": "<(module_path)"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
'use strict';
|
||||
|
||||
var EventEmitter = require('events').EventEmitter;
|
||||
var binary = require('node-pre-gyp');
|
||||
var path = require('path');
|
||||
var binding_path = binary.find(path.resolve(path.join(__dirname,'../package.json')));
|
||||
var bitcoind = require(binding_path);
|
||||
var util = require('util');
|
||||
var bitcore = require('bitcore');
|
||||
var bitcoind = require('bindings')('bitcoind.node');
|
||||
var chainlib = require('chainlib');
|
||||
var log = chainlib.log;
|
||||
var util = require('util');
|
||||
var bitcore = require('bitcore');
|
||||
var $ = bitcore.util.preconditions;
|
||||
|
||||
function Daemon(options) {
|
||||
|
|
19
package.json
19
package.json
|
@ -2,7 +2,7 @@
|
|||
"name": "bitcore-node",
|
||||
"description": "Full node with extended capabilities using Bitcore and Bitcoin Core",
|
||||
"author": "BitPay <dev@bitpay.com>",
|
||||
"version": "0.2.0",
|
||||
"version": "0.2.0-dev",
|
||||
"main": "./index.js",
|
||||
"repository": "git://github.com/bitpay/bitcore-node.git",
|
||||
"homepage": "https://github.com/bitpay/bitcore-node.js",
|
||||
|
@ -27,10 +27,11 @@
|
|||
}
|
||||
],
|
||||
"scripts": {
|
||||
"preinstall": "./bin/build-libbitcoind",
|
||||
"install": "./bin/build-bindings",
|
||||
"start": "node bin/start.js",
|
||||
"install": "./bin/install",
|
||||
"build": "./bin/build",
|
||||
"clean": "./bin/clean",
|
||||
"upload": "node bin/upload.js",
|
||||
"start": "node bin/start.js",
|
||||
"test": "NODE_ENV=test mocha --recursive",
|
||||
"coverage": "istanbul cover _mocha -- --recursive",
|
||||
"libbitcoind": "node bin/start-libbitcoind.js"
|
||||
|
@ -40,8 +41,8 @@
|
|||
"bitcoind"
|
||||
],
|
||||
"dependencies": {
|
||||
"node-pre-gyp": "0.5.x",
|
||||
"async": "1.3.0",
|
||||
"bindings": "^1.2.1",
|
||||
"bitcore": "^0.12.15",
|
||||
"chainlib": "^0.1.1",
|
||||
"errno": "^0.1.2",
|
||||
|
@ -60,13 +61,5 @@
|
|||
"proxyquire": "^1.3.1",
|
||||
"rimraf": "^2.4.2",
|
||||
"sinon": "^1.15.4"
|
||||
},
|
||||
"bundledDependencies": ["node-pre-gyp"],
|
||||
"binary": {
|
||||
"module_name" : "bitcoind",
|
||||
"module_path" : "./build/{configuration}/{node_abi}-{platform}-{arch}/",
|
||||
"remote_path" : "./{module_name}/v{version}/{configuration}/",
|
||||
"package_name": "{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz",
|
||||
"host" : "https://bitcore-node.s3-us-west-2.amazonaws.com"
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue