summaryrefslogtreecommitdiffstats
path: root/rust/README.md
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-05-16 20:15:33 -0700
committerBryan Newbold <bnewbold@robocracy.org>2018-05-16 20:15:33 -0700
commit7476d63f0b9adec8087919a776b1bc4bf14b157d (patch)
treeed6b220a781cecdfb3413a4b018aeca9d2abaee3 /rust/README.md
parent3d11c4305c0caf754574de54efbdaa63abeb23e5 (diff)
downloadfatcat-7476d63f0b9adec8087919a776b1bc4bf14b157d.tar.gz
fatcat-7476d63f0b9adec8087919a776b1bc4bf14b157d.zip
clean up rust README
Diffstat (limited to 'rust/README.md')
-rw-r--r--rust/README.md35
1 files changed, 28 insertions, 7 deletions
diff --git a/rust/README.md b/rust/README.md
index 794afee7..98d742f4 100644
--- a/rust/README.md
+++ b/rust/README.md
@@ -1,25 +1,46 @@
-Things!
+Rust implementation of fatcat API server (`fatcatd`).
- sudo apt install libsqlite3-dev libpq-dev
+## Development
- wget https://oss.sonatype.org/content/repositories/snapshots/io/swagger/swagger-codegen-cli/3.0.0-SNAPSHOT/swagger-codegen-cli-3.0.0-20180411.134218-60.jar
+- rust stable, 1.26+ (eg, via "rustup", includes cargo tool)
+- diesel (`cargo install diesel_cli`)
+- postgres (9.6+; targetting 10.3 for production)
+- postgres libs (debian: `sudo apt install libsqlite3-dev libpq-dev`)
- cargo swagger ../golang/fatcat-openapi2.yml gen-out
+Create a new postgres superuser. A regular postgres user and an existing
+database should also work (with up/down migrations), but it's easier to just
+blow the entire database away.
- diesel print-schema > src/database_schema.rs
+Create a `.env` file with configuration:
+
+ DATABASE_URL=postgres://fatcat:tactaf@localhost/fatcat_rs
+
+Re-create database from scratch:
+
+ diesel database reset
+
+Build and run:
+
+ cargo run
+
+### Special Tricks
Regenerate API schemas:
+ cargo install cargo-swagger # uses docker
cargo swagger fatcat-openapi2.yml fatcat-api --docker-tag=v2.3.1
sudo chown `whoami`:`whoami` -R fatcat-api
# edit fatcat-api/Cargo.toml, set name to "fatcat-api"
cargo fmt
+ # git commit the fatcat-api directory at this point
+
+ diesel print-schema > src/database_schema.rs
-Debugging SQL errors:
+Debugging SQL schema errors:
psql fatcat_rs < migrations/2018-05-12-001226_init/up.sql
-Creating entities:
+Creating entities via API:
http --json post localhost:9411/v0/container name=asdf issn=1234-5678