Skip to content

Commit e82f3fc

Browse files
committed
Document persistent storage
1 parent 21366a0 commit e82f3fc

File tree

2 files changed

+84
-3
lines changed

2 files changed

+84
-3
lines changed

README.md

Lines changed: 81 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,14 @@ export type WebServerServiceOptions = {
171171
}>;
172172
size?: pulumi.Input<Size>;
173173
healthCheckPath?: pulumi.Input<string>;
174+
persistentStorageConfig?: pulumi.Input<{
175+
volumes: { name: string }[];
176+
mountPoints: {
177+
sourceVolume: string;
178+
containerPath: string;
179+
readOnly?: boolean;
180+
}[];
181+
}>;
174182
taskExecutionRoleInlinePolicies?: pulumi.Input<
175183
pulumi.Input<RoleInlinePolicy>[]
176184
>;
@@ -219,6 +227,14 @@ type MongoServiceOptions = {
219227
password?: pulumi.Input<string>;
220228
port?: pulumi.Input<number>;
221229
size?: pulumi.Input<Size>;
230+
persistentStorageConfig?: pulumi.Input<{
231+
volumes: { name: string }[];
232+
mountPoints: {
233+
sourceVolume: string;
234+
containerPath: string;
235+
readOnly?: boolean;
236+
}[];
237+
}>;
222238
tags?: pulumi.Input<{
223239
[key: string]: pulumi.Input<string>;
224240
}>;
@@ -233,7 +249,14 @@ type EcsServiceOptions = {
233249
port: pulumi.Input<number>;
234250
enableServiceAutoDiscovery: pulumi.Input<boolean>;
235251
lbTargetGroupArn?: aws.lb.TargetGroup['arn'];
236-
persistentStorageVolumePath?: pulumi.Input<string>;
252+
persistentStorageConfig?: pulumi.Input<{
253+
volumes: { name: string }[];
254+
mountPoints: {
255+
sourceVolume: string;
256+
containerPath: string;
257+
readOnly?: boolean;
258+
}[];
259+
}>;
237260
securityGroup?: aws.ec2.SecurityGroup;
238261
assignPublicIp?: pulumi.Input<boolean>;
239262
dockerCommand?: pulumi.Input<string[]>;
@@ -339,6 +362,37 @@ const project = new studion.Project('demo-project', {
339362
});
340363
```
341364

365+
### Persistent Storage Configuration
366+
367+
Services that require persistent storage (e.g. `ECS`, `Mongo`) can be configured with multiple EFS volumes and mount points.
368+
Currently, only one access point is configured, with root directory set to `/data`.
369+
The configuration consists of two main parts:
370+
371+
1. `volumes`: Define the EFS volumes to be created
372+
2. `mountPoints`: Specify where these volumes should be mounted in the container
373+
374+
Example configuration:
375+
376+
```ts
377+
persistentStorageConfig: {
378+
volumes: [
379+
{ name: 'data-volume' },
380+
{ name: 'config-volume' }
381+
],
382+
mountPoints: [
383+
{
384+
sourceVolume: 'data-volume',
385+
containerPath: '/data',
386+
},
387+
{
388+
sourceVolume: 'config-volume',
389+
containerPath: '/config',
390+
readOnly: true
391+
}
392+
]
393+
}
394+
```
395+
342396
### Database
343397

344398
AWS RDS Postgres instance.
@@ -559,6 +613,14 @@ export type WebServerArgs = {
559613
environment?: aws.ecs.KeyValuePair[];
560614
secrets?: aws.ecs.Secret[];
561615
healthCheckPath?: pulumi.Input<string>;
616+
persistentStorageConfig?: pulumi.Input<{
617+
volumes: { name: string }[];
618+
mountPoints: {
619+
sourceVolume: string;
620+
containerPath: string;
621+
readOnly?: boolean;
622+
}[];
623+
}>;
562624
taskExecutionRoleInlinePolicies?: pulumi.Input<
563625
pulumi.Input<RoleInlinePolicy>[]
564626
>;
@@ -655,6 +717,14 @@ export type MongoArgs = {
655717
password?: pulumi.Input<string>;
656718
port?: pulumi.Input<number>;
657719
size?: pulumi.Input<Size>;
720+
persistentStorageConfig?: pulumi.Input<{
721+
volumes: { name: string }[];
722+
mountPoints: {
723+
sourceVolume: string;
724+
containerPath: string;
725+
readOnly?: boolean;
726+
}[];
727+
}>;
658728
tags?: pulumi.Input<{
659729
[key: string]: pulumi.Input<string>;
660730
}>;
@@ -665,6 +735,8 @@ If the password is not specified it will be autogenerated.
665735
The Mongo password is stored as a secret inside AWS Secret Manager.
666736
The secret will be available on the `Mongo` resource as `password.secret`.
667737

738+
The Mongo component comes with a default persistent storage configuration that mounts an EFS volume `mongo` to `/data/db`. You can override this by providing your own `persistentStorageConfig`.
739+
668740
### Ecs Service
669741

670742
AWS ECS Fargate.
@@ -708,7 +780,14 @@ export type EcsServiceArgs = {
708780
environment?: aws.ecs.KeyValuePair[];
709781
secrets?: aws.ecs.Secret[];
710782
enableServiceAutoDiscovery: pulumi.Input<boolean>;
711-
persistentStorageVolumePath?: pulumi.Input<string>;
783+
persistentStorageConfig?: pulumi.Input<{
784+
volumes: { name: string }[];
785+
mountPoints: {
786+
sourceVolume: string;
787+
containerPath: string;
788+
readOnly?: boolean;
789+
}[];
790+
}>;
712791
dockerCommand?: pulumi.Input<string[]>;
713792
lbTargetGroupArn?: aws.lb.TargetGroup['arn'];
714793
securityGroup?: aws.ec2.SecurityGroup;

src/components/mongo.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ export type MongoArgs = Pick<
2525
*/
2626
port?: pulumi.Input<number>;
2727
/**
28-
* TODO document parameter
28+
* Configuration for persistent storage using EFS volumes.
29+
* By default, creates a volume named 'mongo' mounted at '/data/db'.
30+
* You can override this by providing your own volume and mount point configuration.
2931
*/
3032
persistentStorageConfig?: EcsServiceArgs['persistentStorageConfig']
3133
};

0 commit comments

Comments
 (0)