Merge branch 'master' into bug/342

This commit is contained in:
JR Conlin 2019-12-06 13:34:05 -08:00 committed by GitHub
commit d67c046195
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 39 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

@ -29,6 +29,9 @@ Mozilla Sync Storage built with [Rust](https://rust-lang.org).
- MySQL 5.7 (or compatible)
-\* libmysqlclient (`brew install mysql` on macOS, `apt-get install libmysqlclient-dev` on Ubuntu)
- [Go](https://golang.org/doc/install)
- Cmake
- Pkg-config
- Openssl
Depending on your OS, you may also need to install `libgrpcdev`, and `protobuf-compiler-grpc`.
@ -36,7 +39,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

20
shell.nix Normal file
View File

@ -0,0 +1,20 @@
# Nix is a powerful package manager for Linux and other Unix systems that makes
# package management reliable and reproducible: https://nixos.org/nix/.
# This file is intended to be used with `nix-shell`
# (https://nixos.org/nix/manual/#sec-nix-shell) to setup a fully-functional
# syncstorage-rs build environment by installing all required dependencies.
with import <nixpkgs> {};
stdenv.mkDerivation {
name = "syncstorage-rs";
buildInputs = [
rustc
cargo
libmysqlclient
pkgconfig
openssl
cmake
protobuf
go
];
NIX_LDFLAGS = "-L${libmysqlclient}/lib/mysql";
}

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.

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.