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
Instead of polluting each GitHub Reposity with multiple App-specific GitHub Action Secrets, you can save all your secrets in a single `APPSETTINGS_PATCH` GitHub Action Secret to patch `appsettings.json` with environment-specific configuration using [JSON Patch](https://jsonpatch.com). E.g:
2. Install `db-identity` to use RDBMS `DatabaseJobsFeature` for background jobs and `DbRequestLogger` for Request Logs:
352
+
353
+
```bash
354
+
npx add-in db-identity
355
+
```
356
+
357
+
## Deployment
358
+
359
+
### Docker + Kamal
360
+
361
+
This project includes GitHub Actions for CI/CD with automatic Docker image builds and production [deployment with Kamal](https://docs.servicestack.net/kamal-deploy). The `/config/deploy.yml` configuration is designed to be reusable across projects—it dynamically derives service names, image paths, and volume mounts from environment variables, so you only need to configure your server's IP and hostname using GitHub Action secrets.
362
+
363
+
### GitHub Action Secrets
364
+
365
+
**Required - App Specific*:
366
+
367
+
The only secret needed to be configured per Repository.
368
+
369
+
| Variable | Example | Description |
370
+
|----------|---------|-------------|
371
+
|`KAMAL_DEPLOY_HOST`|`example.org`| Hostname used for SSL certificate and Kamal proxy |
372
+
373
+
**Required** (Organization Secrets):
374
+
375
+
Other Required variables can be globally configured in your GitHub Organization or User secrets which will
376
+
enable deploying all your Repositories to the same server.
377
+
378
+
| Variable | Example | Description |
379
+
|----------|----------|-------------|
380
+
|`KAMAL_DEPLOY_IP`|`100.100.100.100`| IP address of the server to deploy to |
381
+
|`SSH_PRIVATE_KEY`|`ssh-rsa ...`| SSH private key to access the server |
382
+
|`LETSENCRYPT_EMAIL`|`[email protected]`| Email for Let's Encrypt SSL certificate |
These are inferred from the GitHub Action context and don't need to be configured.
393
+
394
+
| Variable | Source | Description |
395
+
|----------|--------|-------------|
396
+
|`GITHUB_REPOSITORY`|`${{ github.repository }}`| e.g. `acme/example.org` - used for service name and image |
397
+
|`KAMAL_REGISTRY_USERNAME`|`${{ github.actor }}`| GitHub username for container registry |
398
+
|`KAMAL_REGISTRY_PASSWORD`|`${{ secrets.GITHUB_TOKEN }}`| GitHub token for container registry auth |
399
+
400
+
#### Features
401
+
402
+
-**Docker containerization** with optimized .NET images
403
+
-**SSL auto-certification** via Let's Encrypt
404
+
-**GitHub Container Registry** integration
405
+
-**Volume persistence** for App_Data including any SQLite database
406
+
407
+
## AutoQuery CRUD Dev Workflow
408
+
409
+
For Rapid Development simple [TypeScript Data Models](https://docs.servicestack.net/autoquery/okai-models) can be used to generate C# AutoQuery APIs and DB Migrations.
410
+
411
+
### Cheat Sheet
412
+
413
+
### Create a new Table
414
+
415
+
Create a new Table use `init <Table>`, e.g:
416
+
417
+
```bash
418
+
npx okai init Table
419
+
```
420
+
421
+
This will generate an empty `MyApp.ServiceModel/<Table>.d.ts` file along with stub AutoQuery APIs and DB Migration implementations.
422
+
423
+
### Use AI to generate the TypeScript Data Model
424
+
425
+
Or to get you started quickly you can also use AI to generate the initial TypeScript Data Model with:
426
+
427
+
```bash
428
+
npx okai "Table to store Customer Stripe Subscriptions"
429
+
```
430
+
431
+
This launches a TUI that invokes ServiceStack's okai API to fire multiple concurrent requests to frontier cloud
432
+
and OSS models to generate the TypeScript Data Models required to implement this feature.
433
+
You'll be able to browse and choose which of the AI Models you prefer which you can accept by pressing `a`
434
+
to `(a) accept`. These are the data models [Claude Sonnet 4.5 generated](https://servicestack.net/text-to-blazor?id=1764337230546) generated for this prompt.
435
+
436
+
#### Regenerate AutoQuery APIs and DB Migrations
437
+
438
+
After modifying the `Table.d.ts` TypeScript Data Model to include the desired fields, re-run the `okai` tool to re-generate the AutoQuery APIs and DB Migrations:
439
+
440
+
```bash
441
+
npx okai Table.d.ts
442
+
```
443
+
444
+
> Command can be run anywhere within your Solution
445
+
446
+
After you're happy with your Data Model you can run DB Migrations to run the DB Migration and create your RDBMS Table:
447
+
448
+
```bash
449
+
npm run migrate
450
+
```
451
+
452
+
#### Making changes after first migration
453
+
454
+
If you want to make further changes to your Data Model, you can re-run the `okai` tool to update the AutoQuery APIs and DB Migrations, then run the `rerun:last` npm script to drop and re-run the last migration:
455
+
456
+
```bash
457
+
npm run rerun:last
458
+
```
459
+
460
+
#### Removing a Data Model and all generated code
461
+
462
+
If you changed your mind and want to get rid of the RDBMS Table you can revert the last migration:
463
+
464
+
```bash
465
+
npm run revert:last
466
+
```
467
+
468
+
Which will drop the table and then you can get rid of the AutoQuery APIs, DB Migrations and TypeScript Data model with:
0 commit comments