From ef0fbfb9d76b4940ddb79705dcd226e34bba4401 Mon Sep 17 00:00:00 2001 From: Tarik Eshaq Date: Tue, 21 Mar 2023 15:23:59 -0400 Subject: [PATCH] docs: Minor improvements to onboarding docs (#1465) --- Makefile | 5 +++-- README.md | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index dada9059..a0540f6b 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,7 @@ PATH_TO_SYNC_SPANNER_KEYS = `pwd`/service-account.json PATH_TO_GRPC_CERT = ../server-syncstorage/local/lib/python2.7/site-packages/grpc/_cython/_credentials/roots.pem SRC_ROOT = $(shell pwd) +PYTHON_SITE_PACKGES = $(shell $(SRC_ROOT)/venv/bin/python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") clippy_mysql: # Matches what's run in circleci @@ -50,7 +51,7 @@ run_mysql: python PATH="./venv/bin:$(PATH)" \ # See https://github.com/PyO3/pyo3/issues/1741 for discussion re: why we need to set the # below env var - PYTHONPATH=$(SRC_ROOT)/venv/lib/python3.9/site-packages \ + PYTHONPATH=$(PYTHON_SITE_PACKGES) \ RUST_LOG=debug \ RUST_BACKTRACE=full \ cargo run --no-default-features --features=syncstorage-db/mysql -- --config config/local.toml @@ -60,7 +61,7 @@ run_spanner: python GRPC_DEFAULT_SSL_ROOTS_FILE_PATH=$(PATH_TO_GRPC_CERT) \ # See https://github.com/PyO3/pyo3/issues/1741 for discussion re: why we need to set the # below env var - PYTHONPATH=$(SRC_ROOT)/venv/lib/python3.9/site-packages \ + PYTHONPATH=$(PYTHON_SITE_PACKGES) \ PATH="./venv/bin:$(PATH)" \ RUST_LOG=debug \ RUST_BACKTRACE=full \ diff --git a/README.md b/README.md index d9f63b0d..3abcff0b 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,7 @@ Mozilla Sync Storage built with [Rust](https://rust-lang.org). - make - pkg-config - [Rust stable](https://rustup.rs) +- python 3.9+ - MySQL 5.7 (or compatible) * libmysqlclient (`brew install mysql` on macOS, `apt install libmysqlclient-dev` on Ubuntu, `apt install libmariadb-dev-compat` on Debian) @@ -48,7 +49,11 @@ are missing `libcurl4-openssl-dev`. 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` 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. To start a local server in debug mode, run either: + - `make run_mysql` if using MySQL or, + - `make run_spanner` if using spanner. + + The above 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 @@ -57,13 +62,19 @@ Durable sync needs only a valid mysql DSN in order to set up connections to a My `mysql://_user_:_password_@_host_/_database_` -To setup a fresh MySQL DB and user: (`mysql -u root`): +To setup a fresh MySQL DB and user: + +- First make sure that you have a MySQL server running, to do that run: `mysqld` +- Then, run the following to launch a mysql shell `mysql -u root` +- Finally, run each of the following SQL statements ```sql CREATE USER "sample_user"@"localhost" IDENTIFIED BY "sample_password"; CREATE DATABASE syncstorage_rs; +CREATE DATABASE tokenserver_rs; GRANT ALL PRIVILEGES on syncstorage_rs.* to sample_user@localhost; +GRANT ALL PRIVILEGES on tokenserver_rs.* to sample_user@localhost; ``` ### Spanner