A JSII construct lib to build AWS Serverless LAMP with AWS CDK
Project description
Welcome to cdk-serverless-lamp
A JSII construct library for AWS CDK to build the New Serverless LAMP Stack
Usage
# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
from cdk_serverless_lamp import ServerlessApi
ServerlessApi(self, "API")
On deploy complete, the API Gateway URL will be returned in the Output. Click the URL and you will see the Laravel landing page:
Prepare the Laravel and bref
$ git clone https://github.com/pahud/cdk-serverless-lamp.git
$ cd cdk-serverless-lamp
$ mkdir composer && cd composer
# create a laravel project
$ docker run --rm -ti \
--volume $PWD:/app \
composer create-project laravel/laravel laravel58-bref --prefer-dist
# enter this project
$ cd laravel58-bref
# install bref in the vendor
$ docker run --rm -ti \
--volume $PWD:/app \
composer require bref/bref
Configure Laravel with Bref for Lambda
According to the Bref document, we need configure the environment before it can be deployed on Lambda:
edit the .env
file
VIEW_COMPILED_PATH=/tmp/storage/framework/views
# We cannot store sessions to disk: if you don't need sessions (e.g. API) then use `array`
# If you write a website, use `cookie` or store sessions in database.
SESSION_DRIVER=cookie
# Logging to stderr allows the logs to end up in Cloudwatch
LOG_CHANNEL=stderr
edit the app/Providers/AppServiceProvider.php
public function boot()
{
// Make sure the directory for compiled views exist
if (! is_dir(config('view.compiled'))) {
mkdir(config('view.compiled'), 0755, true);
}
}
edit bootstrap/app.php
$app = new Illuminate\Foundation\Application(
$_ENV['APP_BASE_PATH'] ?? dirname(__DIR__)
);
// add the following statement
// we will configure APP_STORAGE = '/tmp' in Lambda env var
$app->useStoragePath($_ENV['APP_STORAGE'] ?? $app->storagePath());
(credit to @azole)
TODO
- Add Aurora for MySQL stack
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cdk-serverless-lamp-1.0.1.tar.gz
(21.0 kB
view hashes)
Built Distribution
Close
Hashes for cdk-serverless-lamp-1.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ad0874e2582eb23ebe2e87a60365e7165adb1e5bb3a8d3c44c1711cf51043d1b |
|
MD5 | 328b99d2cad7bb94d296e953f52584ef |
|
BLAKE2b-256 | 3c524891a75c0b4b35cc221b982b8cb7e4a17ff683bec388b2a09e4e1e756a77 |
Close
Hashes for cdk_serverless_lamp-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3d238f95e587343bbc9c842b6200916181ae788ea9947e2dc4c86f8e8d5f5dd |
|
MD5 | 964a682ee6b2d64ff3747476b3c1fbfb |
|
BLAKE2b-256 | 00afd48a33b5a1b57f3c711ab71394123f26081afaf8b03eb4c05b2b5bbb704e |