Skip to content

Commit d2e2064

Browse files
authored
Merge pull request #2126 from GuillaumeGomez/quick-start
Add quick start instructions and allow to skip DB migrations
2 parents c78f761 + 9052f7a commit d2e2064

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

.env.sample

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
1+
# You can get this value from https://github.com/settings/tokens.
12
# if `GITHUB_TOKEN` is not set here, the token can also be stored in `~/.gitconfig`
23
GITHUB_TOKEN=MUST_BE_CONFIGURED
34
DATABASE_URL=MUST_BE_CONFIGURED
5+
# If this variable is uncommented set to 1, the DB migrations will be skipped.
6+
# SKIP_DB_MIGRATIONS=0
7+
# If this variable is uncommented and set to 1, it will skip the workqueue
8+
# load (which takes ~10-15 seconds).
9+
# SKIP_WORKQUEUE=0
10+
411
GITHUB_WEBHOOK_SECRET=MUST_BE_CONFIGURED
512
# for logging, refer to this document: https://rust-lang-nursery.github.io/rust-cookbook/development_tools/debugging/config_log.html
613
# `RUSTC_LOG` is not required to run the application, but it makes local development easier

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ To compile the Triagebot you need OpenSSL development library to be installed (e
2727

2828
Run `cargo build` to compile the triagebot.
2929

30+
## Quick start
31+
32+
For local development/debugging for the log pages, do the following steps:
33+
34+
1. Run `cp .env.sample .env`
35+
2. Change value of `SKIP_DB_MIGRATIONS` to `1`.
36+
3. Run `cargo run --bin triagebot`
37+
4. Go to this URL: <http://localhost:8000/gha-logs/rust-lang/rust/46814678314>
38+
3039
## Running triagebot
3140

3241
It is possible to run triagebot yourself, and test changes against your own repository.

src/main.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,9 +316,11 @@ async fn run_server(addr: SocketAddr) -> anyhow::Result<()> {
316316
// and the old instance potentially runs on an newer database schema.
317317
let db_url = std::env::var("DATABASE_URL").expect("needs DATABASE_URL");
318318
let pool = db::ClientPool::new(db_url.clone());
319-
db::run_migrations(&mut *pool.get().await)
320-
.await
321-
.context("database migrations")?;
319+
if !std::env::var("SKIP_DB_MIGRATIONS").is_ok_and(|value| value == "1") {
320+
db::run_migrations(&mut *pool.get().await)
321+
.await
322+
.context("database migrations")?;
323+
}
322324

323325
let ctx = Arc::new(Context {
324326
username: std::env::var("TRIAGEBOT_USERNAME").or_else(|err| match err {

0 commit comments

Comments
 (0)