You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/configuration.md
+23-9Lines changed: 23 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
2
2
# Configuring Sidecar
3
3
4
-
After running `php artisan sidecar:install`, you should have a `sidecar.php` file in your `config` folder.
4
+
After running `php artisan sidecar:install`, you should have a `sidecar.php` file in your `config` folder.
5
5
6
6
There are several configuration options in that file, which we'll cover in this section.
7
7
@@ -17,11 +17,11 @@ To get started, run the following command:
17
17
php artisan sidecar:configure
18
18
```
19
19
20
-
The first thing it will do is guide you through creating a new AWS user in the web interface, which it will then use to create everything else it needs.
20
+
The first thing it will do is guide you through creating a new AWS user in the web interface, which it will then use to create everything else it needs.
21
21
22
22
Note that this won't start any services, it just creates some policies in IAM.
23
23
24
-
This is the same general method that Laravel Vapor uses: you provide it with Admin Access and then it configures itself. Sidecar takes it a step further and provides you the option to self-destruct the admin keys once it has configured itself.
24
+
This is the same general method that Laravel Vapor uses: you provide it with Admin Access and then it configures itself. Sidecar takes it a step further and provides you the option to self-destruct the admin keys once it has configured itself.
25
25
26
26
If you'd like to manually set everything up, take a look at the command to see exactly what it's doing, and you can recreate it in the IAM portal.
27
27
@@ -62,15 +62,29 @@ return [
62
62
];
63
63
```
64
64
65
+
## Function Storage
66
+
67
+
The ephemeral storage can also be customized, and again, if it isn't, the default from your `sidecar.php` file will be used.
68
+
69
+
```php
70
+
return [
71
+
/*
72
+
* The default ephemeral storage for your functions, in megabytes.
73
+
* This can be overridden per function.
74
+
*/
75
+
'storage' => env('SIDECAR_STORAGE', 512),
76
+
];
77
+
```
78
+
65
79
## Package Base Path
66
80
67
-
By default, all of your Lambda resources are going to be relative to the `base_path()` of your application. That means when you're defining your code packages, you'll use the root of your application as the starting point.
81
+
By default, all of your Lambda resources are going to be relative to the `base_path()` of your application. That means when you're defining your code packages, you'll use the root of your application as the starting point.
68
82
69
83
If all of your Lambda code lives in e.g. `resources/lambda`, then you can update your `package_base_path` to reflect that.
70
84
71
85
config/sidecar.php {.filename}
72
86
```php
73
-
return [
87
+
return [
74
88
/*
75
89
* The base path for your package files. If you e.g. keep
76
90
* all your Lambda package files in your resource path,
@@ -91,14 +105,14 @@ By default, the environment name that Sidecar uses is your `APP_ENV` from your `
91
105
If you'd like to use something other than the `APP_ENV`, you can do so by providing a `SIDECAR_ENV` environment variable.
92
106
93
107
```php
94
-
return [
95
-
/*
108
+
return [
109
+
/*
96
110
* Sidecar separates functions by environment. If you'd like to change
97
111
* your Sidecar environment without changing your entire application
98
112
* environment, you may do so here.
99
113
*/
100
114
'env' => env('SIDECAR_ENV', env('APP_ENV')),
101
115
];
102
116
```
103
-
104
-
To learn much more about environments and how to use them, see the [Environments](/environments) section.
117
+
118
+
To learn much more about environments and how to use them, see the [Environments](/environments) section.
Copy file name to clipboardExpand all lines: docs/functions/customization.md
+21-2Lines changed: 21 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -78,6 +78,25 @@ class ExampleFunction extends LambdaFunction
78
78
}
79
79
```
80
80
81
+
## Storage
82
+
83
+
Lambda functions can configure the amount of ephemeral storage available to them in the `/tmp` directory. This storage is shared between function instances, which means it persists across _invocations_ of a single warm Lambda function instance but is cleaned up everywhere else (e.g. between cold starts, when scaling up to more concurrent invocations, etc.).
84
+
85
+
Sidecar uses the storage value from you `sidecar.php` configuration file, which defaults to 512MB.
86
+
87
+
You are free to change this per function by returning a value from the `storage` method.
88
+
89
+
```php
90
+
class ExampleFunction extends LambdaFunction
91
+
{
92
+
public function storage() // [tl! focus:4]
93
+
{
94
+
// 2 GB
95
+
return 2048;
96
+
}
97
+
}
98
+
```
99
+
81
100
## Layers
82
101
83
102
Some functions require extra code or data beyond what is in your code package. From [Amazon's documentation](https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html):
@@ -139,7 +158,7 @@ class ExampleFunction extends LambdaFunction
139
158
}
140
159
```
141
160
142
-
It is **very important** to note that if you allow Sidecar to manage your Lambda's environment variables, any changes made to environment variables in the AWS UI will be overwritten next time you deploy your function.
161
+
It is **very important** to note that if you allow Sidecar to manage your Lambda's environment variables, any changes made to environment variables in the AWS UI will be overwritten next time you deploy your function.
143
162
144
163
By default, Sidecar doesn't touch your Lambda's environment at all. Only when you return an array from `variables` will Sidecar take control of the env vars.
145
164
@@ -162,7 +181,7 @@ class ExampleFunction extends LambdaFunction
162
181
163
182
public function variables() // [tl! focus:start]
164
183
{
165
-
// Values will come from the "activating" machine.
184
+
// Values will come from the "activating" machine.
0 commit comments