@@ -70,19 +70,24 @@ yarn run ember test --server
70
70
After cloning the repo, steps for setting up the backend API server are as
71
71
follows:
72
72
73
- 1 . Copy the ` .env.sample ` file to ` .env ` and change any applicable values as
73
+ 1 . Install [ Postgres] ( https://www.postgresql.org/ ) >= 9.5 and create a
74
+ database. For example, if you wanted your database to be named
75
+ ` cargo_registry ` , you can run ` psql ` to connect to postgres, then run
76
+ ` CREATE DATABASE cargo_registry; ` .
77
+
78
+ 2 . Copy the ` .env.sample ` file to ` .env ` and change any applicable values as
74
79
directed by the comments in the file. Make sure the values in your new
75
80
` .env ` are exported in the shell you use for the following commands.
76
81
77
- 2 . Set up the git index:
82
+ 3 . Set up the git index:
78
83
79
84
```
80
85
./script/init-local-index.sh
81
86
```
82
87
83
88
But *do not* modify your `~/.cargo/config` yet. Do that after step 3.
84
89
85
- 3 . Build the server:
90
+ 4 . Build the server:
86
91
87
92
```
88
93
cargo build
@@ -91,37 +96,44 @@ follows:
91
96
On OS X 10.11, you will need to install the openssl headers first, and tell
92
97
cargo where to find them. See https://github.com/sfackler/rust-openssl#osx.
93
98
94
- 4 . Run the migrations:
99
+ 5 . Run the migrations:
95
100
96
101
```
97
102
./target/debug/migrate
98
103
```
99
104
100
- 5 . Start the backend server:
105
+ 6 . Start the backend server:
101
106
102
107
```
103
108
./target/debug/server
104
109
```
105
110
106
- 6 . **Optionally** start a local frontend:
111
+ 7 . **Optionally** start a local frontend:
107
112
108
113
```
109
114
yarn run start:local
110
115
```
111
116
112
117
### Running Tests
113
118
114
- 1. Configure the location of the test database. Note that this should just be a
115
- blank database, the test harness will ensure that migrations are run.
119
+ 1. Configure the location of the test database. Create a database other than
120
+ your development database, since running the tests will clear out the data.
121
+ For example, to use a database named `cargo_registry_test`, create it in
122
+ postgres by running `psql` to connect to postgres, then run
123
+ `CREATE DATABASE cargo_registry_test;`. The test harness will ensure that
124
+ migrations are run.
125
+
126
+ In your `.env` file, specify your test database URL. Here's an example,
127
+ assuming your test database is named `cargo_registry_test`:
116
128
117
129
```
118
- export TEST_DATABASE_URL=...
130
+ export TEST_DATABASE_URL=postgres://postgres@localhost/cargo_registry_test
119
131
```
120
132
121
- 2. Set the s3 bucket to `alexcrichton-test`. No actual requests to s3 will be
122
- made; the requests and responses are recorded in files in
123
- `tests/http-data` and the s3 bucket name needs to match the requests in the
124
- files.
133
+ 2. In your `.env` file, set the s3 bucket to `alexcrichton-test`. No actual
134
+ requests to s3 will be made; the requests and responses are recorded in
135
+ files in `tests/http-data` and the s3 bucket name needs to match the
136
+ requests in the files.
125
137
126
138
```
127
139
export S3_BUCKET=alexcrichton-test
0 commit comments