@kirschbaum-development/sst-laravel 0.0.10 → 0.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -10
- package/laravel-sst.ts +9 -1
- package/package.json +3 -3
- package/templates/sst.config.run.template +2 -2
package/README.md
CHANGED
|
@@ -41,7 +41,7 @@ npx sst-laravel init
|
|
|
41
41
|
To start using, you only need to import the component in your `sst.config.ts` file:
|
|
42
42
|
|
|
43
43
|
```ts
|
|
44
|
-
import {
|
|
44
|
+
import { LaravelService } from "@kirschbaum-development/sst-laravel";
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
And now you can start using the `Laravel` SST component. All the configuration options are Typescript files with documentation, so
|
|
@@ -53,7 +53,7 @@ To check the full list of options. check [here](https://github.com/kirschbaum-de
|
|
|
53
53
|
Setting up your app to receive HTTP requests, on the `laravel-sst-demo.kdg.dev` domain (with SSL), with auto-scaling with a max of 3 servers.
|
|
54
54
|
|
|
55
55
|
```js
|
|
56
|
-
const app = new
|
|
56
|
+
const app = new LaravelService('MyLaravelApp', {
|
|
57
57
|
web: {
|
|
58
58
|
domain: 'laravel-sst-demo.kdg.dev',
|
|
59
59
|
scaling: {
|
|
@@ -74,7 +74,7 @@ SST Laravel will automatically deploy and configure worker containers running yo
|
|
|
74
74
|
**Running the Laravel scheduler**
|
|
75
75
|
|
|
76
76
|
```js
|
|
77
|
-
const app = new
|
|
77
|
+
const app = new LaravelService('MyLaravelApp', {
|
|
78
78
|
workers: [
|
|
79
79
|
{
|
|
80
80
|
name: 'scheduler',
|
|
@@ -87,7 +87,7 @@ const app = new Laravel('MyLaravelApp', {
|
|
|
87
87
|
**Running the Laravel Horizon**
|
|
88
88
|
|
|
89
89
|
```js
|
|
90
|
-
const app = new
|
|
90
|
+
const app = new LaravelService('MyLaravelApp', {
|
|
91
91
|
workers: [
|
|
92
92
|
{
|
|
93
93
|
name: 'horizon',
|
|
@@ -100,7 +100,7 @@ const app = new Laravel('MyLaravelApp', {
|
|
|
100
100
|
**Running custom commands**
|
|
101
101
|
|
|
102
102
|
```js
|
|
103
|
-
const app = new
|
|
103
|
+
const app = new LaravelService('MyLaravelApp', {
|
|
104
104
|
workers: [
|
|
105
105
|
{
|
|
106
106
|
name: 'worker',
|
|
@@ -127,7 +127,7 @@ There are multiple ways to configure environment variables. If you want SST Lara
|
|
|
127
127
|
The below configuration would copy a file named `.env.$STAGE` (e.g. `.env.production`) into the deployment containers as your `.env` file.
|
|
128
128
|
|
|
129
129
|
```js
|
|
130
|
-
const app = new
|
|
130
|
+
const app = new LaravelService('MyLaravelApp', {
|
|
131
131
|
// ...
|
|
132
132
|
config: {
|
|
133
133
|
environment: {
|
|
@@ -140,7 +140,7 @@ const app = new Laravel('MyLaravelApp', {
|
|
|
140
140
|
You can also configure it to use simply `.env`.
|
|
141
141
|
|
|
142
142
|
```js
|
|
143
|
-
const app = new
|
|
143
|
+
const app = new LaravelService('MyLaravelApp', {
|
|
144
144
|
// ...
|
|
145
145
|
config: {
|
|
146
146
|
environment: {
|
|
@@ -161,19 +161,21 @@ const database = new sst.aws.Postgres('MyDatabase', { vpc });
|
|
|
161
161
|
const redis = new sst.aws.Redis("MyRedis", { vpc });
|
|
162
162
|
const bucket = new sst.aws.Bucket("MyBucket");
|
|
163
163
|
|
|
164
|
-
const app = new
|
|
164
|
+
const app = new LaravelService('MyLaravelApp', {
|
|
165
165
|
link: [database, redis, bucket],
|
|
166
166
|
});
|
|
167
167
|
```
|
|
168
168
|
|
|
169
169
|
The `DB_*`, `REDIS_*` and `AWS_*` environment variables will be automatically injected into your Laravel application.
|
|
170
170
|
|
|
171
|
+
You can also [import existing resources](https://sst.dev/docs/import-resources/) into SST, in case you already have resources like databases, buckets, etc. created and in use in your AWS account.
|
|
172
|
+
|
|
171
173
|
#### Custom Environment Key Names
|
|
172
174
|
|
|
173
175
|
If you need to customize the environment variable names for your resources, you can provide an object with the resource and a callback function in the `link` array:
|
|
174
176
|
|
|
175
177
|
```js
|
|
176
|
-
const app = new
|
|
178
|
+
const app = new LaravelService('MyLaravelApp', {
|
|
177
179
|
link: [
|
|
178
180
|
email,
|
|
179
181
|
{
|
|
@@ -221,7 +223,7 @@ The IAM permissions for the linked resources are also automatically added to the
|
|
|
221
223
|
You can configure the PHP version, custom environment variables and a custom deployment script.
|
|
222
224
|
|
|
223
225
|
```js
|
|
224
|
-
const app = new
|
|
226
|
+
const app = new LaravelService('MyLaravelApp', {
|
|
225
227
|
config: {
|
|
226
228
|
php: 8.4,
|
|
227
229
|
opcache: true,
|
package/laravel-sst.ts
CHANGED
|
@@ -202,7 +202,7 @@ export interface LaravelArgs extends ClusterArgs {
|
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
|
|
205
|
-
export class
|
|
205
|
+
export class LaravelService extends Component {
|
|
206
206
|
private readonly services: Record<string, sst.aws.Service>;
|
|
207
207
|
|
|
208
208
|
constructor(
|
|
@@ -223,6 +223,14 @@ export class Laravel extends Component {
|
|
|
223
223
|
// SST sets __dirname to the .sst/platform directory.
|
|
224
224
|
const pluginBuildPath = path.resolve(__dirname, '../laravel');
|
|
225
225
|
|
|
226
|
+
if (!fs.existsSync(pluginBuildPath)) {
|
|
227
|
+
fs.mkdirSync(pluginBuildPath, { recursive: true });
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
if (!fs.existsSync(pluginBuildPath + '/deploy')) {
|
|
231
|
+
fs.mkdirSync(pluginBuildPath + '/deploy', { recursive: true });
|
|
232
|
+
}
|
|
233
|
+
|
|
226
234
|
prepareEnvironmentFile();
|
|
227
235
|
prepareDeploymentScript();
|
|
228
236
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kirschbaum-development/sst-laravel",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "An unofficial extension of SST to deploy containerized Laravel applications to AWS Fargate.",
|
|
6
6
|
"main": "laravel-sst.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"repository": {
|
|
25
25
|
"type": "git",
|
|
26
|
-
"url": "git+https://github.com/
|
|
26
|
+
"url": "git+https://github.com/kirschbaum-development/sst-laravel.git"
|
|
27
27
|
},
|
|
28
28
|
"keywords": [
|
|
29
29
|
"laravel",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"homepage": "https://github.com/kirschbaum-development/sst-laravel#readme",
|
|
43
43
|
"bin": {
|
|
44
|
-
"sst-laravel": "
|
|
44
|
+
"sst-laravel": "dist/bin/cli.js"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@aws-sdk/client-ecs": "^3.0.0",
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const {
|
|
1
|
+
const { LaravelService } = await import("@kirschbaum-development/sst-laravel");
|
|
2
2
|
const vpc = new sst.aws.Vpc("MyVpc");
|
|
3
3
|
// you can also use an existing VPC
|
|
4
4
|
// const vpc = sst.aws.Vpc.get("DefaultVpc", "vpc-12345678901234567");
|
|
5
5
|
|
|
6
6
|
const database = new sst.aws.Postgres('MyDB', { vpc });
|
|
7
7
|
|
|
8
|
-
const app = new
|
|
8
|
+
const app = new LaravelService("MyLaravelApp", {
|
|
9
9
|
vpc,
|
|
10
10
|
link: [database],
|
|
11
11
|
|