@kirschbaum-development/sst-laravel 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -0
- package/docs/api.md +19 -1
- package/laravel-sst.ts +68 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -88,6 +88,21 @@ const app = new LaravelService('MyLaravelApp', {
|
|
|
88
88
|
|
|
89
89
|
Check all the `web` options [here](https://github.com/kirschbaum-development/sst-laravel/blob/main/docs/api.md#web).
|
|
90
90
|
|
|
91
|
+
#### Load balancer health check
|
|
92
|
+
|
|
93
|
+
Laravel ships a built-in `/up` health endpoint. Point the load balancer at it via `web.healthCheck` — a shortcut over `loadBalancer.health` that targets the default forward port for you:
|
|
94
|
+
|
|
95
|
+
```js
|
|
96
|
+
const app = new LaravelService('MyLaravelApp', {
|
|
97
|
+
web: {
|
|
98
|
+
domain: { name: 'app.example.com' },
|
|
99
|
+
healthCheck: { path: '/up' },
|
|
100
|
+
},
|
|
101
|
+
});
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
All [`loadBalancer.health` options](https://sst.dev/docs/component/aws/service/#loadbalancer-health) are supported (`interval`, `timeout`, `healthyThreshold`, `unhealthyThreshold`, `successCodes`). If you set `web.loadBalancer` explicitly, `healthCheck` is ignored — configure `loadBalancer.health` directly there.
|
|
105
|
+
|
|
91
106
|
### Reverb
|
|
92
107
|
|
|
93
108
|
You can deploy a dedicated Laravel Reverb service for WebSocket traffic. Reverb runs as a worker-style container using `php artisan reverb:start`, but SST Laravel also attaches a load balancer so you can give it its own public domain.
|
package/docs/api.md
CHANGED
|
@@ -259,7 +259,25 @@ web: {
|
|
|
259
259
|
|
|
260
260
|
#### `web.health`
|
|
261
261
|
- **Type:** `ServiceArgs["health"]`
|
|
262
|
-
- **Description:**
|
|
262
|
+
- **Description:** ECS container-level health check for the web service. Distinct from `web.healthCheck` (load balancer).
|
|
263
|
+
|
|
264
|
+
#### `web.healthCheck`
|
|
265
|
+
- **Type:** `Input<LaravelHealthCheck>`
|
|
266
|
+
- **Description:** Load balancer health check applied to the default forward port (`8080/http`). Shorthand so you don't have to override the full `loadBalancer` config just to set a path. Ignored when `loadBalancer` is provided — configure `loadBalancer.health` directly in that case.
|
|
267
|
+
|
|
268
|
+
**Example:**
|
|
269
|
+
```typescript
|
|
270
|
+
web: {
|
|
271
|
+
domain: { name: 'app.example.com' },
|
|
272
|
+
healthCheck: {
|
|
273
|
+
path: '/up',
|
|
274
|
+
successCodes: '200',
|
|
275
|
+
interval: '30 seconds',
|
|
276
|
+
healthyThreshold: 2,
|
|
277
|
+
unhealthyThreshold: 3,
|
|
278
|
+
},
|
|
279
|
+
}
|
|
280
|
+
```
|
|
263
281
|
|
|
264
282
|
#### `web.executionRole`
|
|
265
283
|
- **Type:** `ServiceArgs["executionRole"]`
|
package/laravel-sst.ts
CHANGED
|
@@ -132,11 +132,72 @@ export interface LaravelServiceArgs {
|
|
|
132
132
|
>;
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
+
/**
|
|
136
|
+
* Shorthand for the load balancer health check applied to the default forward
|
|
137
|
+
* port. Mirrors the inner shape of SST's `loadBalancer.health` entry, minus the
|
|
138
|
+
* per-port keying which the package fills in for you.
|
|
139
|
+
*
|
|
140
|
+
* Not used when {@link LaravelWebArgs.loadBalancer} is provided — in that case
|
|
141
|
+
* configure `loadBalancer.health` directly.
|
|
142
|
+
*/
|
|
143
|
+
export interface LaravelHealthCheck {
|
|
144
|
+
/**
|
|
145
|
+
* The URL path the load balancer pings for health checks.
|
|
146
|
+
* @default `"/"`
|
|
147
|
+
*/
|
|
148
|
+
path?: Input<string>;
|
|
149
|
+
/**
|
|
150
|
+
* Time between health check requests. Between `5 seconds` and `300 seconds`.
|
|
151
|
+
* @default `"30 seconds"`
|
|
152
|
+
*/
|
|
153
|
+
interval?: Input<`${number} ${'second' | 'seconds' | 'minute' | 'minutes'}`>;
|
|
154
|
+
/**
|
|
155
|
+
* Per-request timeout. Between `2 seconds` and `120 seconds`.
|
|
156
|
+
* @default `"5 seconds"`
|
|
157
|
+
*/
|
|
158
|
+
timeout?: Input<`${number} ${'second' | 'seconds' | 'minute' | 'minutes'}`>;
|
|
159
|
+
/**
|
|
160
|
+
* Consecutive successes required to mark a target healthy. Between 2 and 10.
|
|
161
|
+
* @default `5`
|
|
162
|
+
*/
|
|
163
|
+
healthyThreshold?: Input<number>;
|
|
164
|
+
/**
|
|
165
|
+
* Consecutive failures required to mark a target unhealthy. Between 2 and 10.
|
|
166
|
+
* @default `2`
|
|
167
|
+
*/
|
|
168
|
+
unhealthyThreshold?: Input<number>;
|
|
169
|
+
/**
|
|
170
|
+
* HTTP response codes treated as successful (e.g. `"200"`, `"200-299"`).
|
|
171
|
+
* @default `"200"`
|
|
172
|
+
*/
|
|
173
|
+
successCodes?: Input<string>;
|
|
174
|
+
}
|
|
175
|
+
|
|
135
176
|
export interface LaravelWebArgs extends LaravelServiceArgs {
|
|
136
177
|
/**
|
|
137
178
|
* Custom domain for the web layer. (if you don't provide a domain name, you will be able to use the load balancer domain for testing (http only))
|
|
138
179
|
*/
|
|
139
180
|
domain?: LaravelDomain;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Load balancer health check for the web service. The package wires this
|
|
184
|
+
* to the default forward port (`8080/http`), so you only specify the
|
|
185
|
+
* check itself — not the per-port key.
|
|
186
|
+
*
|
|
187
|
+
* Distinct from {@link LaravelServiceArgs.health}, which is the ECS
|
|
188
|
+
* container-level health check.
|
|
189
|
+
*
|
|
190
|
+
* Ignored when `loadBalancer` is set — configure `loadBalancer.health`
|
|
191
|
+
* yourself in that case.
|
|
192
|
+
*
|
|
193
|
+
* @example
|
|
194
|
+
* ```js
|
|
195
|
+
* web: {
|
|
196
|
+
* healthCheck: { path: '/up' },
|
|
197
|
+
* }
|
|
198
|
+
* ```
|
|
199
|
+
*/
|
|
200
|
+
healthCheck?: Input<LaravelHealthCheck>;
|
|
140
201
|
}
|
|
141
202
|
|
|
142
203
|
export interface LaravelReverbArgs extends LaravelServiceArgs {
|
|
@@ -415,6 +476,13 @@ export class LaravelService extends Component {
|
|
|
415
476
|
ports: getDefaultPublicPorts(
|
|
416
477
|
args.web?.domain,
|
|
417
478
|
),
|
|
479
|
+
...(args.web?.healthCheck
|
|
480
|
+
? {
|
|
481
|
+
health: {
|
|
482
|
+
'8080/http': args.web.healthCheck,
|
|
483
|
+
},
|
|
484
|
+
}
|
|
485
|
+
: {}),
|
|
418
486
|
},
|
|
419
487
|
|
|
420
488
|
dev: {
|
package/package.json
CHANGED