Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 40 additions & 3 deletions docs/docs/reference/supported-resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -1175,7 +1175,7 @@ resources:
admins: [ "vitaly", "dmitriy" ] # Admin user emails
developers: [ ] # Developer user emails

# Backup configuration
# Simple backup configuration (backwards compatible)
backup:
every: 4h # Backup frequency
retention: 24h # Retention period
Expand All @@ -1195,11 +1195,48 @@ resources:
cloudProvider: AWS
admins: [ "vitaly", "dmitriy" ]
developers: [ ]

# Advanced multi-tier backup configuration
backup:
every: 1h # More frequent backups
retention: 168h # Longer retention (1 week)
advanced:
# Hourly snapshots: Every 1 hour (retained 2 days)
hourly:
every: 1 # Every 1 hour
retainFor: 2 # Retain for 2 days (unit: days - default)

# Daily snapshots: Every day (retained 35 days)
daily:
every: 1 # Every 1 day
retainFor: 35 # Retain for 35 days (unit: days - default)

# Weekly snapshots: Every week (retained 8 weeks)
weekly:
every: 1 # Every 1 week
retainFor: 8 # Retain for 8 weeks (unit: weeks - default)

# Monthly snapshots: 1st of month (retained 6 months)
monthly:
every: 1 # Every 1 month
retainFor: 6 # Retain for 6 months (unit: months - default)

# Point-in-Time Recovery: Continuous oplog streaming
pointInTimeRecovery:
enabled: true # Enable PITR
oplogSizeGB: 2.0 # 2GB oplog size
oplogMinRetentionHours: 24 # Minimum 24 hours retention

```

**Backup Security:**

MongoDB Atlas encrypts **all backups automatically by default** using your cloud provider's encryption:
- **Automatic encryption**: No configuration required - all snapshots are encrypted at rest
- **Cloud provider managed**: Encryption keys managed by AWS/GCP/Azure
- **Universal**: Applies to all cluster tiers and backup types (hourly, daily, weekly, monthly)
- **Secure by design**: Ensures backup data is always protected on disk

For enterprise customers requiring additional control, MongoDB Atlas also supports Customer Key Management (CKM) using your own KMS keys, but this requires separate configuration outside of Simple Container.

**Client Access:**

When this resource is used in a client stack via the `uses` section, Simple Container automatically injects environment variables and template placeholders for MongoDB Atlas database connection.
Expand Down
3 changes: 3 additions & 0 deletions docs/schemas/aws/postgresconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
"engineVersion": {
"type": "string"
},
"initSQL": {
"type": "string"
},
"instanceClass": {
"type": "string"
},
Expand Down
3 changes: 3 additions & 0 deletions docs/schemas/gcp/redisconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
"adopt": {
"type": "boolean"
},
"authorizedNetwork": {
"type": "string"
},
"instanceId": {
"type": "string"
},
Expand Down
155 changes: 151 additions & 4 deletions docs/schemas/mongodb/atlasconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,158 @@
"backup": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"advanced": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"daily": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"dayOfMonth": {
"type": "integer"
},
"dayOfWeek": {
"type": "integer"
},
"every": {
"type": "integer"
},
"retainFor": {
"type": "integer"
},
"unit": {
"type": "string"
}
},
"required": [
"every",
"retainFor"
],
"type": "object"
},
"export": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"exportBucketId": {
"type": "string"
},
"exportBucketUrl": {
"type": "string"
},
"frequencyType": {
"type": "string"
}
},
"required": [
"exportBucketId",
"frequencyType"
],
"type": "object"
},
"hourly": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"dayOfMonth": {
"type": "integer"
},
"dayOfWeek": {
"type": "integer"
},
"every": {
"type": "integer"
},
"retainFor": {
"type": "integer"
},
"unit": {
"type": "string"
}
},
"required": [
"every",
"retainFor"
],
"type": "object"
},
"monthly": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"dayOfMonth": {
"type": "integer"
},
"dayOfWeek": {
"type": "integer"
},
"every": {
"type": "integer"
},
"retainFor": {
"type": "integer"
},
"unit": {
"type": "string"
}
},
"required": [
"every",
"retainFor"
],
"type": "object"
},
"pointInTimeRecovery": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"enabled": {
"type": "boolean"
},
"oplogMinRetentionHours": {
"type": "integer"
},
"oplogSizeGB": {
"type": "number"
}
},
"required": [
"enabled"
],
"type": "object"
},
"weekly": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
"dayOfMonth": {
"type": "integer"
},
"dayOfWeek": {
"type": "integer"
},
"every": {
"type": "integer"
},
"retainFor": {
"type": "integer"
},
"unit": {
"type": "string"
}
},
"required": [
"every",
"retainFor"
],
"type": "object"
}
},
"required": [],
"type": "object"
},
"every": {
"type": "string"
},
"retention": {
"type": "string"
}
},
"required": [
"every",
"retention"
],
"required": [],
"type": "object"
},
"cloudProvider": {
Expand All @@ -40,6 +181,9 @@
"clusterName": {
"type": "string"
},
"deletionProtection": {
"type": "boolean"
},
"developers": {
"items": {
"type": "string"
Expand Down Expand Up @@ -81,6 +225,9 @@
"instanceSize": {
"type": "string"
},
"namingStrategyVersion": {
"type": "integer"
},
"networkConfig": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"properties": {
Expand Down
58 changes: 56 additions & 2 deletions pkg/clouds/mongodb/mongodb.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,62 @@ type PrivateLinkEndpoint struct {
}

type AtlasBackup struct {
Every string `json:"every" yaml:"every"` // e.g. 2h
Retention string `json:"retention" yaml:"retention"` // e.g. 24h
// Basic configuration (backwards compatible)
Every string `json:"every,omitempty" yaml:"every,omitempty"` // e.g. 2h
Retention string `json:"retention,omitempty" yaml:"retention,omitempty"` // e.g. 24h

// Advanced multi-tier backup configuration
Advanced *AtlasAdvancedBackup `json:"advanced,omitempty" yaml:"advanced,omitempty"`
}

// AtlasAdvancedBackup provides sophisticated backup scheduling with multiple retention tiers
type AtlasAdvancedBackup struct {
// Individual schedule policies (can be combined)
Hourly *AtlasBackupPolicy `json:"hourly,omitempty" yaml:"hourly,omitempty"`
Daily *AtlasBackupPolicy `json:"daily,omitempty" yaml:"daily,omitempty"`
Weekly *AtlasBackupPolicy `json:"weekly,omitempty" yaml:"weekly,omitempty"`
Monthly *AtlasBackupPolicy `json:"monthly,omitempty" yaml:"monthly,omitempty"`

// Point-in-Time Recovery configuration
PointInTimeRecovery *AtlasPointInTimeRecovery `json:"pointInTimeRecovery,omitempty" yaml:"pointInTimeRecovery,omitempty"`

// Export configuration for cross-region/project backups
Export *AtlasBackupExport `json:"export,omitempty" yaml:"export,omitempty"`
}

// AtlasBackupPolicy defines a backup schedule with retention
type AtlasBackupPolicy struct {
// Schedule frequency
Every int `json:"every" yaml:"every"` // e.g. 1 for every 1 hour/day/week/month

// Retention duration (unit inferred from backup type context)
RetainFor int `json:"retainFor" yaml:"retainFor"` // e.g. 2 for retain for 2 days/weeks/months
Unit string `json:"unit,omitempty" yaml:"unit,omitempty"` // "days", "weeks", "months" (optional, defaults based on backup type)

// Weekly-specific configuration (not supported in current provider)
DayOfWeek *int `json:"dayOfWeek,omitempty" yaml:"dayOfWeek,omitempty"` // 1=Sunday, 7=Saturday

// Monthly-specific configuration (not supported in current provider)
DayOfMonth *int `json:"dayOfMonth,omitempty" yaml:"dayOfMonth,omitempty"` // 1-31
}

// AtlasPointInTimeRecovery configures continuous oplog streaming
type AtlasPointInTimeRecovery struct {
Enabled bool `json:"enabled" yaml:"enabled"`

// Oplog retention window
OplogSizeGB *float64 `json:"oplogSizeGB,omitempty" yaml:"oplogSizeGB,omitempty"` // GB of oplog to retain
OplogMinRetentionHours *int `json:"oplogMinRetentionHours,omitempty" yaml:"oplogMinRetentionHours,omitempty"` // Minimum oplog retention in hours
}

// AtlasBackupExport configures cross-region or cross-project backup exports
type AtlasBackupExport struct {
// Export frequency (typically less frequent than main backups)
FrequencyType string `json:"frequencyType" yaml:"frequencyType"` // "daily", "weekly", "monthly"

// Export destinations
ExportBucketId string `json:"exportBucketId" yaml:"exportBucketId"` // Atlas-managed cloud storage bucket
ExportBucketUrl *string `json:"exportBucketUrl,omitempty" yaml:"exportBucketUrl,omitempty"` // Custom S3/GCS bucket URL
}

func ReadAtlasConfig(config *api.Config) (api.Config, error) {
Expand Down
Loading
Loading