diff --git a/runtime/bref/0.2/bootstrap b/runtime/bref/0.2/bootstrap new file mode 100644 index 000000000..54a3b9158 --- /dev/null +++ b/runtime/bref/0.2/bootstrap @@ -0,0 +1,18 @@ +#!/bin/sh + +# +# Keep this file in the application's root or install bref/extra-php-extensions. +# See https://github.com/php-runtime/bref +# + +# Fail on error +set -e + +LAMBDA_ARGV=(${_HANDLER//:/ }) + +while true +do + # We redirect stderr to stdout so that everything + # written on the output ends up in Cloudwatch automatically + /opt/bin/php "${LAMBDA_ARGV[0]}" 2>&1 +done diff --git a/runtime/bref/0.2/manifest.json b/runtime/bref/0.2/manifest.json new file mode 100644 index 000000000..33e18b0ab --- /dev/null +++ b/runtime/bref/0.2/manifest.json @@ -0,0 +1,10 @@ +{ + "copy-from-recipe": { + "serverless.yaml": "serverless.yml", + "bootstrap": "bootstrap" + }, + "gitignore": [ + "/.serverless/" + ], + "aliases": [ "bref" ] +} diff --git a/runtime/bref/0.2/post-install.txt b/runtime/bref/0.2/post-install.txt new file mode 100644 index 000000000..ecd261c26 --- /dev/null +++ b/runtime/bref/0.2/post-install.txt @@ -0,0 +1,4 @@ + * Read the full documentation to properly configure your + Symfony application at https://bref.sh/docs/frameworks/symfony.html + + * Bref documentation: https://bref.sh/docs/ diff --git a/runtime/bref/0.2/serverless.yaml b/runtime/bref/0.2/serverless.yaml new file mode 100644 index 000000000..a875157b4 --- /dev/null +++ b/runtime/bref/0.2/serverless.yaml @@ -0,0 +1,52 @@ +# Read the documentation at https://www.serverless.com/framework/docs/providers/aws/guide/serverless.yml/ +service: my-symfony-app +configValidationMode: error +useDotenv: true + +provider: + name: aws + # The AWS region in which to deploy (us-east-1 is the default) + region: us-east-1 + # The stage of the application, e.g. dev, production, staging… ('dev' is the default) + stage: prod + runtime: provided.al2 + environment: + # Symfony environment variables + APP_ENV: prod + APP_RUNTIME: Runtime\Bref\Runtime + BREF_LOOP_MAX: 1 # Increase to keep the Lambda process alive between requests + # SYMFONY_DECRYPTION_SECRET: ${ssm:/my-symfony-app/prod-decrypt-private-key} + +plugins: + - ./vendor/bref/bref + +functions: + # This function runs the Symfony website/API + web: + handler: public/index.php + timeout: 28 # in seconds (API Gateway has a timeout of 29 seconds) + layers: + - ${bref:layer.php-80} + events: + - httpApi: '*' + + # This function let us run console commands in Lambda + console: + handler: bin/console + timeout: 120 # in seconds + layers: + - ${bref:layer.php-80} + +package: + patterns: + # Excluded files and folders for deployment + - '!assets/**' + - '!node_modules/**' + - '!public/build/**' + - '!tests/**' + - '!var/**' + # If you want to include files and folders that are part of excluded folders, + # add them at the end + - 'var/cache/prod/**' + - 'public/build/entrypoints.json' + - 'public/build/manifest.json'