Skip to content

Commit 5c45440

Browse files
committed
Update README.md
1 parent 79bcd13 commit 5c45440

File tree

1 file changed

+104
-25
lines changed

1 file changed

+104
-25
lines changed

README.md

Lines changed: 104 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -181,40 +181,69 @@ npm run test:run # Run tests once
181181
dotnet test
182182
```
183183

184-
### 5. Build for Production
185-
```bash
186-
cd MyApp.Client
187-
npm run publish
188-
```
189-
This builds the Next.js static export and publishes the .NET application.
184+
## Configuration
190185

191-
## Deployment Options
186+
### Key Configuration Files
192187

193-
### Docker
194-
195-
Built-in container support with .NET SDK:
188+
- **MyApp/appsettings.json** - Application configuration
189+
- **MyApp.Client/next.config.mjs** - Next.js configuration
190+
- **MyApp.Client/styles/index.css** - Tailwind CSS configuration
191+
- **config/deploy.yml** - Kamal deployment settings
196192

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

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

209-
### Traditional Hosting
210-
Deploy as a standard ASP.NET Core application to IIS, Kestrel, or any hosting provider.
240+
### SMTP Email
211241

212-
## Key Configuration Files
242+
Enable email sending by uncommenting in `Program.cs`:
213243

214-
- **MyApp/appsettings.json** - Application configuration
215-
- **MyApp.Client/next.config.mjs** - Next.js configuration
216-
- **MyApp.Client/styles/index.css** - Tailwind CSS configuration
217-
- **config/deploy.yml** - Kamal deployment settings
244+
```csharp
245+
services.AddSingleton<IEmailSender<ApplicationUser>, EmailSender>();
246+
```
218247

219248
## Upgrading to Enterprise Database
220249

@@ -232,6 +261,56 @@ npx add-in ef-postgres
232261
npx add-in db-identity
233262
```
234263

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

237316
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)