This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// config/database.js | |
const getDatabaseConfig = ({ env }) => { | |
if ( | |
env("IS_OFFLINE", null) === "true" || | |
env("LAMBDA_RUNTIME_DIR", null) === null | |
) { | |
// In local simulated Lambda or normal Strapi | |
return { | |
connector: "bookshelf", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// config/plugins.js | |
module.exports = ({ env }) => ({ | |
upload: { | |
provider: "aws-s3", | |
providerOptions: { | |
params: { | |
Bucket: env("BUCKET_NAME"), | |
}, | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// config/database.js | |
const getDatabaseConfig = ({ env }) => { | |
if ( | |
env("IS_OFFLINE", null) === "true" || | |
env("LAMBDA_RUNTIME_DIR", null) === null | |
) { | |
// In local simulated Lambda or normal Strapi | |
return { | |
connector: "mongoose", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
service: sls-strapi | |
provider: | |
name: aws | |
runtime: nodejs12.x | |
profile: <your-aws-profile> | |
logRetentionInDays: ${self:custom.vars.logRetentionInDays, 1} | |
environment: | |
ADMIN_JWT_SECRET: "Just using dummy" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// config/database.js | |
const getDatabaseConfig = ({ env }) => { | |
if ( | |
env("IS_OFFLINE", null) === "true" || | |
env("LAMBDA_RUNTIME_DIR", null) === null | |
) { | |
return { | |
connector: "bookshelf", | |
settings: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cloudformation/aurora.yml | |
Resources: | |
RDSCluster: | |
Type: AWS::RDS::DBCluster | |
Properties: | |
MasterUsername: DBUsername | |
MasterUserPassword: DBPassword | |
DatabaseName: DBName | |
Engine: aurora |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# scripts/trim-node-modules.sh | |
#!/bin/bash | |
echo "trim-node-modules.sh" | |
du -hs node_modules/ | |
node-prune # https://github.com/tj/node-prune | |
find $PWD/node_modules -maxdepth 1 -type d -name "*react*" -exec rm -rf {} + |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# scripts/post-build.sh | |
#!/bin/bash | |
echo "post-build.sh – moving assets of frontend build to dev/ folder." | |
mkdir $PWD/build/dev | |
find $PWD/build/ -type f -print0 | xargs -0 mv -t $PWD/build/dev | |
mv $PWD/build/dev/index.html $PWD/build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// config/server.js | |
// This config is used both in `strapi build` and `strapi start`. | |
// So if we have a path prefix to the api, such as /dev or /v1, | |
// we need to use env variables to configure, as Strapi doesn't | |
// support path prefixes automagically. | |
module.exports = ({ env }) => { | |
let url = "<Insert Lambda endpoint url here after deploy.>"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const startStrapi = require("strapi/lib/Strapi"); | |
const serverless = require("serverless-http"); | |
module.exports.handler = async (event, context) => { | |
if (!global.strapi) { | |
console.log("Cold starting Strapi"); | |
await startStrapi({ dir: __dirname }).start(); | |
} | |
const handler = serverless(global.strapi.app); |
NewerOlder