Skip to content

Add more documentation about crates.io's database needs #550

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 8, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 25 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,24 @@ yarn run ember test --server
After cloning the repo, steps for setting up the backend API server are as
follows:

1. Copy the `.env.sample` file to `.env` and change any applicable values as
1. Install [Postgres](https://www.postgresql.org/) >= 9.5 and create a
database. For example, if you wanted your database to be named
`cargo_registry`, you can run `psql` to connect to postgres, then run
`CREATE DATABASE cargo_registry;`.

2. Copy the `.env.sample` file to `.env` and change any applicable values as
directed by the comments in the file. Make sure the values in your new
`.env` are exported in the shell you use for the following commands.

2. Set up the git index:
3. Set up the git index:

```
./script/init-local-index.sh
```

But *do not* modify your `~/.cargo/config` yet. Do that after step 3.

3. Build the server:
4. Build the server:

```
cargo build
Expand All @@ -91,37 +96,44 @@ follows:
On OS X 10.11, you will need to install the openssl headers first, and tell
cargo where to find them. See https://github.com/sfackler/rust-openssl#osx.

4. Run the migrations:
5. Run the migrations:

```
./target/debug/migrate
```

5. Start the backend server:
6. Start the backend server:

```
./target/debug/server
```

6. **Optionally** start a local frontend:
7. **Optionally** start a local frontend:

```
yarn run start:local
```

### Running Tests

1. Configure the location of the test database. Note that this should just be a
blank database, the test harness will ensure that migrations are run.
1. Configure the location of the test database. Create a database other than
your development database, since running the tests will clear out the data.
For example, to use a database named `cargo_registry_test`, create it in
postgres by running `psql` to connect to postgres, then run
`CREATE DATABASE cargo_registry_test;`. The test harness will ensure that
migrations are run.

In your `.env` file, specify your test database URL. Here's an example,
assuming your test database is named `cargo_registry_test`:

```
export TEST_DATABASE_URL=...
export TEST_DATABASE_URL=postgres://postgres@localhost/cargo_registry_test
```

2. Set the s3 bucket to `alexcrichton-test`. No actual requests to s3 will be
made; the requests and responses are recorded in files in
`tests/http-data` and the s3 bucket name needs to match the requests in the
files.
2. In your `.env` file, set the s3 bucket to `alexcrichton-test`. No actual
requests to s3 will be made; the requests and responses are recorded in
files in `tests/http-data` and the s3 bucket name needs to match the
requests in the files.

```
export S3_BUCKET=alexcrichton-test
Expand Down