chore: adjust sample script so it works and adding docs to link to it

This commit is contained in:
Rachel Tublitz 2019-12-05 17:04:46 -05:00
parent 4a9f2cedd1
commit 80b0c591f3
No known key found for this signature in database
GPG Key ID: F8120AF20626A87E
8 changed files with 16 additions and 9 deletions

1
.gitignore vendored
View File

@ -34,3 +34,4 @@ service-account.json
config/local.toml
venv

View File

@ -1,2 +1,2 @@
run-local:
run_local:
RUST_LOG=debug RUST_BACKTRACE=1 cargo run -- --config config/local.toml

View File

@ -36,7 +36,7 @@ Depending on your OS, you may also need to install `libgrpcdev`, and `protobuf-c
1. Follow the instructions below to use either MySQL or Spanner as your DB.
2. Now `cp config/local.example.toml config/local.toml`. Open `config/local.toml` and make sure you have the desired settings configured. For a complete list of available configuration options, check out [docs/config.md](docs/config.md).
3. `make run-local` starts the server in debug mode, using your new `local.toml` file for config options. Or, simply `cargo run` with your own config options provided as env vars.
3. `make run_local` starts the server in debug mode, using your new `local.toml` file for config options. Or, simply `cargo run` with your own config options provided as env vars.
4. Visit `http://localhost:8000/__heartbeat__` to make sure the server is running.
### MySQL

View File

@ -1,4 +1,4 @@
database_url = "mysql://sample_user:sample_password@localhost/syncstorage_rs"
master_secret = "some_secret_here"
master_secret = "INSERT_SECRET_KEY_HERE"
# removing this line will default to moz_json formatted logs (which is preferred for production envs)
human_logs = 1

3
tools/examples/README.md Normal file
View File

@ -0,0 +1,3 @@
# Example scripts for working with syncstorage-rs
* `put.bash` - First `chmod +x put.bash` then `./put.bash` to simulate a PUT.

4
tools/poster/post.bash → tools/examples/put.bash Normal file → Executable file
View File

@ -1,7 +1,9 @@
#!/bin/bash
NODE="http://localhost:8000"
URI="/1.5/1/storage/col2/DEADBEEF"
AUTH=`../hawk/venv/bin/python ../hawk/make_hawk_token.py --node $NODE --uri $URI --as_header`
METHOD="PUT"
SYNC_MASTER_SECRET="INSERT_SECRET_KEY_HERE"
AUTH=`../hawk/venv/bin/python ../hawk/make_hawk_token.py --node $NODE --uri $URI --method $METHOD --secret=$SYNC_MASTER_SECRET --as_header`
curl -vv -X PUT "$NODE$URI" \
-H "Authorization: $AUTH" \
-H 'Content-Type: application/json' \

View File

@ -19,6 +19,11 @@ virutal environment.
3) To create a Token Header:
`venv/bin/python make_hawk_token.py`
You'll need to pass along your `SYNC_MASTER_SECRET` and the uri you'll be testing in order to generate a valid Hawk Id:
`venv/bin/python make_hawk_token.py --uri /1.5/1/storage/meta/global --secret=$SYNC_MASTER_SECRET --as_header`
** For testing against uri's using methods other than GET, you'll need to pass along the `--method` flag to generate your token. Ie, `venv/bin/python make_hawk_token.py --method PUT --uri /1.5/1/storage/meta/global --secret=$SYNC_MASTER_SECRET --as_header`. See [examples/put.bash](https://github.com/mozilla-services/syncstorage-rs/blob/master/tools/examples/put.bash) for an example of this.
Use `-h` for help.

View File

@ -1,4 +0,0 @@
# Post a fake BSO to the local server
`post.bash` is a crappy bash script that attempts to post a fake BSO to a local instance of syncserver-rs. It's useful for line testing operations.