aboutsummaryrefslogtreecommitdiffstats
path: root/rust
diff options
context:
space:
mode:
Diffstat (limited to 'rust')
-rw-r--r--rust/INSTALL.md7
-rw-r--r--rust/README.md32
-rw-r--r--rust/example.env (renamed from rust/env.example)0
3 files changed, 24 insertions, 15 deletions
diff --git a/rust/INSTALL.md b/rust/INSTALL.md
index 7b7d6001..462072dc 100644
--- a/rust/INSTALL.md
+++ b/rust/INSTALL.md
@@ -2,12 +2,12 @@
Canonical IA production/QA ansible scripts are in the journal-infra repo. These
directions are likely to end up out-of-date.
-## Simple Deployment
+## Simple Server Deployment
To install manually, on a bare server, as root:
adduser fatcat
- apt install postgresql-9.6 postgresql-contrib postgresql-client-9.6 \
+ apt install postgresql-11 postgresql-contrib postgresql-client-11 \
nginx build-essential git pkg-config libssl-dev libpq-dev \
htop screen
mkdir -p /srv/fatcat
@@ -16,7 +16,6 @@ To install manually, on a bare server, as root:
# setup new postgres user
su - postgres
createuser -P -s fatcat # strong random password
- # DELETE: createdb fatcat
# as fatcat user
su - fatcat
@@ -25,7 +24,7 @@ To install manually, on a bare server, as root:
source $HOME/.cargo/env
cargo install diesel_cli --no-default-features --features "postgres"
cd /srv/fatcat
- git clone git@git.archive.org:webgroup/fatcat
+ git clone https://github.com/internetarchive/fatcat.git
cd rust
cargo build
echo "DATABASE_URL=postgres://fatcat@localhost/fatcat" > .env
diff --git a/rust/README.md b/rust/README.md
index 7393322d..e191d03e 100644
--- a/rust/README.md
+++ b/rust/README.md
@@ -21,26 +21,36 @@ do development work:
- rust stable, 2018 edition, 1.32+ (eg, via "rustup", includes cargo tool)
- diesel (`cargo install diesel_cli`)
- postgres (compatible with 9.6+; run 11.x in production)
-- postgres libs (debian: `sudo apt install libsqlite3-dev libpq-dev`)
-- libsodium library and development headers (debian: `libsodium-dev`)
+- postgres libs (debian/ubuntu: `libsqlite3-dev libpq-dev`)
+- libsodium library and development headers (debian/ubuntu: `libsodium-dev`)
-Copying commands out of `../.gitlab-ci.yml` file may be the fastest way to get
-started.
+We need to create a new `fatcat` postgres user and database to run tests and
+develop with. On debian/ubuntu, a UNIX account named `postgres` is
+automatically created with control over the database, so we'll run setup
+commands from that user. To create the database account:
-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.
+ sudo su - postgres
-Copy `env.example` to `.env`, update if needed, then re-create database from
-scratch:
+ # this command creates a PostgreSQL user, not a UNIX/system user
+ createuser -s fatcat -P
+
+ # switch back to your regular system user
+ exit
+
+Copy `./example.env` to `./.env` and update the `DATABASE_URL` and
+`TEST_DATABASE_URL` lines with the password you set above.
+
+As your regular user, use `diesel` to create and initialize the `fatcat`
+database (`diesel` and the fatcat tools will automatically use postgresql
+credentials from the `.env` file):
diesel database reset
-Build and run:
+Build and run the API server:
cargo run --bin fatcatd
-Tests:
+Run tests:
cargo test -- --test-threads 1
diff --git a/rust/env.example b/rust/example.env
index bee653c2..bee653c2 100644
--- a/rust/env.example
+++ b/rust/example.env