Browse Source

docs: fix command sample codes

friedger-patch-1
Alexander Graebe 4 years ago
committed by Alexander Graebe
parent
commit
d9072c0206
  1. 4
      README.md
  2. 2
      src/pages/authentication/building-todo-app.md
  3. 5
      src/pages/data-storage/collections.md
  4. 10
      src/pages/data-storage/integrate-indexing.md
  5. 10
      src/pages/data-storage/storage-write-read.md
  6. 9
      src/pages/ecosystem/contributing.md
  7. 15
      src/pages/storage-hubs/amazon-ec2-deploy.md
  8. 77
      src/pages/storage-hubs/gaia-admin.md
  9. 9
      src/pages/understand-stacks/command-line-interface.md
  10. 20
      src/pages/understand-stacks/installing-memcached.md
  11. 6
      src/pages/write-smart-contracts/install-source.md

4
README.md

@ -18,8 +18,8 @@ The `src/_data/cli-reference.json` file is generated from the `stx` subcommand `
2. Generate the json for the cli in the `docs.blockstack` repo. 2. Generate the json for the cli in the `docs.blockstack` repo.
``` ```bash
$ stx docs > src/_data/cli-reference.json stx docs > src/_data/cli-reference.json
``` ```
### Clarity Reference ### Clarity Reference

2
src/pages/authentication/building-todo-app.md

@ -45,7 +45,7 @@ npm install
### Step 2: Run the application: ### Step 2: Run the application:
```bash ```bash
$ npm run start npm run start
``` ```
You should see output similar to the following: You should see output similar to the following:

5
src/pages/data-storage/collections.md

@ -66,7 +66,10 @@ The tutorial relies on the `npm` dependency manager. Before you begin, verify
you have installed `npm` using the `which` command to verify. you have installed `npm` using the `which` command to verify.
```bash ```bash
$ which npm which npm
```
```bash
/usr/local/bin/npm /usr/local/bin/npm
``` ```

10
src/pages/data-storage/integrate-indexing.md

@ -67,7 +67,10 @@ the database name.
#### Step 2: Start the `radiks-server` in the command line to confirm your installation. #### Step 2: Start the `radiks-server` in the command line to confirm your installation.
```bash ```bash
$ radiks-server radiks-server
```
```bash
(node:37750) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option `useUnifiedTopology: true` to the MongoClient constructor. (node:37750) DeprecationWarning: current Server Discovery and Monitoring engine is deprecated and will be removed in a future version. To use the new Server Discover and Monitoring engine, pass option `useUnifiedTopology: true` to the MongoClient constructor.
radiks-server is ready on http://localhost:1260 radiks-server is ready on http://localhost:1260
``` ```
@ -106,7 +109,10 @@ yarn add radiks
#### Step 1: Start the mongo shell application. #### Step 1: Start the mongo shell application.
```bash ```bash
$ mongo mongo
```
```bash
MongoDB shell version v4.2.0 MongoDB shell version v4.2.0
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
Implicit session: session `{ "id" : UUID("8d43cf80-490d-4cac-8bd6-40eec5c128de") }` Implicit session: session `{ "id" : UUID("8d43cf80-490d-4cac-8bd6-40eec5c128de") }`

10
src/pages/data-storage/storage-write-read.md

@ -77,14 +77,18 @@ Stacks ID `gavin.id`.
### Step 1: Get the bucket URL ### Step 1: Get the bucket URL
```bash ```bash
$ BUCKET_URL="$(curl -sL https://core.blockstack.org/v1/users/gavin.id | jq -r '."gavin.id"["profile"]["apps"]["https://banter.pub"]')"  BUCKET_URL="$(curl -sL https://core.blockstack.org/v1/users/gavin.id | jq -r '."gavin.id"["profile"]["apps"]["https://banter.pub"]')" 
$ echo "$BUCKET_URL"  https://gaia.blockstack.org/hub/16E485MVpR3QpmjVkRgej7ya2Vnzu3jyTR/ echo "$BUCKET_URL"  https://gaia.blockstack.org/hub/16E485MVpR3QpmjVkRgej7ya2Vnzu3jyTR/
``` ```
### Step 2: Get the data ### Step 2: Get the data
```bash ```bash
$ curl -sL "${BUCKET_URL%%/}/Message/3e866af471d0-4072-beba-06ad1e7ad4bd"  {"content":"Anyone here?","votes":[],"createdBy":"gavin.id",...} curl -sL "${BUCKET_URL%%/}/Message/3e866af471d0-4072-beba-06ad1e7ad4bd"
```
```bash
{"content":"Anyone here?","votes":[],"createdBy":"gavin.id",...}
``` ```
This data is public and unencrypted. The same works for encrypted data. Only the holder of the private key used for encryption would be able to decrypt the data. This data is public and unencrypted. The same works for encrypted data. Only the holder of the private key used for encryption would be able to decrypt the data.

9
src/pages/ecosystem/contributing.md

@ -64,10 +64,13 @@ Once you have the project on your computer and the dependencies have been instal
`yarn dev` and it should give you a message such as: `yarn dev` and it should give you a message such as:
```bash ```bash
➜ docs.blockstack git:(feat/my-helpful-contribution) ✗ yarn dev yarn dev
```
```bash
yarn run v1.22.4 yarn run v1.22.4
$ yarn clean:build-files && next dev yarn clean:build-files && next dev
$ rimraf .next rimraf .next
ready - started server on http://localhost:3000 ready - started server on http://localhost:3000
warn - You have enabled experimental feature(s). warn - You have enabled experimental feature(s).
warn - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use them at your own risk. warn - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use them at your own risk.

15
src/pages/storage-hubs/amazon-ec2-deploy.md

@ -29,7 +29,10 @@ Finally, setting up the SSL certificates on your EC2 instance requires you to us
command line on your workstation. Make sure you have the `watch` command installed using the `which` command. command line on your workstation. Make sure you have the `watch` command installed using the `which` command.
```bash ```bash
$ which watch which watch
```
```bash
/usr/local/bin/watch /usr/local/bin/watch
``` ```
@ -370,7 +373,10 @@ ssh -t -i <your keyfile.pem> core@<public ip address>
Your EC2 instance is running several `docker` services that support the Gaia hub. You can list these services using the `docker ps` command. Your EC2 instance is running several `docker` services that support the Gaia hub. You can list these services using the `docker ps` command.
```bash ```bash
$ docker ps --format "table {{.ID}}\t{{.Image}}\t{{.Command}}\t{{.Names}}" docker ps --format "table {{.ID}}\t{{.Image}}\t{{.Command}}\t{{.Names}}"
```
```bash
CONTAINER ID IMAGE COMMAND NAMES CONTAINER ID IMAGE COMMAND NAMES
6b170ce9b0d6 nginx:alpine "nginx -g 'daemon of…" nginx 6b170ce9b0d6 nginx:alpine "nginx -g 'daemon of…" nginx
91c5ff651586 quay.io/blockstack/gaia-hub:v2.5.3 "docker-entrypoint.s…" gaia-hub 91c5ff651586 quay.io/blockstack/gaia-hub:v2.5.3 "docker-entrypoint.s…" gaia-hub
@ -472,8 +478,11 @@ Each service plays a particular role in running your Gaia hub.
You can `cat` the various services to see what settings they are using. You can `cat` the various services to see what settings they are using.
```bash
cat /etc/systemd/system/reset-ssl-certs.service
``` ```
$ cat /etc/systemd/system/reset-ssl-certs.service
```yaml
# reset-ssl-certs.service # reset-ssl-certs.service
[Unit] [Unit]
Description=Reset Gaia to first boot Description=Reset Gaia to first boot

77
src/pages/storage-hubs/gaia-admin.md

@ -99,9 +99,12 @@ changes will only take effect when the Gaia hub is reloaded. You can do this
as follows: as follows:
```bash ```bash
$ export API_KEY="hello" export API_KEY="hello"
$ curl -H "Authorization: bearer $API_KEY" -X POST http://localhost:8009/v1/admin/reload curl -H "Authorization: bearer $API_KEY" -X POST http://localhost:8009/v1/admin/reload
{"result":"OK"} ```
```json
{ "result": "OK" }
``` ```
When you `POST` to this endpoint, the admin service runs the command described When you `POST` to this endpoint, the admin service runs the command described
@ -127,8 +130,12 @@ settings.
To read the Gaia hub settings, you would run the following: To read the Gaia hub settings, you would run the following:
```bash ```bash
$ export API_KEY="hello" export API_KEY="hello"
$ curl -H "Authorization: bearer $API_KEY" http://localhost:8009/v1/admin/config {"config":{"port":4000,"proofsConfig":{"proofsRequired":0}}} curl -H "Authorization: bearer $API_KEY" http://localhost:8009/v1/admin/config
```
```json
{ "config": { "port": 4000, "proofsConfig": { "proofsRequired": 0 } } }
``` ```
### Set the hub configuration (`POST /v1/admin/config`) ### Set the hub configuration (`POST /v1/admin/config`)
@ -137,9 +144,12 @@ To set Gaia hub settings, you simply `POST` the changed JSON fields to this
endpoint. endpoint.
```bash ```bash
$ export API_KEY="hello" export API_KEY="hello"
$ curl -H "Authorization: bearer $API_KEY" -H 'Content-Type: application/json' -X POST --data-raw '{"port": 3001}' http://localhost:8009/v1/admin/config curl -H "Authorization: bearer $API_KEY" -H 'Content-Type: application/json' -X POST --data-raw '{"port": 3001}' http://localhost:8009/v1/admin/config
{"message":"Config updated -- you should reload your Gaia hub now."} ```
```json
{ "message": "Config updated -- you should reload your Gaia hub now." }
``` ```
If the settings were successfully applied, the method returns a message to reload your Gaia hub. You can set multiple drivers' settings with a single call. For example, you can set: If the settings were successfully applied, the method returns a message to reload your Gaia hub. You can set multiple drivers' settings with a single call. For example, you can set:
@ -217,19 +227,32 @@ values, you get an HTTP 400 error.
Use the `/v1/admin/config` endpoint to read and write storage driver settings. To get the current driver settings, you would run: Use the `/v1/admin/config` endpoint to read and write storage driver settings. To get the current driver settings, you would run:
```bash ```bash
$ export API_KEY="hello" export API_KEY="hello"
$ curl -H "Authorization: bearer $API_KEY" http://localhost:8009/v1/admin/config curl -H "Authorization: bearer $API_KEY" http://localhost:8009/v1/admin/config
{"config":{"driver":"disk","readURL":"http://localhost:4001/","pageSize":20,"diskSettings":{"storageRootDirectory":"/tmp/gaia-disk"}}} ```
```json
{
"config": {
"driver": "disk",
"readURL": "http://localhost:4001/",
"pageSize": 20,
"diskSettings": { "storageRootDirectory": "/tmp/gaia-disk" }
}
}
``` ```
To update the driver settings, you would run: To update the driver settings, you would run:
```bash ```bash
$ export API_KEY="hello" export API_KEY="hello"
$ export AWS_ACCESS_KEY="<hidden>" export AWS_ACCESS_KEY="<hidden>"
$ export AWS_SECRET_KEY="<hidden>" export AWS_SECRET_KEY="<hidden>"
$ curl -H "Authorization: bearer $API_KEY" -H 'Content-Type: application/json' -X POST --data-raw "{\"driver\": \"aws\", \"awsCredentials\": {\"accessKeyId\": \"$AWS_ACCESS_KEY\", \"secretAccessKey\": \"$AWS_SECRET_KEY\"}}" http://localhost:8009/v1/admin/config curl -H "Authorization: bearer $API_KEY" -H 'Content-Type: application/json' -X POST --data-raw "{\"driver\": \"aws\", \"awsCredentials\": {\"accessKeyId\": \"$AWS_ACCESS_KEY\", \"secretAccessKey\": \"$AWS_SECRET_KEY\"}}" http://localhost:8009/v1/admin/config
{"message":"Config updated -- you should reload your Gaia hub now."} ```
```json
{ "message": "Config updated -- you should reload your Gaia hub now." }
``` ```
## Example: Read and write the whitelist ## Example: Read and write the whitelist
@ -239,26 +262,34 @@ This endpoint lets you read and write the `whitelist` section of a Gaia hub, to
To get the current whitelist, you would run the following: To get the current whitelist, you would run the following:
```bash ```bash
$ export API_KEY="hello" export API_KEY="hello"
$ curl -H "Authorization: bearer $API_KEY" http://localhost:8009/v1/admin/config curl -H "Authorization: bearer $API_KEY" http://localhost:8009/v1/admin/config
{"config":{"whitelist":["15hUKXg1URbQsmaEHKFV2vP9kCeCsT8gUu"]}} ```
```json
{ "config": { "whitelist": ["15hUKXg1URbQsmaEHKFV2vP9kCeCsT8gUu"] } }
``` ```
To set the whitelist, you must set the _entire_ whitelist. To set the list, pass a command such as the following: To set the whitelist, you must set the _entire_ whitelist. To set the list, pass a command such as the following:
```bash ```bash
$ export API_KEY="hello" export API_KEY="hello"
$ curl -H "Authorization: bearer $API_KEY" -H 'Content-Type: application/json' -X POST --data-raw '{"whitelist": ["1KDcaHsYJqD7pwHtpDn6sujCVQCY2e1ktw", "15hUKXg1URbQsmaEHKFV2vP9kCeCsT8gUu"]}' http://localhost:8009/v1/admin/config curl -H "Authorization: bearer $API_KEY" -H 'Content-Type: application/json' -X POST --data-raw '{"whitelist": ["1KDcaHsYJqD7pwHtpDn6sujCVQCY2e1ktw", "15hUKXg1URbQsmaEHKFV2vP9kCeCsT8gUu"]}' http://localhost:8009/v1/admin/config
{"message":"Config updated -- you should reload your Gaia hub now."} ```
```json
{ "message": "Config updated -- you should reload your Gaia hub now." }
``` ```
## View logs for the hub or admin service ## View logs for the hub or admin service
The logs for each Gaia service are maintained by their respective Docker containers. To view the log for a particular service, use the `docker logs` command. For example, to get the logs for the hub: The logs for each Gaia service are maintained by their respective Docker containers. To view the log for a particular service, use the `docker logs` command. For example, to get the logs for the hub:
```bash
docker logs docker_hub_1
``` ```
$ docker logs docker_hub_1
```bash
> gaia-hub@2.3.4 start /src/hub > gaia-hub@2.3.4 start /src/hub
> npm run build && node lib/index.js > npm run build && node lib/index.js

9
src/pages/understand-stacks/command-line-interface.md

@ -104,13 +104,14 @@ In order to send tokens, the CLI command requires 5 parameters:
The CLI command to use with these parameters is `send_tokens`: The CLI command to use with these parameters is `send_tokens`:
```bash ```bash
$ stx send_tokens ST2KMMVJAB00W5Z6XWTFPH6B13JE9RJ2DCSHYX0S7 1000 200 0 381314da39a45f43f45ffd33b5d8767d1a38db0da71fea50ed9508e048765cf301 -t stx send_tokens ST2KMMVJAB00W5Z6XWTFPH6B13JE9RJ2DCSHYX0S7 1000 200 0 381314da39a45f43f45ffd33b5d8767d1a38db0da71fea50ed9508e048765cf301 -t
```
```json
{ {
txid: '0xd32de0d66b4a07e0d7eeca320c37a10111c8c703315e79e17df76de6950c622c', "txid": "0xd32de0d66b4a07e0d7eeca320c37a10111c8c703315e79e17df76de6950c622c",
transaction: 'https://testnet-explorer.blockstack.org/txid/0xd32de0d66b4a07e0d7eeca320c37a10111c8c703315e79e17df76de6950c622c' "transaction": "https://testnet-explorer.blockstack.org/txid/0xd32de0d66b4a07e0d7eeca320c37a10111c8c703315e79e17df76de6950c622c"
} }
``` ```
With this command we’re sending 1000 microstacks to the Stacks address `ST2KMMVJAB00W5Z6XWTFPH6B13JE9RJ2DCSHYX0S7`. With this command we’re sending 1000 microstacks to the Stacks address `ST2KMMVJAB00W5Z6XWTFPH6B13JE9RJ2DCSHYX0S7`.

20
src/pages/understand-stacks/installing-memcached.md

@ -10,8 +10,8 @@ running locally.
### Memcached on Debian & Ubuntu: ### Memcached on Debian & Ubuntu:
```bash ```bash
$ sudo apt-get install -y python-dev libmemcached-dev zlib1g-dev sudo apt-get install -y python-dev libmemcached-dev zlib1g-dev
$ pip install pylibmc pip install pylibmc
``` ```
### Memcached on macOS: ### Memcached on macOS:
@ -21,16 +21,16 @@ Easiest way to install memcached on macOS is by using [Homebrew](https://brew.sh
After installing Homebrew: After installing Homebrew:
```bash ```bash
$ brew install memcached brew install memcached
$ brew install libmemcached brew install libmemcached
$ pip install pylibmc --install-option="--with-libmemcached=/usr/local/Cellar/libmemcached/1.0.18_1/" pip install pylibmc --install-option="--with-libmemcached=/usr/local/Cellar/libmemcached/1.0.18_1/"
``` ```
After installing, you can start memcached and check if it's running properly: After installing, you can start memcached and check if it's running properly:
```bash ```bash
$ memcached -d memcached -d
$ echo stats | nc localhost 11211 echo stats | nc localhost 11211
``` ```
### Memcached on Heroku ### Memcached on Heroku
@ -38,7 +38,7 @@ $ echo stats | nc localhost 11211
To deploy on Heroku: To deploy on Heroku:
```bash ```bash
$ heroku create heroku create
$ heroku addons:add memcachedcloud heroku addons:add memcachedcloud
$ git push heroku master git push heroku master
``` ```

6
src/pages/write-smart-contracts/install-source.md

@ -8,17 +8,17 @@ description: 'Stacks smart contracting language'
Build using `rust` and `cargo`: Build using `rust` and `cargo`:
```bash ```bash
$ cargo build --release cargo build --release
``` ```
Install globally (you may have to run as sudoer): Install globally (you may have to run as sudoer):
```bash ```bash
$ cargo install --path . cargo install --path .
``` ```
You should now be able to run the command: You should now be able to run the command:
```bash ```bash
$ blockstack-core blockstack-core
``` ```

Loading…
Cancel
Save