You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Builds a ~22MB docker image right now!
Runs the CI tests in docker-compose, deploys with
Heroku container support (deletes Procfile).
Add docker-compose-based development flow.
*[Running server processes](#running-server-processes)
12
-
*[Database Connection](#database-connection)
13
-
*[Configuration](#configuration)
14
-
*[Rust Version](#rust-version)
15
-
*[Environment variables](#environment-variables)
16
-
*[Database](#database)
17
-
*[Bootstrapping](#bootstrapping)
18
-
*[Scraping](#scraping)
19
-
*[Deployment](#deployment)
20
-
*[Conduct](#conduct)
21
-
*[License](#license)
22
-
23
7
## Development
24
8
25
9
### Chat
@@ -28,84 +12,38 @@ There is an `#rfcbot` channel in the `ops` section of the [rust-lang discord ser
28
12
29
13
### Rust Version
30
14
31
-
Rust nightly is required, as rfcbot uses [Rocket](rocket.rs). If you use rustup, this version is controlled by a `rust-toolchain` file at the repository root.
32
-
33
-
### Heroku CLI
34
-
35
-
https://devcenter.heroku.com/articles/heroku-cli
36
-
37
-
### Environment variables
15
+
Rust nightly is required, as rfcbot uses [Rocket](rocket.rs). If you use rustup, this version is managed for you by a `rust-toolchain` file at the repository root.
38
16
39
-
See config.rs for the environment variables expected. Also, rocket env vars are supported.
40
-
41
-
You can also create a [local `.env` file](https://github.com/dotenv-rs/dotenv#examples) which will
42
-
be added to the environment variables the server sees.
43
-
44
-
### Database dumps
17
+
### Running locally
45
18
46
-
It can be useful to have a database with some existing data to start from. "Bootstrap" files are available at https://www.dropbox.com/sh/dl4pxj1d49ici1f/AAAzZQxWVqQzVk_zOksn0Rbya?dl=0. They usually are behind several migrations, so you'll still need to run the migrations if you start from one.
47
-
48
-
See [below](#database) for information about restoring from a bootstrap file.
49
-
50
-
### Running server processes
51
-
52
-
There are two daemons to run, one for the front-end development server, and one for the back-end API server and scraper. It's recommended to run these in two separate terminal windows/tabs/sessions.
53
-
54
-
You may need to run database migrations if the bootstrap SQL file is stale:
55
-
56
-
```
57
-
$ diesel migration run
58
-
```
19
+
Install [Docker](https://docker.dom) and [docker-compose](https://docs.docker.com/compose) and ensure they're working.
59
20
60
-
To run the back-end API server and scraper:
21
+
Next, start development services and initialize the database:
61
22
62
23
```
63
-
$ cargo run
24
+
cargo install diesel_cli
25
+
docker-compose up -d
26
+
./setup-db.sh
64
27
```
65
28
66
-
**NOTE:** The API server process needs to be manually restarted whenever you want to see code changes reflected in their behavior, or whenever you run migrations on the test database. A `Ctrl+C` followed by `Up` and `Enter` usually works if running them through cargo. `cargo watch` is also a nice tool.
67
-
68
-
### Database connection
69
-
70
-
If you want to perform any database action, make sure you have a reachable installation of PostgreSQL that is configured with the DATABASE_URL environment variable.
71
-
72
-
## Configuration
73
-
74
-
### Environment variables
75
-
76
-
Note that you can configure the Rocket web server using environment variables like `ROCKET_PORT`, according to the Rocket [configuration guide](https://rocket.rs/guide/configuration/).
29
+
After this you may need to run `docker-compose down`/`docker-compose up -d` for the server process to see the database updates.
77
30
78
-
*`DATABASE_URL`: postgres database URL
79
-
*`DATABASE_POOL_SIZE`: number of connections to maintain in the pool
80
-
*`GITHUB_ACCESS_TOKEN`: your access token from GitHub. See [this page](https://help.github.com/articles/creating-an-access-token-for-command-line-use/) for more information. You shouldn't need to check any of the boxes for granting scopes when creating it.
81
-
*`GITHUB_USER_AGENT`: the UA string to send to GitHub (they request that you send your GitHub username or the app name you registered for the client ID)
82
-
*`GITHUB_WEBHOOK_SECRETS`: a comma-delimited string of the secrets used for any ingestion webhooks. The webhook handler will attempt to validate any POST'd webhook against each secret until it either finds a matching one or runs out.
83
-
*`RUST_LOG`: the logging configuration for [env_logger](https://crates.io/crates/env_logger). If you're unfamiliar, you can read about it in the documentation linked on crates.io. If it's not defined, logging will default to `info!()` and above.
84
-
*`GITHUB_SCRAPE_INTERVAL`: time (in minutes) to wait in between GitHub scrapes (scraping is disabled if this environment variable is omitted)
85
-
*`POST_COMMENTS`: whether to post RFC bot comments on issues -- either `true` or `false`. Be very careful setting to true when testing -- it will post comments using whatever account is associated with the GitHub API key you provide.
31
+
By default this stores your database files in `target/data/`, so any temporary changes you make to the database will be removed by a `cargo clean` and you'll need to run the above commands again.
86
32
87
-
## Database
88
-
89
-
To init, make sure `DATABASE_URL` is set and postgres is running, and:
90
-
91
-
```
92
-
cargo install diesel_cli
93
-
diesel setup
94
-
diesel print-schema > src/domain/schema.rs
95
-
```
33
+
### Database dumps
96
34
97
-
If the database setup experiences errors, your user may not have permission to create databases or
98
-
there may be other configuration problems.
35
+
It can be useful to have a database with some existing data to start from. "Bootstrap" files are available at https://www.dropbox.com/sh/dl4pxj1d49ici1f/AAAzZQxWVqQzVk_zOksn0Rbya?dl=0.
99
36
100
-
That should have the database you've specified ready to receive data. Then you can run some of the bootstrapping commands (see below). Alternatively, you can use `bootstrap.sql` to get a nice starting point for the database (note that this isn't maintained regularly).
37
+
Assuming that you download the most recent file in the above folder and name it `bootstrap.sql`:
101
38
102
39
```bash
103
-
psql -d $DB_NAME_HERE -f bootstrap.sql
40
+
# see setup-db.sh for the url to use here
41
+
psql -d $DATABASE_URL -f bootstrap.sql
104
42
```
105
43
106
44
## Deployment
107
45
108
-
Deployed to Heroku via TravisCI from the master branch.
46
+
Deployed to Heroku via TravisCI from the master branch. See (.travis.yml)[./travis.yml] for an up-to-date listing of the actions.
0 commit comments