From 193eb1c50d50a40739f39acc9013ce48cd7ac13d Mon Sep 17 00:00:00 2001 From: Bhaskar Singhvi <31942378+bsinghvi@users.noreply.github.com> Date: Mon, 29 Apr 2024 15:46:04 -0400 Subject: [PATCH] (internal) initializing ElastiCache stack for Fern Docs (#723) --- pnpm-lock.yaml | 268 +++++++++++++++++- servers/fdr-deploy/package.json | 8 +- .../fdr-deploy/scripts/elasticache-stack.ts | 69 +++++ .../fdr-deploy/scripts/fdr-deploy-stack.ts | 11 + 4 files changed, 352 insertions(+), 4 deletions(-) create mode 100644 servers/fdr-deploy/scripts/elasticache-stack.ts diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2f26c8b8e2..26459686c9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1559,6 +1559,9 @@ importers: constructs: specifier: ^10.3.0 version: 10.3.0 + redis: + specifier: ^4.6.13 + version: 4.6.13 source-map-support: specifier: ^0.5.21 version: 0.5.21 @@ -1566,6 +1569,9 @@ importers: '@fern-platform/configs': specifier: workspace:* version: link:../../packages/configs + '@types/jest': + specifier: ^29.5.12 + version: 29.5.12 '@types/node': specifier: ^18.7.18 version: 18.19.26 @@ -1573,11 +1579,14 @@ importers: specifier: 2.6.0 version: 2.6.0 aws-cdk: - specifier: ^2.118.0 - version: 2.133.0 + specifier: ^2.139.0 + version: 2.139.0 prettier: specifier: ^3.2.4 version: 3.2.4 + redis-cli: + specifier: ^2.1.2 + version: 2.1.2 ts-node: specifier: ^10.9.1 version: 10.9.1(@types/node@18.19.26)(typescript@5.4.3) @@ -6839,6 +6848,55 @@ packages: '@babel/runtime': 7.24.0 dev: false + /@redis/bloom@1.2.0(@redis/client@1.5.14): + resolution: {integrity: sha512-HG2DFjYKbpNmVXsa0keLHp/3leGJz1mjh09f2RLGGLQZzSHpkmZWuwJbAvo3QcRY8p80m5+ZdXZdYOSBLlp7Cg==} + peerDependencies: + '@redis/client': ^1.0.0 + dependencies: + '@redis/client': 1.5.14 + dev: false + + /@redis/client@1.5.14: + resolution: {integrity: sha512-YGn0GqsRBFUQxklhY7v562VMOP0DcmlrHHs3IV1mFE3cbxe31IITUkqhBcIhVSI/2JqtWAJXg5mjV4aU+zD0HA==} + engines: {node: '>=14'} + dependencies: + cluster-key-slot: 1.1.2 + generic-pool: 3.9.0 + yallist: 4.0.0 + dev: false + + /@redis/graph@1.1.1(@redis/client@1.5.14): + resolution: {integrity: sha512-FEMTcTHZozZciLRl6GiiIB4zGm5z5F3F6a6FZCyrfxdKOhFlGkiAqlexWMBzCi4DcRoyiOsuLfW+cjlGWyExOw==} + peerDependencies: + '@redis/client': ^1.0.0 + dependencies: + '@redis/client': 1.5.14 + dev: false + + /@redis/json@1.0.6(@redis/client@1.5.14): + resolution: {integrity: sha512-rcZO3bfQbm2zPRpqo82XbW8zg4G/w4W3tI7X8Mqleq9goQjAGLL7q/1n1ZX4dXEAmORVZ4s1+uKLaUOg7LrUhw==} + peerDependencies: + '@redis/client': ^1.0.0 + dependencies: + '@redis/client': 1.5.14 + dev: false + + /@redis/search@1.1.6(@redis/client@1.5.14): + resolution: {integrity: sha512-mZXCxbTYKBQ3M2lZnEddwEAks0Kc7nauire8q20oA0oA/LoA+E/b5Y5KZn232ztPb1FkIGqo12vh3Lf+Vw5iTw==} + peerDependencies: + '@redis/client': ^1.0.0 + dependencies: + '@redis/client': 1.5.14 + dev: false + + /@redis/time-series@1.0.5(@redis/client@1.5.14): + resolution: {integrity: sha512-IFjIgTusQym2B5IZJG3XKr5llka7ey84fw/NOYqESP5WUfQs9zz1ww/9+qoz4ka/S6KcGBodzlCeZ5UImKbscg==} + peerDependencies: + '@redis/client': ^1.0.0 + dependencies: + '@redis/client': 1.5.14 + dev: false + /@rollup/plugin-commonjs@24.0.0(rollup@2.78.0): resolution: {integrity: sha512-0w0wyykzdyRRPHOb0cQt14mIBLujfAv6GgP6g8nvg/iBxEm112t3YPPq+Buqe2+imvElTka+bjNlJ/gB56TD8g==} engines: {node: '>=14.0.0'} @@ -10749,6 +10807,14 @@ packages: fsevents: 2.3.2 dev: true + /aws-cdk@2.139.0: + resolution: {integrity: sha512-MjMsySQbhR5yTWCphnuVQuS15UdGMV6v4XIM+C8SN7/eUOfv7BFr7QgYMUm5WXCG/f66RnY0zjJbOLRxvcjCrQ==} + engines: {node: '>= 14.15.0'} + hasBin: true + optionalDependencies: + fsevents: 2.3.2 + dev: true + /axe-core@4.7.0: resolution: {integrity: sha512-M0JtH+hlOL5pLQwHOLNYZaXuhqmvS8oExsqB1SBYgA4Dk7u/xx+YdGHXaK5pyUfed5mYXdlYiphWq3G8cRi5JQ==} engines: {node: '>=4'} @@ -11033,6 +11099,10 @@ packages: readable-stream: 3.6.2 dev: true + /bluebird@3.7.2: + resolution: {integrity: sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==} + dev: true + /bn.js@4.12.0: resolution: {integrity: sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==} dev: true @@ -11099,6 +11169,10 @@ packages: resolution: {integrity: sha512-nfulgvOR6S4gt9UKCeGJOuSGBPGiFT6oQ/2UBnvTY/5aQ1PnksW72fhZkM30DzoRRv2WpwZf1vHHEr3mtuXIWQ==} dev: true + /browser-stdout@1.3.1: + resolution: {integrity: sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==} + dev: true + /browserify-aes@1.2.0: resolution: {integrity: sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==} dependencies: @@ -11305,6 +11379,15 @@ packages: /ccount@2.0.1: resolution: {integrity: sha512-eyrF0jiFpY+3drT6383f1qhkbGsLSifNAjA61IUjZjmLCWjItY6LB9ft9YhoDgwfmclB2zhu51Lc7+95b8NRAg==} + /chai@3.5.0: + resolution: {integrity: sha512-eRYY0vPS2a9zt5w5Z0aCeWbrXTEyvk7u/Xf71EzNObrjSCPgMm1Nku/D/u2tiqHBX5j40wWhj54YJLtgn8g55A==} + engines: {node: '>= 0.4.0'} + dependencies: + assertion-error: 1.1.0 + deep-eql: 0.1.3 + type-detect: 1.0.0 + dev: true + /chai@4.4.1: resolution: {integrity: sha512-13sOfMv2+DWduEU+/xbun3LScLoqN17nBeTLUsmDfKdoiC1fr0n9PU4guu4AhRcOVFk/sW8LyZWHuhWtQZiF+g==} engines: {node: '>=4'} @@ -11555,6 +11638,11 @@ packages: engines: {node: '>=6'} dev: false + /cluster-key-slot@1.1.2: + resolution: {integrity: sha512-RMr0FhtfXemyinomL4hrWcYJxmX6deFdCxpJzhDttxgO1+bcCnkk+9drydLVDmAMG7NE6aN/fl4F7ucU/90gAA==} + engines: {node: '>=0.10.0'} + dev: false + /co@4.6.0: resolution: {integrity: sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==} engines: {iojs: '>= 1.0.0', node: '>= 0.12.0'} @@ -11616,6 +11704,11 @@ packages: resolution: {integrity: sha512-3tlv/dIP7FWvj3BsbHrGLJ6l/oKh1O3TcgBqMn+yyCagOxc23fyzDS6HypQbgxWbkpDnf52p1LuR4eWDQ/K9WQ==} dev: true + /colors@1.4.0: + resolution: {integrity: sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==} + engines: {node: '>=0.1.90'} + dev: true + /colorspace@1.1.4: resolution: {integrity: sha512-BgvKJiuVu1igBUF2kEjRCZXol6wiiGbY5ipL/oVPwm0BL9sIpMIzM8IK7vwuxIIzOXMV3Ey5w+vxhm0rR/TN8w==} dependencies: @@ -11632,6 +11725,10 @@ packages: /comma-separated-tokens@2.0.3: resolution: {integrity: sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==} + /commander@2.15.1: + resolution: {integrity: sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==} + dev: true + /commander@2.20.3: resolution: {integrity: sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==} @@ -11771,6 +11868,11 @@ packages: requiresBuild: true dev: true + /core-js@3.37.0: + resolution: {integrity: sha512-fu5vHevQ8ZG4og+LXug8ulUtVxjOcEYvifJr7L5Bfq9GOztVqsKd9/59hUk2ZSbCrS3BqUr3EpaYGIYzq7g3Ug==} + requiresBuild: true + dev: true + /core-util-is@1.0.3: resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==} @@ -12143,6 +12245,18 @@ packages: dependencies: ms: 2.0.0 + /debug@3.1.0(supports-color@5.4.0): + resolution: {integrity: sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + dependencies: + ms: 2.0.0 + supports-color: 5.4.0 + dev: true + /debug@3.2.7: resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==} peerDependencies: @@ -12194,6 +12308,12 @@ packages: optional: true dev: true + /deep-eql@0.1.3: + resolution: {integrity: sha512-6sEotTRGBFiNcqVoeHwnfopbSpi5NbH1VWJmYCVkmxMmaVTT0bUTrNaGyBwhgP4MZL012W/mkzIn3Da+iDYweg==} + dependencies: + type-detect: 0.1.1 + dev: true + /deep-eql@4.1.3: resolution: {integrity: sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==} engines: {node: '>=6'} @@ -12298,6 +12418,11 @@ packages: resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==} engines: {node: '>=0.4.0'} + /denque@1.5.1: + resolution: {integrity: sha512-XwE+iZ4D6ZUB7mfYRMb5wByE8L74HCn30FBN7sWnXksWc1LO1bPDl67pBR9o/kC4z/xSNAwkMYcGgqDV3BE3Hw==} + engines: {node: '>=0.10'} + dev: true + /depcheck@1.4.3: resolution: {integrity: sha512-vy8xe1tlLFu7t4jFyoirMmOR7x7N601ubU9Gkifyr9z8rjBFtEdWHDBMqXyk6OkK+94NXutzddVXJuo0JlUQKQ==} engines: {node: '>=10'} @@ -12441,6 +12566,11 @@ packages: resolution: {integrity: sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + /diff@3.5.0: + resolution: {integrity: sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==} + engines: {node: '>=0.3.1'} + dev: true + /diff@4.0.2: resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==} engines: {node: '>=0.3.1'} @@ -14062,6 +14192,11 @@ packages: resolution: {integrity: sha512-HA4Gx59dw2+tn+UAa7XEV4ufUKI4fH1KgcbenVA9YKSj1QJTT0xh5Mwv5HMFNN3l2OtUe3ZIfuRwSyZS5pLIWw==} dev: false + /generic-pool@3.9.0: + resolution: {integrity: sha512-hymDOu5B53XvN4QT9dBmZxPX4CWhBPPLguTZ9MMFeFa/Kg0xWVfylOVNlJji/E7yTZWFd/q9GO5TxDLq156D7g==} + engines: {node: '>= 4'} + dev: false + /gensync@1.0.0-beta.2: resolution: {integrity: sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==} engines: {node: '>=6.9.0'} @@ -14193,6 +14328,17 @@ packages: minipass: 7.0.4 path-scurry: 1.10.2 + /glob@7.1.2: + resolution: {integrity: sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==} + dependencies: + fs.realpath: 1.0.0 + inflight: 1.0.6 + inherits: 2.0.4 + minimatch: 3.1.2 + once: 1.4.0 + path-is-absolute: 1.0.1 + dev: true + /glob@7.1.6: resolution: {integrity: sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==} dependencies: @@ -14356,6 +14502,11 @@ packages: strip-bom-string: 1.0.0 dev: false + /growl@1.10.5: + resolution: {integrity: sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==} + engines: {node: '>=4.x'} + dev: true + /gunzip-maybe@1.4.2: resolution: {integrity: sha512-4haO1M4mLO91PW57BMsDFf75UmwoRX0GkdD+Faw+Lr+r/OZrOCS0pIBwOL1xCKQqnQzbNFGgK2V2CpBUPeFNTw==} hasBin: true @@ -14618,6 +14769,11 @@ packages: space-separated-tokens: 2.0.2 dev: false + /he@1.1.1: + resolution: {integrity: sha512-z/GDPjlRMNOa2XJiB4em8wJpuuBfrFOlYKTZxtpkdr1uPdibHI8rYA3MY0KDObpVyaes0e/aunid/t88ZI2EKA==} + hasBin: true + dev: true + /he@1.2.0: resolution: {integrity: sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==} hasBin: true @@ -17097,6 +17253,12 @@ packages: resolution: {integrity: sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==} dev: true + /minimatch@3.0.4: + resolution: {integrity: sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==} + dependencies: + brace-expansion: 1.1.11 + dev: true + /minimatch@3.1.2: resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} dependencies: @@ -17127,6 +17289,10 @@ packages: dependencies: brace-expansion: 2.0.1 + /minimist@0.0.8: + resolution: {integrity: sha512-miQKw5Hv4NS1Psg2517mV4e4dYNaO3++hjAvLOAzKqZ61rH8NS1SK+vbfBWZ5PY/Me/bEWhUwqMghEW5Fb9T7Q==} + dev: true + /minimist@1.2.8: resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} @@ -17173,6 +17339,14 @@ packages: deprecated: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.) dev: false + /mkdirp@0.5.1: + resolution: {integrity: sha512-SknJC52obPfGQPnjIkXbmA6+5H15E+fR+E4iR2oQ3zzCLbd7/ONua69R/Gw7AgkTLsRG+r5fzksYwWe1AgTyWA==} + deprecated: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.) + hasBin: true + dependencies: + minimist: 0.0.8 + dev: true + /mkdirp@0.5.6: resolution: {integrity: sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==} hasBin: true @@ -17200,6 +17374,24 @@ packages: pkg-types: 1.0.3 ufo: 1.5.3 + /mocha@5.2.0: + resolution: {integrity: sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==} + engines: {node: '>= 4.0.0'} + hasBin: true + dependencies: + browser-stdout: 1.3.1 + commander: 2.15.1 + debug: 3.1.0(supports-color@5.4.0) + diff: 3.5.0 + escape-string-regexp: 1.0.5 + glob: 7.1.2 + growl: 1.10.5 + he: 1.1.1 + minimatch: 3.0.4 + mkdirp: 0.5.1 + supports-color: 5.4.0 + dev: true + /moment@2.30.1: resolution: {integrity: sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==} dev: false @@ -19374,6 +19566,63 @@ packages: strip-indent: 3.0.0 dev: true + /redis-cli@2.1.2: + resolution: {integrity: sha512-O0juuFfbMwP19EMWzlQnRqpF6gBZPaYKpn6XJgthEEuSjDlCEJyOkH2xQvOvZ67JF7OeqMfL31+YL4DQI+uU2A==} + engines: {node: '>=8'} + hasBin: true + dependencies: + bluebird: 3.7.2 + colors: 1.4.0 + core-js: 3.37.0 + redis: 3.1.2 + redis-splitargs: 1.0.1 + yargs: 17.7.2 + dev: true + + /redis-commands@1.7.0: + resolution: {integrity: sha512-nJWqw3bTFy21hX/CPKHth6sfhZbdiHP6bTawSgQBlKOVRG7EZkfHbbHwQJnrE4vsQf0CMNE+3gJ4Fmm16vdVlQ==} + dev: true + + /redis-errors@1.2.0: + resolution: {integrity: sha512-1qny3OExCf0UvUV/5wpYKf2YwPcOqXzkwKKSmKHiE6ZMQs5heeE/c8eXK+PNllPvmjgAbfnsbpkGZWy8cBpn9w==} + engines: {node: '>=4'} + dev: true + + /redis-parser@3.0.0: + resolution: {integrity: sha512-DJnGAeenTdpMEH6uAJRK/uiyEIH9WVsUmoLwzudwGJUwZPp80PDBWPHXSAGNPwNvIXAbe7MSUB1zQFugFml66A==} + engines: {node: '>=4'} + dependencies: + redis-errors: 1.2.0 + dev: true + + /redis-splitargs@1.0.1: + resolution: {integrity: sha512-HzR4b/wj1as/upm1iLCx7ckUGSjOhbtVRldNgNI29LiKS6Zw0PQ+jGC9VtW0AvBrM3/J2O4NKPWcvE3elZhwWQ==} + dependencies: + chai: 3.5.0 + mocha: 5.2.0 + dev: true + + /redis@3.1.2: + resolution: {integrity: sha512-grn5KoZLr/qrRQVwoSkmzdbw6pwF+/rwODtrOr6vuBRiR/f3rjSTGupbF90Zpqm2oenix8Do6RV7pYEkGwlKkw==} + engines: {node: '>=10'} + dependencies: + denque: 1.5.1 + redis-commands: 1.7.0 + redis-errors: 1.2.0 + redis-parser: 3.0.0 + dev: true + + /redis@4.6.13: + resolution: {integrity: sha512-MHgkS4B+sPjCXpf+HfdetBwbRz6vCtsceTmw1pHNYJAsYxrfpOP6dz+piJWGos8wqG7qb3vj/Rrc5qOlmInUuA==} + dependencies: + '@redis/bloom': 1.2.0(@redis/client@1.5.14) + '@redis/client': 1.5.14 + '@redis/graph': 1.1.1(@redis/client@1.5.14) + '@redis/json': 1.0.6(@redis/client@1.5.14) + '@redis/search': 1.1.6(@redis/client@1.5.14) + '@redis/time-series': 1.0.5(@redis/client@1.5.14) + dev: false + /reflect.getprototypeof@1.0.4: resolution: {integrity: sha512-ECkTw8TmJwW60lOTR+ZkODISW6RQ8+2CL3COqtiJKLd6MmB45hN51HprHFziKLGkAuTGQhBb91V8cy+KHlaCjw==} engines: {node: '>= 0.4'} @@ -20768,6 +21017,13 @@ packages: has-flag: 2.0.0 dev: false + /supports-color@5.4.0: + resolution: {integrity: sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==} + engines: {node: '>=4'} + dependencies: + has-flag: 3.0.0 + dev: true + /supports-color@5.5.0: resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} engines: {node: '>=4'} @@ -21400,6 +21656,14 @@ packages: dependencies: prelude-ls: 1.2.1 + /type-detect@0.1.1: + resolution: {integrity: sha512-5rqszGVwYgBoDkIm2oUtvkfZMQ0vk29iDMU0W2qCa3rG0vPDNczCMT4hV/bLBgLg8k8ri6+u3Zbt+S/14eMzlA==} + dev: true + + /type-detect@1.0.0: + resolution: {integrity: sha512-f9Uv6ezcpvCQjJU0Zqbg+65qdcszv3qUQsZfjdRbWiZ7AMenrX1u0lNk9EoWWX6e1F+NULyg27mtdeZ5WhpljA==} + dev: true + /type-detect@4.0.8: resolution: {integrity: sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==} engines: {node: '>=4'} diff --git a/servers/fdr-deploy/package.json b/servers/fdr-deploy/package.json index 56e2afe61d..b5a64a309b 100644 --- a/servers/fdr-deploy/package.json +++ b/servers/fdr-deploy/package.json @@ -6,16 +6,19 @@ "watch": "tsc -w", "cdk": "cdk", "deploy:dev": "cdk deploy fdr-dev2 --require-approval never --progress events", - "deploy:prod": "cdk deploy fdr-prod --require-approval never --progress events" + "deploy:prod": "cdk deploy fdr-prod --require-approval never --progress events", + "rediscli": "node ./node_modules/redis-cli/index.js" }, "devDependencies": { "@fern-platform/configs": "workspace:*", "@types/node": "^18.7.18", "@types/prettier": "2.6.0", - "aws-cdk": "^2.118.0", + "aws-cdk": "^2.139.0", "vitest": "^1.5.0", "prettier": "^3.2.4", "ts-node": "^10.9.1", + "@types/jest": "^29.5.12", + "redis-cli": "^2.1.2", "typescript": "5.4.3" }, "dependencies": { @@ -23,6 +26,7 @@ "aws-cdk-lib": "^2.122.0", "axios": "^1.6.5", "constructs": "^10.3.0", + "redis": "^4.6.13", "source-map-support": "^0.5.21" } } diff --git a/servers/fdr-deploy/scripts/elasticache-stack.ts b/servers/fdr-deploy/scripts/elasticache-stack.ts new file mode 100644 index 0000000000..f6c3030cb4 --- /dev/null +++ b/servers/fdr-deploy/scripts/elasticache-stack.ts @@ -0,0 +1,69 @@ +import { EnvironmentType } from "@fern-fern/fern-cloud-sdk/api"; +import { aws_elasticache as ElastiCache, Stack, StackProps, Token } from "aws-cdk-lib"; +import { IVpc, Peer, Port, SecurityGroup } from "aws-cdk-lib/aws-ec2"; +import { CfnReplicationGroup, CfnSubnetGroup } from "aws-cdk-lib/aws-elasticache"; +import { Construct } from "constructs"; + +interface ElastiCacheStackProps extends StackProps { + readonly cacheName: string; + readonly IVpc: IVpc; + readonly numCacheShards: number; + readonly numCacheReplicasPerShard: number | undefined; + readonly clusterMode: "enabled" | "disabled"; + readonly cacheNodeType: string; + readonly envType: EnvironmentType; +} + +export class ElastiCacheStack extends Stack { + public readonly replicationGroup: CfnReplicationGroup; + public readonly subnetGroup: CfnSubnetGroup; + public readonly securityGroup: SecurityGroup; + public readonly redisEndpointAddress: string; + public readonly redisEndpointPort: string; + + constructor(scope: Construct, id: string, props: ElastiCacheStackProps) { + super(scope, id, props); + + const envPrefix = props.envType + "-"; + + const elastiCacheSecurityGroupName = envPrefix + props.cacheName + "SecurityGroup"; + this.securityGroup = new SecurityGroup(this, elastiCacheSecurityGroupName, { + vpc: props.IVpc, + allowAllOutbound: true, + description: `${elastiCacheSecurityGroupName} CDK`, + }); + + const elastiCacheSubnetGroupName = envPrefix + props.cacheName + "SubnetGroup"; + const elastiCacheSubnetGroup = new ElastiCache.CfnSubnetGroup(this, elastiCacheSubnetGroupName, { + description: `${elastiCacheSubnetGroupName} CDK`, + cacheSubnetGroupName: elastiCacheSubnetGroupName, + subnetIds: props.IVpc.privateSubnets.map(({ subnetId }) => subnetId), + }); + + const elastiCacheReplicationGroupName = envPrefix + props.cacheName + "ReplicationGroup"; + this.replicationGroup = new ElastiCache.CfnReplicationGroup(this, elastiCacheReplicationGroupName, { + replicationGroupDescription: `Replication Group for the ${elastiCacheReplicationGroupName} ElastiCache stack`, + automaticFailoverEnabled: true, + autoMinorVersionUpgrade: true, + engine: "redis", + engineVersion: "7.0", + cacheParameterGroupName: "default.redis7.cluster.on", + cacheNodeType: props.cacheNodeType, + numNodeGroups: props.numCacheShards, + replicasPerNodeGroup: props.numCacheReplicasPerShard, + clusterMode: props.clusterMode, + cacheSubnetGroupName: elastiCacheSubnetGroup.ref, + securityGroupIds: [this.securityGroup.securityGroupId], + }); + this.replicationGroup.addDependency(elastiCacheSubnetGroup); + + this.redisEndpointAddress = this.replicationGroup.attrPrimaryEndPointAddress; + this.redisEndpointPort = this.replicationGroup.attrConfigurationEndPointPort; + + this.securityGroup.addIngressRule( + Peer.anyIpv4(), + Port.tcp(Token.asNumber(this.redisEndpointPort)), + "Redis Port Ingress rule", + ); + } +} diff --git a/servers/fdr-deploy/scripts/fdr-deploy-stack.ts b/servers/fdr-deploy/scripts/fdr-deploy-stack.ts index 286dc494b7..0c15f72e95 100644 --- a/servers/fdr-deploy/scripts/fdr-deploy-stack.ts +++ b/servers/fdr-deploy/scripts/fdr-deploy-stack.ts @@ -15,6 +15,7 @@ import { PrivateDnsNamespace } from "aws-cdk-lib/aws-servicediscovery"; import * as sns from "aws-cdk-lib/aws-sns"; import { EmailSubscription } from "aws-cdk-lib/aws-sns-subscriptions"; import { Construct } from "constructs"; +import { ElastiCacheStack } from "./elasticache-stack"; const CONTAINER_NAME = "fern-definition-registry"; const SERVICE_NAME = "fdr"; @@ -194,6 +195,16 @@ export class FdrDeployStack extends Stack { evaluationPeriods: 5, }); lb500CountAlarm.addAlarmAction(new actions.SnsAction(snsTopic)); + + new ElastiCacheStack(this, "FernDocsElastiCache", { + cacheName: "FernDocsElastiCache", + IVpc: vpc, + numCacheShards: 1, + numCacheReplicasPerShard: environmentType === EnvironmentType.Prod ? 2 : undefined, + clusterMode: "enabled", + cacheNodeType: "cache.r7g.large", + envType: environmentType, + }); } }