mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-06-02 19:40:32 +08:00
Merge pull request #727 from blockstack/develop-jz-api-wrap
Update API development instructions
This commit is contained in:
@@ -6,6 +6,21 @@ In general, all documentation is in the [docs/](https://github.com/blockstack/bl
|
||||
|
||||
Instructions for deploying your own (public) node are [here](https://github.com/blockstack/blockstack-core/tree/master/docs/install-api.md).
|
||||
|
||||
### Running in docker
|
||||
|
||||
This directory contains the necessary components for running this API in docker for development purposes. To do so run the following commands:
|
||||
|
||||
```bash
|
||||
# First run the init steps for each service:
|
||||
$ ./ops init-core
|
||||
$ ./ops init-api
|
||||
$ ./ops init-indexer
|
||||
|
||||
# Then build the docker images and run them
|
||||
# NOTE: this build step takes quite a bit of time
|
||||
$ docker-compose up --build -d
|
||||
```
|
||||
|
||||
### Environment Variables for Deployment
|
||||
|
||||
The following is a list of environmental variables that help configure the API, and their defaults:
|
||||
@@ -43,4 +58,7 @@ SEARCH_NODE_URL=https://search.example.org
|
||||
|
||||
# SEARCH_DEFAULT_LIMIT sets the number of results per call
|
||||
SEARCH_DEFAULT_LIMIT=50
|
||||
|
||||
# BSK_API_TMPLTDIR sets the path to the generated documentation for serving
|
||||
BSK_API_TMPLTDIR=/src/blockstack/api/templates
|
||||
```
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
[blockstack-client]
|
||||
protocol = https
|
||||
protocol = http
|
||||
api_endpoint_host = 0.0.0.0
|
||||
poll_interval = 300
|
||||
api_endpoint_port = 6270
|
||||
api_password = dummywalletpassword
|
||||
metadata = metadata
|
||||
server = node.technofractal.com
|
||||
server = blockstack-core
|
||||
email =
|
||||
api_endpoint_bind = 0.0.0.0
|
||||
blockchain_writer = blockstack_utxo
|
||||
@@ -14,7 +14,7 @@ storage_drivers = disk,http,dht
|
||||
blockchain_reader = blockstack_utxo
|
||||
client_version = 0.17.0.16
|
||||
storage_drivers_required_write = disk,dropbox
|
||||
port = 6263
|
||||
port = 6264
|
||||
anonymous_statistics = True
|
||||
|
||||
[blockchain-reader]
|
||||
|
||||
@@ -9,7 +9,9 @@ services:
|
||||
restart: always
|
||||
|
||||
blockstack-api:
|
||||
image: 'quay.io/blockstack/blockstack-core:master'
|
||||
build:
|
||||
context: ../
|
||||
dockerfile: ../Dockerfile
|
||||
command: blockstack api start-foreground -y --debug --password dummywalletpassword
|
||||
volumes:
|
||||
- './data/blockstack-api:/root/.blockstack'
|
||||
@@ -38,6 +40,7 @@ services:
|
||||
volumes:
|
||||
- "./data/search-api:/var/blockstack-search"
|
||||
- "/etc/localtime:/etc/localtime:ro"
|
||||
- "./deployment/client.ini:/root/.blockstack/client.ini"
|
||||
|
||||
search-api:
|
||||
build:
|
||||
@@ -50,6 +53,7 @@ services:
|
||||
- BSK_API_TMPLTDIR=/src/blockstack/api/templates
|
||||
- DEFAULT_CACHE_TIMEOUT=1800
|
||||
- MONGODB_URI=mongodb://mongodb
|
||||
- BSK_API_TMPLTDIR=/src/blockstack/api/templates
|
||||
- BASE_API_URL=http://blockstack-api:6270
|
||||
- DEBUG=True
|
||||
networks:
|
||||
@@ -62,6 +66,18 @@ services:
|
||||
- blockstack-api
|
||||
volumes:
|
||||
- "./data/search-api:/var/blockstack-search"
|
||||
|
||||
blockstack-core:
|
||||
build:
|
||||
context: ../
|
||||
dockerfile: Dockerfile
|
||||
command: 'blockstack-core start --foreground --debug'
|
||||
volumes:
|
||||
- './blockstack-core/server/:/root/.blockstack-server/'
|
||||
- './blockstack-core/api/:/root/.blockstack/'
|
||||
restart: always
|
||||
networks:
|
||||
- api
|
||||
|
||||
networks:
|
||||
api: null
|
||||
|
||||
21
api/ops
21
api/ops
@@ -2,9 +2,6 @@
|
||||
|
||||
ops () {
|
||||
|
||||
local python=/usr/bin/python
|
||||
local initCore=blockstack-core-init
|
||||
local storageBucket=https://blockstack.blob.core.windows.net/index
|
||||
local image=quay.io/blockstack/blockstack-core
|
||||
local tag=master
|
||||
|
||||
@@ -26,12 +23,27 @@ ops () {
|
||||
cp search/fixtures/blockchain_data.json $idxData/blockchain_data.json
|
||||
cp search/fixtures/profile_data.slice.json $idxData/profile_data.json
|
||||
}
|
||||
|
||||
init-core () {
|
||||
local coreData=data/blockstack-core
|
||||
echo "Initializing Blockstack Core node. This task runs in the background and may take up to 20 minutes..."
|
||||
mkdir -p $coreData/server/
|
||||
cp $(pwd)/deployment/blockstack-server.ini $coreData/server/blockstack-server.ini
|
||||
docker run -d --rm \
|
||||
-v $(pwd)/$coreData/server/:/root/.blockstack-server/ \
|
||||
-v $(pwd)/$coreData/api/:/root/.blockstack \
|
||||
--name blockstack-core-init \
|
||||
$image:$tag \
|
||||
blockstack-core --debug fast_sync http://fast-sync.blockstack.org/snapshot.bsk > /dev/null
|
||||
}
|
||||
|
||||
|
||||
commands () {
|
||||
cat <<-EOF
|
||||
ops commands:
|
||||
init-api -> Set up the dummy wallet for the core api
|
||||
init-indexer -> Set up the bootstrapping data for the indexer
|
||||
init-core -> Set up blockstack-core instance for this API
|
||||
EOF
|
||||
}
|
||||
|
||||
@@ -42,6 +54,9 @@ EOF
|
||||
init-indexer)
|
||||
init-indexer
|
||||
;;
|
||||
init-core)
|
||||
init-core
|
||||
;;
|
||||
*)
|
||||
commands
|
||||
;;
|
||||
|
||||
Reference in New Issue
Block a user