Download and upload binary distribution.
This commit is contained in:
parent
c8f3cbe390
commit
e4c42fa6cb
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
|
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:
|
To build Bitcoin Core and bindings development packages are needed:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
@ -85,12 +79,6 @@ If Node.js v0.12 and associated commands "node", "npm" and "nvm" are not already
|
||||||
nvm install v0.12
|
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:
|
Clone the bitcore-node repository locally:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
@ -123,8 +111,7 @@ To run tests against the bindings, as defined in `bindings.gyp` the regtest feat
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export BITCORENODE_ENV=test
|
export BITCORENODE_ENV=test
|
||||||
node-pre-gyp clean
|
npm run build
|
||||||
npm install
|
|
||||||
```
|
```
|
||||||
|
|
||||||
If you do not already have mocha installed:
|
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):
|
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
|
```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:
|
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
|
```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:
|
- The format of this file should be:
|
||||||
|
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
|
"region": "us-east-1",
|
||||||
"accessKeyId": "xxx",
|
"accessKeyId": "xxx",
|
||||||
"secretAccessKey": "yyy"
|
"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
|
```bash
|
||||||
|
git commit -a -m "Bump package version to <version>"
|
||||||
npm install
|
npm install
|
||||||
node-pre-gyp package publish
|
npm run upload
|
||||||
npm publish
|
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
|
else
|
||||||
echo 'Using existing static library.'
|
echo 'Using existing static library.'
|
||||||
fi
|
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": [
|
"targets": [
|
||||||
{
|
{
|
||||||
"target_name": "<(module_name)",
|
"target_name": "libbitcoind",
|
||||||
"include_dirs" : [
|
"include_dirs" : [
|
||||||
"<!(node -e \"require('nan')\")",
|
"<!(node -e \"require('nan')\")",
|
||||||
"<!(./bin/variables.sh cache_dir)/src",
|
"<!(./bin/variables.sh cache_dir)/src",
|
||||||
|
@ -48,17 +48,6 @@
|
||||||
"<!(./bin/variables.sh load_archive)"
|
"<!(./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';
|
'use strict';
|
||||||
|
|
||||||
var EventEmitter = require('events').EventEmitter;
|
var EventEmitter = require('events').EventEmitter;
|
||||||
var binary = require('node-pre-gyp');
|
var bitcoind = require('bindings')('bitcoind.node');
|
||||||
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 chainlib = require('chainlib');
|
var chainlib = require('chainlib');
|
||||||
var log = chainlib.log;
|
var log = chainlib.log;
|
||||||
|
var util = require('util');
|
||||||
|
var bitcore = require('bitcore');
|
||||||
var $ = bitcore.util.preconditions;
|
var $ = bitcore.util.preconditions;
|
||||||
|
|
||||||
function Daemon(options) {
|
function Daemon(options) {
|
||||||
|
|
19
package.json
19
package.json
|
@ -2,7 +2,7 @@
|
||||||
"name": "bitcore-node",
|
"name": "bitcore-node",
|
||||||
"description": "Full node with extended capabilities using Bitcore and Bitcoin Core",
|
"description": "Full node with extended capabilities using Bitcore and Bitcoin Core",
|
||||||
"author": "BitPay <dev@bitpay.com>",
|
"author": "BitPay <dev@bitpay.com>",
|
||||||
"version": "0.2.0",
|
"version": "0.2.0-dev",
|
||||||
"main": "./index.js",
|
"main": "./index.js",
|
||||||
"repository": "git://github.com/bitpay/bitcore-node.git",
|
"repository": "git://github.com/bitpay/bitcore-node.git",
|
||||||
"homepage": "https://github.com/bitpay/bitcore-node.js",
|
"homepage": "https://github.com/bitpay/bitcore-node.js",
|
||||||
|
@ -27,10 +27,11 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"preinstall": "./bin/build-libbitcoind",
|
"install": "./bin/install",
|
||||||
"install": "./bin/build-bindings",
|
"build": "./bin/build",
|
||||||
"start": "node bin/start.js",
|
|
||||||
"clean": "./bin/clean",
|
"clean": "./bin/clean",
|
||||||
|
"upload": "node bin/upload.js",
|
||||||
|
"start": "node bin/start.js",
|
||||||
"test": "NODE_ENV=test mocha --recursive",
|
"test": "NODE_ENV=test mocha --recursive",
|
||||||
"coverage": "istanbul cover _mocha -- --recursive",
|
"coverage": "istanbul cover _mocha -- --recursive",
|
||||||
"libbitcoind": "node bin/start-libbitcoind.js"
|
"libbitcoind": "node bin/start-libbitcoind.js"
|
||||||
|
@ -40,8 +41,8 @@
|
||||||
"bitcoind"
|
"bitcoind"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"node-pre-gyp": "0.5.x",
|
|
||||||
"async": "1.3.0",
|
"async": "1.3.0",
|
||||||
|
"bindings": "^1.2.1",
|
||||||
"bitcore": "^0.12.15",
|
"bitcore": "^0.12.15",
|
||||||
"chainlib": "^0.1.1",
|
"chainlib": "^0.1.1",
|
||||||
"errno": "^0.1.2",
|
"errno": "^0.1.2",
|
||||||
|
@ -60,13 +61,5 @@
|
||||||
"proxyquire": "^1.3.1",
|
"proxyquire": "^1.3.1",
|
||||||
"rimraf": "^2.4.2",
|
"rimraf": "^2.4.2",
|
||||||
"sinon": "^1.15.4"
|
"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