Skip to content

Commit 6dd5ddd

Browse files
authored
Merge branch 'master' into release/0.1.14
2 parents a28aca5 + 770105f commit 6dd5ddd

File tree

5 files changed

+28
-12
lines changed

5 files changed

+28
-12
lines changed

.gitignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ pypy/
2525
./src/
2626
.tox/
2727
.eggs/
28-
autopush_rs/target
29-
autopush_rs/_native*
3028
target
3129
*.rs.bk
3230
.#*

Makefile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44

55
SYNC_DATABASE_URL = 'mysql://sample_user:sample_password@localhost/syncstorage_rs'
66

7+
# This key can live anywhere on your machine. Adjust path as needed.
8+
PATH_TO_SYNC_SPANNER_KEYS = `pwd`/service-account.json
9+
10+
# TODO: replace with rust grpc alternative when ready
11+
# Assumes you've cloned the server-syncstorage repo locally into a peer dir.
12+
# https://github.com/mozilla-services/server-syncstorage
13+
PATH_TO_GRPC_CERT = ../server-syncstorage/local/lib/python2.7/site-packages/grpc/_cython/_credentials/roots.pem
14+
715
clippy:
816
# Matches what's run in circleci
917
cargo clippy --all --all-targets -- -D warnings
@@ -20,5 +28,8 @@ docker_stop:
2028
run:
2129
RUST_LOG=debug RUST_BACKTRACE=full cargo run -- --config config/local.toml
2230

31+
run_spanner:
32+
GOOGLE_APPLICATION_CREDENTIALS=$(PATH_TO_SYNC_SPANNER_KEYS) GRPC_DEFAULT_SSL_ROOTS_FILE_PATH=$(PATH_TO_GRPC_CERT) make run
33+
2334
test:
2435
cd db-tests && SYNC_DATABASE_URL=$(SYNC_DATABASE_URL) RUST_TEST_THREADS=1 cargo test

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ select the correct project.
7171
- Select "_Create Key_" from the pop-up menu.
7272
- Select "JSON" from the Dialog Box.
7373

74-
A proper Key file will be downloaded to your local directory. It's important to safeguard that key file. For this example, we're going to name the file
75-
`sync-spanner.json` and store it in a subdirectory called `./keys`
74+
A proper key file will be downloaded to your local directory. It's important to safeguard that key file. For this example, we're going to name the file
75+
`service-account.json`.
7676

7777
The proper key file is in JSON format. An example file is provided below, with private information replaced by "`...`"
7878

@@ -91,15 +91,15 @@ The proper key file is in JSON format. An example file is provided below, with p
9191
}
9292
```
9393

94-
You can then specify the path to the key file using the environment variable `GOOGLE_APPLICATION_CREDENTIALS` when running the application.
95-
96-
e.g.
94+
Note, that unlike MySQL, there is no automatic migrations facility. Currently Spanner schema must be hand edited and modified.
9795

98-
```bash
99-
RUST_LOG=warn GOOGLE_APPLICATION_CREDENTIALS=`pwd`/keys/sync-spanner.json` cargo run -- --config sync.ini
100-
```
96+
To point to a GCP hosted Spanner instance from your local machine, follow these steps:
10197

102-
Note, that unlike MySQL, there is no automatic migrations facility. Currently Spanner schema must be hand edited and modified.
98+
1. Download the key file as shown above.
99+
2. Open `local.toml` and replace `database_url` with a link to your spanner instance.
100+
3. Open the Makefile and ensure you've correctly set you `PATH_TO_GRPC_CERT`.
101+
4. `make run_spanner`.
102+
5. Visit `http://localhost:8000/__heartbeat__` to make sure the server is running.
103103

104104
### Running via Docker
105105
This currently requires access to the [mozilla-rust-sdk](https://github.com/mozilla-services/mozilla-rust-sdk) repo. If you don't have it, this will be made public soon; we'll update the README here when that happens.

config/local.example.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1+
# Example MySQL DSN:
12
database_url = "mysql://sample_user:sample_password@localhost/syncstorage_rs"
3+
4+
# Example Spanner DSN:
5+
# database_url="spanner://projects/SAMPLE_GCP_PROJECT/instances/SAMPLE_SPANNER_INSTANCE/databases/SAMPLE_SPANNER_DB"
6+
7+
"limits.max_total_records"=1666 # See issues #298/#333
28
master_secret = "INSERT_SECRET_KEY_HERE"
9+
310
# removing this line will default to moz_json formatted logs (which is preferred for production envs)
411
human_logs = 1

docs/config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ $ cargo run -- --config sync.ini
2424
Options can be mixed between environment and configuration.
2525

2626
## Options
27-
The following configuration options are avaialble.
27+
The following configuration options are available.
2828

2929
| Option | Default value |Description |
3030
| --- | --- | --- |

0 commit comments

Comments
 (0)