Skip to content

Commit 7b19f52

Browse files
committed
Update README.md
1 parent 971acd0 commit 7b19f52

File tree

1 file changed

+104
-31
lines changed

1 file changed

+104
-31
lines changed

README.md

Lines changed: 104 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -180,46 +180,69 @@ npm run test:ui # Run tests with UI
180180
npm run test:run # Run tests once
181181
```
182182

183-
**Backend:**
184-
```bash
185-
dotnet test
186-
```
187-
188-
### 5. Build for Production
189-
```bash
190-
cd MyApp.Client
191-
npm run publish
192-
```
193-
194-
This builds the React client and bundles it with the .NET backend into `/bin/Release/net10.0/publish`.
195-
196-
## Deployment Options
183+
## Configuration
197184

198-
### Docker
185+
### Key Configuration Files
199186

200-
Built-in container support with .NET SDK:
187+
- **MyApp/appsettings.json** - Application configuration
188+
- **MyApp.Client/next.config.mjs** - Next.js configuration
189+
- **MyApp.Client/styles/index.css** - Tailwind CSS configuration
190+
- **config/deploy.yml** - Kamal deployment settings
201191

202-
```bash
203-
dotnet publish -c Release
192+
### App Settings
193+
194+
Configure in `appsettings.json` or environment:
195+
196+
```json
197+
{
198+
"ConnectionStrings": {
199+
"DefaultConnection": "DataSource=App_Data/app.db;Cache=Shared"
200+
},
201+
"SmtpConfig": {
202+
"Host": "smtp.example.com",
203+
"Port": 587,
204+
"FromEmail": "[email protected]",
205+
"FromName": "MyApp"
206+
},
207+
"AppConfig": {
208+
"BaseUrl": "https://myapp.example.com"
209+
}
210+
}
204211
```
205212

206-
### Kamal
207-
208-
Zero-downtime deployments with included configuration:
209-
210-
```bash
211-
kamal deploy
213+
### App Settings Secrets
214+
215+
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:
216+
217+
```json
218+
[
219+
{
220+
"op":"replace",
221+
"path":"/ConnectionStrings/DefaultConnection",
222+
"value":"Server=service-postgres;Port=5432;User Id=dbuser;Password=dbpass;Database=dbname;Pooling=true;"
223+
},
224+
{ "op":"add", "path":"/SmtpConfig", "value":{
225+
"UserName": "SmptUser",
226+
"Password": "SmptPass",
227+
"Host": "email-smtp.us-east-1.amazonaws.com",
228+
"Port": 587,
229+
"From": "[email protected]",
230+
"FromName": "MyApp",
231+
232+
}
233+
},
234+
{ "op":"add", "path":"/Admins", "value": ["[email protected]","[email protected]"] },
235+
{ "op":"add", "path":"/CorsFeature/allowOriginWhitelist/-", "value":"https://servicestack.net" }
236+
]
212237
```
213238

214-
### Traditional Hosting
215-
Deploy as a standard ASP.NET Core application to IIS, Kestrel, or any hosting provider.
239+
### SMTP Email
216240

217-
## Key Configuration Files
241+
Enable email sending by uncommenting in `Program.cs`:
218242

219-
- **MyApp/appsettings.json** - Application configuration
220-
- **MyApp.Client/vite.config.ts** - Vite configuration
221-
- **MyApp.Client/styles/index.css** - Tailwind CSS configuration
222-
- **config/deploy.yml** - Kamal deployment settings
243+
```csharp
244+
services.AddSingleton<IEmailSender<ApplicationUser>, EmailSender>();
245+
```
223246

224247
## Upgrading to Enterprise Database
225248

@@ -237,6 +260,56 @@ npx add-in ef-postgres
237260
npx add-in db-identity
238261
```
239262

263+
## Deployment
264+
265+
### Docker + Kamal
266+
267+
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.
268+
269+
### GitHub Action Secrets
270+
271+
**Required - App Specific*:
272+
273+
The only secret needed to be configured per Repository.
274+
275+
| Variable | Example | Description |
276+
|----------|---------|-------------|
277+
| `KAMAL_DEPLOY_HOST` | `example.org` | Hostname used for SSL certificate and Kamal proxy |
278+
279+
**Required** (Organization Secrets):
280+
281+
Other Required variables can be globally configured in your GitHub Organization or User secrets which will
282+
enable deploying all your Repositories to the same server.
283+
284+
| Variable | Example | Description |
285+
|----------|----------|-------------|
286+
| `KAMAL_DEPLOY_IP` | `100.100.100.100` | IP address of the server to deploy to |
287+
| `SSH_PRIVATE_KEY` | `ssh-rsa ...` | SSH private key to access the server |
288+
| `LETSENCRYPT_EMAIL` | `[email protected]` | Email for Let's Encrypt SSL certificate |
289+
290+
**Optional**:
291+
292+
| Variable | Example | Description |
293+
| `SERVICESTACK_LICENSE` | `...` | ServiceStack license key |
294+
295+
**Inferred** (from GitHub Action context):
296+
297+
These are inferred from the GitHub Action context and don't need to be configured.
298+
299+
| Variable | Source | Description |
300+
|----------|--------|-------------|
301+
| `GITHUB_REPOSITORY` | `${{ github.repository }}` | e.g. `acme/example.org` - used for service name and image |
302+
| `KAMAL_REGISTRY_USERNAME` | `${{ github.actor }}` | GitHub username for container registry |
303+
| `KAMAL_REGISTRY_PASSWORD` | `${{ secrets.GITHUB_TOKEN }}` | GitHub token for container registry auth |
304+
305+
#### Features
306+
307+
- **Docker containerization** with optimized .NET images
308+
- **SSL auto-certification** via Let's Encrypt
309+
- **GitHub Container Registry** integration
310+
- **Volume persistence** for App_Data including any SQLite database
311+
312+
240313
## AutoQuery CRUD Dev Workflow
241314

242315
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.

0 commit comments

Comments
 (0)