Skip to content

Commit fcdbead

Browse files
committed
correct the server readme: a recovery command that runs, a search table that works, and no invented owner role
1 parent afba398 commit fcdbead

1 file changed

Lines changed: 41 additions & 18 deletions

File tree

‎README.md‎

Lines changed: 41 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,14 @@ docker compose up
5151
That starts Code Scout and a Postgres database, and creates the tables on first run. Open
5252
<http://localhost:24275>.
5353

54-
The first page asks you to register. The first account you make becomes the owner, and after that
55-
the same page becomes a normal login. Create a project, and the project ID and secret appear on the
56-
last step. You can always read the secret again later under **Settings → SDK setup**, or rotate it
57-
if it leaks.
54+
The first page asks you to register. The first account you make becomes the super admin, which is
55+
the role that sees every project and can change instance-wide settings. After that the same page
56+
becomes an ordinary login, and further accounts are made from the Members screen rather than by
57+
registering again.
58+
59+
Create a project, and its ID and secret appear on the last step. You can read the secret again
60+
later under Settings and then SDK setup, or rotate it if it leaks. That tab only appears for
61+
people with manage rights on the project, so a read-only member will not find it.
5862

5963
> Please change the passwords in `docker-compose.yml` before putting this anywhere other people can
6064
> reach.
@@ -112,11 +116,14 @@ scout.e('Payment failed', error: e, stackTrace: st);
112116
And capture your network calls by wrapping the client you already have:
113117

114118
```dart
115-
dio.interceptors.add(CodeScoutDioInterceptor()); // Dio
119+
dio.interceptors.add(CodeScoutDioInterceptor()); // Dio
116120
117-
final client = CodeScoutHttpClient(); // package:http
121+
final client = CodeScoutHttpClient(client: myExistingClient); // package:http
118122
```
119123

124+
Pass your existing client in. If you leave `client:` out, the wrapper builds a plain new one and
125+
any base headers, proxy or timeout you had configured are quietly lost.
126+
120127
`projectCredentials` is optional. Leave it out and Code Scout is a local logging library: you get
121128
console output and an on-device viewer, and nothing leaves the phone. Add the credentials when you
122129
want the dashboard as well.
@@ -138,17 +145,26 @@ The search box takes a small query language, and you can mix it with plain text.
138145

139146
| | |
140147
|---|---|
141-
| `level:error` | one level and anything louder |
148+
| `level:error` | only that level. Repeat it for more: `level:error level:fatal` |
142149
| `tag:checkout` | logs carrying a tag |
143-
| `session:4f2a81b0` | one app launch |
144-
| `request:7d19c204` | one network call, all of its phases |
150+
| `-tag:heartbeat` | everything except that tag |
151+
| `session:4f2a81b0-9d3c-4e77-b0a1-2f9c6d5e8a41` | one app launch |
152+
| `request:7d19c204-1b6e-4a52-9c88-3ee1f0a7b942` | one network call and both of its logs |
145153
| `user:ada@example.com` | everything that happened to one person |
146-
| `installation:9eec2f07` | one install, across launches |
154+
| `installation:9eec2f07-52c1-4a90-8e6b-77d0c3b41f28` | one install, across launches |
147155
| `app_version:3.11.2` | one build of your app |
148156
| `device:Pixel` | a device model, matched loosely |
149157
| `os:Android` | an OS name or version |
150158
| `"gateway timeout"` | plain text in the message |
151159

160+
`level:` is a set rather than a threshold, so `level:error` on its own does not include fatals.
161+
That is worth remembering during an incident, which is exactly when you would type it.
162+
163+
The three id filters take the whole UUID. A shortened one is refused outright rather than
164+
matched as a prefix, so paste the id rather than the first few characters of it. `user:`,
165+
`installation:` and `app_version:` all match exactly, while `device:` and `os:` are the two that
166+
match loosely.
167+
152168
### Network
153169

154170
The SDK records a request, a response and an error separately. The dashboard pairs them back into
@@ -239,7 +255,10 @@ fails the batch is put back and tried again later.
239255
## Configuration
240256

241257
Everything is set with environment variables. You can put the same keys in `/etc/code-scout.conf`
242-
as TOML without the `CS_` prefix if you prefer a file. Environment variables win.
258+
as TOML if you prefer a file. The key is the variable name with `CS_` removed and the rest
259+
lower-cased, so `CS_DB_HOST` becomes `db_host` and `CS_CONN_MAX_LIFETIME_MINUTES` becomes
260+
`conn_max_lifetime_minutes`. Numbers go in unquoted: a quoted one is ignored and you silently
261+
get the default instead. Environment variables win.
243262

244263
| Variable | Default | |
245264
|---|---|---|
@@ -262,7 +281,11 @@ container health check uses.
262281

263282
If you are locked out of the only owner account, `code_scout reset-password --email=you@example.com`
264283
prints a temporary password once and signs that account out everywhere. Inside Docker that is
265-
`docker exec <container> ./code_scout reset-password --email=...`.
284+
`docker exec <container> code_scout reset-password --email=you@example.com`. The binary is on
285+
the PATH inside the image, so there is no `./` in front of it. Run it in the container that
286+
already has the `CS_DB_*` settings, because the command reads the same configuration the server
287+
does. The temporary password is printed once and stored nowhere, so copy it before you close the
288+
terminal.
266289

267290
### Behind a reverse proxy
268291

@@ -309,7 +332,7 @@ make build # linux/amd64 binary into ./bin
309332

310333
`make db-reset` drops the local database and recreates it empty; the next `make dev` rebuilds every
311334
table, because the server migrates its schema on startup. That is the normal way to pick up a model
312-
change here — there is no deployed instance to migrate, so a schema change is a rebuild. It asks you
335+
change here, because there is no deployed instance to migrate, so a schema change is a rebuild. It asks you
313336
to type the database name first, and `force=1` skips the prompt for scripts. Stop `make dev` before
314337
running it: Postgres refuses to drop a database anything is still connected to, and the reset
315338
terminates those connections to get past that.
@@ -349,9 +372,9 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for how to get set up and what a good pul
349372
like. Everything ships with tests, including the browser tests, and the honest way to check one is
350373
to undo the fix and watch the test fail.
351374

352-
Right now the most useful contributions are dashboard favourites, which is the one screen with a
353-
tab and no backend behind it, and anything that makes the first fifteen minutes easier for someone
354-
who has never seen this before.
375+
Right now the most useful contributions are anything that makes the first fifteen minutes easier
376+
for somebody who has never seen this before, and browser test coverage for the screens the
377+
current suite does not reach.
355378

356379
## Status
357380

@@ -361,8 +384,8 @@ works today.
361384
The Docker image is published as `touheed10/code_scout:edge` from `main`. Tagged releases will add
362385
version tags and `latest`.
363386

364-
Not built yet: dashboard favourites. Deliberately left for after 1.0: alert rules, crash reporting,
365-
performance metrics, and full text search.
387+
Deliberately left until after 1.0: alert rules, crash reporting, performance metrics, and full
388+
text search.
366389

367390
## License
368391

0 commit comments

Comments
 (0)