Commit 24f7dad
feat(terraform): add multi-cloud infrastructure with OCI free tier support (#127)
* feat(terraform): add multi-cloud infrastructure modules for OCI deployment
Add Terraform modules for deploying TMI to Oracle Cloud Infrastructure:
- Network module: VCN, subnets, gateways, NSGs
- Database module: Autonomous Database Free Tier with private endpoint
- Secrets module: OCI Vault with secrets and IAM policies
- Logging module: Log groups, service connectors, alarms
- Compute module: Container instances and load balancer
Environment configuration for OCI Free Tier included with sensible defaults.
Makefile targets added:
- tf-init, tf-plan, tf-apply, tf-destroy
- deploy-oci, deploy-oci-plan
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat(logging): add cloud logging support with OCI integration
Add CloudLogWriter interface and OCI Logging implementation:
- CloudLogWriter: Generic interface for cloud logging providers
- CloudLogHandler: slog.Handler that writes to both local and cloud
- OCICloudWriter: OCI Logging service implementation
- Batched async writes with configurable buffer
- Automatic flush on timeout or buffer full
- Health tracking and graceful degradation
- NoopCloudWriter: For testing or when cloud logging disabled
Cloud logging is additive - local file/console logging continues
to work independently. If cloud logging fails, only cloud writes
are affected; local logging remains uninterrupted.
Configuration options:
- CloudWriter: Provider instance (nil to disable)
- CloudLogLevel: Minimum level for cloud (defaults to local level)
- CloudLogBufferSize: Async buffer size (default: 1000)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(terraform/oci): update modules for OCI free tier deployment
- Add TMI_DATABASE_URL environment variable for Oracle ADB connection
- Fix OCI provider v7.x API changes (ip_addresses format)
- Update database module for ECPU model (remove cpu_core_count)
- Make private endpoint conditional for free tier (not supported)
- Disable bucket versioning for log archive (conflicts with retention)
- Add sensitive flag to outputs containing credentials
- Comment out container logging (incorrect service name)
- Add region variable to database module for wallet PAR URL
These changes enable successful deployment of TMI on OCI Always Free tier
resources including Oracle Autonomous Database, Container Instances,
Load Balancer, and OCI Vault for secrets management.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(oci): improve container startup and debugging for OCI deployment
- Add bash and unzip packages to Oracle container image
- Fix slogging to respect TMI_LOG_DIR during early initialization
- Add JWT secret variable and env config to compute module
- Add HTTPS egress rule for ADB Free Tier public endpoint
- Increase health check initial delay to 60s
- Improve entrypoint script with detailed debugging output
- Remove Docker HEALTHCHECK (conflicts with OCI health check)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(oci): fix Oracle wallet path and Redis connection for OCI deployment
- Fix entrypoint script sed pattern to properly update sqlnet.ora
DIRECTORY path using non-greedy regex [^"]* instead of .*
- Change REDIS_URL to TMI_REDIS_URL to match app config expectations
- Remove Redis password from URL since distroless Redis container
doesn't support password auth (TODO for future fix)
The container now successfully connects to Oracle ADB using wallet
authentication and to Redis for caching/session management.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(oci): fix SystemSetting migration and Redis auth for Oracle ADB
- Remove GORM default tag from SystemSetting.SettingType that caused
Oracle migration to fail silently (unquoted 'string' parsed as identifier)
- Add Redis password to TMI_REDIS_URL in terraform config for proper
authentication with Oracle Linux Redis container
- Add --platform linux/amd64 flag to container build script for OCI
Container Instances which use AMD64 shapes
These fixes resolve ORA-00942 (table not found) errors during server
startup and NOAUTH authentication errors when connecting to Redis.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat(oci): add OCI cloud logging with Resource Principal auth
- Add cloud logging initialization from environment variables in main.go
- Support Resource Principal authentication for OCI Container Instances
- Wire OCI Logging service to compute module via oci_log_id variable
- Add cloud_log_level configuration for filtering cloud logs
- Fix dynamic group matching rule to use 'computecontainerinstance' resource type
Cloud logging is now automatically enabled when TMI_CLOUD_LOG_ENABLED=true
with TMI_OCI_LOG_ID set. Uses Resource Principal for Container Instances,
falls back to Instance Principal for VMs, then to ~/.oci/config for local dev.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(version): reset version to 1.1.0 for feature branch
These are fixes to the terraform-multi-cloud feature, not a new feature.
Skipping post-commit hook to prevent auto-increment.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(slogging): escape message in JSON fallback to prevent injection
CodeQL alert #1221 - unsafe quoting vulnerability in OCI cloud writer.
Use json.Marshal to properly escape special characters in the message
before embedding in the JSON fallback string.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix(slogging): use json.Marshal for entire fallback to satisfy CodeQL
Avoid string interpolation entirely by marshaling a map struct.
CodeQL go/unsafe-quoting doesn't trust fmt.Sprintf even with
pre-marshaled values.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>1 parent 332702d commit 24f7dad
File tree
36 files changed
+3875
-142
lines changed- api
- models
- cmd/server
- internal/slogging
- scripts
- terraform
- environments/oci-free-tier
- modules
- compute/oci
- database/oci
- logging/oci
- network/oci
- secrets/oci
36 files changed
+3875
-142
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
| 55 | + | |
54 | 56 | | |
55 | 57 | | |
56 | 58 | | |
| |||
98 | 100 | | |
99 | 101 | | |
100 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
| 3 | + | |
| 4 | + | |
5 | 5 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
131 | 131 | | |
132 | 132 | | |
133 | 133 | | |
134 | | - | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
135 | 139 | | |
136 | 140 | | |
137 | 141 | | |
| |||
155 | 159 | | |
156 | 160 | | |
157 | 161 | | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
158 | 168 | | |
159 | 169 | | |
160 | 170 | | |
| |||
171 | 181 | | |
172 | 182 | | |
173 | 183 | | |
174 | | - | |
175 | | - | |
176 | | - | |
| 184 | + | |
| 185 | + | |
177 | 186 | | |
178 | 187 | | |
179 | 188 | | |
180 | 189 | | |
181 | | - | |
182 | | - | |
| 190 | + | |
| 191 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1096 | 1096 | | |
1097 | 1097 | | |
1098 | 1098 | | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
| 1110 | + | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
| 1125 | + | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
| 1135 | + | |
| 1136 | + | |
| 1137 | + | |
| 1138 | + | |
| 1139 | + | |
| 1140 | + | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
| 1146 | + | |
| 1147 | + | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
| 1162 | + | |
| 1163 | + | |
| 1164 | + | |
| 1165 | + | |
| 1166 | + | |
| 1167 | + | |
| 1168 | + | |
| 1169 | + | |
| 1170 | + | |
| 1171 | + | |
| 1172 | + | |
| 1173 | + | |
1099 | 1174 | | |
1100 | 1175 | | |
1101 | 1176 | | |
| |||
1561 | 1636 | | |
1562 | 1637 | | |
1563 | 1638 | | |
| 1639 | + | |
| 1640 | + | |
| 1641 | + | |
| 1642 | + | |
| 1643 | + | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
| 1647 | + | |
| 1648 | + | |
| 1649 | + | |
| 1650 | + | |
1564 | 1651 | | |
1565 | 1652 | | |
1566 | 1653 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
309 | 309 | | |
310 | 310 | | |
311 | 311 | | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
317 | 317 | | |
318 | 318 | | |
319 | 319 | | |
| |||
496 | 496 | | |
497 | 497 | | |
498 | 498 | | |
499 | | - | |
| 499 | + | |
500 | 500 | | |
501 | | - | |
| 501 | + | |
502 | 502 | | |
503 | 503 | | |
504 | 504 | | |
| |||
525 | 525 | | |
526 | 526 | | |
527 | 527 | | |
528 | | - | |
| 528 | + | |
529 | 529 | | |
530 | | - | |
| 530 | + | |
531 | 531 | | |
532 | 532 | | |
533 | 533 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| |||
383 | 383 | | |
384 | 384 | | |
385 | 385 | | |
386 | | - | |
| 386 | + | |
387 | 387 | | |
388 | | - | |
| 388 | + | |
389 | 389 | | |
390 | 390 | | |
391 | 391 | | |
| |||
406 | 406 | | |
407 | 407 | | |
408 | 408 | | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | | - | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
413 | 413 | | |
414 | 414 | | |
415 | 415 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
14 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
15 | 19 | | |
16 | 20 | | |
17 | 21 | | |
18 | | - | |
19 | | - | |
20 | | - | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
23 | 25 | | |
| |||
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
44 | | - | |
| 46 | + | |
45 | 47 | | |
46 | | - | |
| 48 | + | |
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
50 | | - | |
| 52 | + | |
51 | 53 | | |
52 | | - | |
| 54 | + | |
53 | 55 | | |
54 | 56 | | |
55 | 57 | | |
56 | | - | |
| 58 | + | |
57 | 59 | | |
58 | | - | |
| 60 | + | |
59 | 61 | | |
60 | 62 | | |
61 | 63 | | |
62 | | - | |
| 64 | + | |
63 | 65 | | |
64 | | - | |
| 66 | + | |
65 | 67 | | |
66 | 68 | | |
67 | 69 | | |
68 | | - | |
| 70 | + | |
69 | 71 | | |
70 | | - | |
| 72 | + | |
71 | 73 | | |
72 | 74 | | |
73 | 75 | | |
74 | | - | |
| 76 | + | |
75 | 77 | | |
76 | | - | |
| 78 | + | |
77 | 79 | | |
78 | 80 | | |
79 | 81 | | |
80 | | - | |
| 82 | + | |
81 | 83 | | |
82 | | - | |
| 84 | + | |
83 | 85 | | |
84 | 86 | | |
85 | 87 | | |
86 | | - | |
| 88 | + | |
87 | 89 | | |
88 | | - | |
| 90 | + | |
89 | 91 | | |
90 | 92 | | |
91 | 93 | | |
| |||
0 commit comments