@kirschbaum-development/sst-laravel 0.0.5 → 0.0.6
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 +13 -3
- package/bin/cli.ts +6 -5
- package/package.json +1 -1
- package/templates/sst.config.ts.template +12 -0
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ Behind the scenes, we use the powerful PHP containers from [Serverside Up](https
|
|
|
26
26
|
Pull in the package using npm:
|
|
27
27
|
|
|
28
28
|
```bash
|
|
29
|
-
npm install @kirschbaum/sst-laravel --save
|
|
29
|
+
npm install @kirschbaum-development/sst-laravel --save
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
## Quick start
|
|
@@ -126,7 +126,7 @@ const app = new Laravel('MyLaravelApp', {
|
|
|
126
126
|
|
|
127
127
|
There are multiple ways to configure environment variables. If you want SST Laravel to copy an environment file, you can configure the `config.environment.file` entry.
|
|
128
128
|
|
|
129
|
-
The below configuration would copy a file named `.env.$STAGE` into the deployment containers as your `.env` file.
|
|
129
|
+
The below configuration would copy a file named `.env.$STAGE` (e.g. `.env.production`) into the deployment containers as your `.env` file.
|
|
130
130
|
|
|
131
131
|
```js
|
|
132
132
|
const app = new Laravel('MyLaravelApp', {
|
|
@@ -253,6 +253,16 @@ echo "🚀 Running Laravel Migrations..."
|
|
|
253
253
|
php artisan migrate --force
|
|
254
254
|
```
|
|
255
255
|
|
|
256
|
+
## Deploying
|
|
257
|
+
|
|
258
|
+
To deploy your application, you can use the `sst deploy` command. You must be authenticated with AWS in your terminal session to deploy.
|
|
259
|
+
|
|
260
|
+
```bash
|
|
261
|
+
npx sst deploy --stage {stage}
|
|
262
|
+
npx sst deploy --stage sandbox
|
|
263
|
+
npx sst deploy --stage production
|
|
264
|
+
```
|
|
265
|
+
|
|
256
266
|
## Accessing Containers
|
|
257
267
|
|
|
258
268
|
Using the `sst-laravel` CLI tool, you can easily connect to your running ECS containers for debugging and troubleshooting.
|
|
@@ -293,7 +303,7 @@ If you discover any security related issues, please email security@kirschbaumdev
|
|
|
293
303
|
|
|
294
304
|
## Sponsorship
|
|
295
305
|
|
|
296
|
-
Development of this package is sponsored by Kirschbaum Development Group, a developer driven company focused on problem solving, team building, and community. Learn more [about us](https://kirschbaumdevelopment.com) or [join us](https://careers.kirschbaumdevelopment.com)!
|
|
306
|
+
Development of this package is developed and sponsored by Kirschbaum Development Group, a developer driven company focused on problem solving, team building, and community. Learn more [about us](https://kirschbaumdevelopment.com) or [join us](https://careers.kirschbaumdevelopment.com)!
|
|
297
307
|
|
|
298
308
|
## License
|
|
299
309
|
|
package/bin/cli.ts
CHANGED
|
@@ -64,7 +64,7 @@ program
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
const templatePath = path.join(__dirname, '..', 'templates', 'sst.config.ts.template');
|
|
67
|
-
|
|
67
|
+
|
|
68
68
|
if (!fs.existsSync(templatePath)) {
|
|
69
69
|
console.error('Error: Template file not found.');
|
|
70
70
|
process.exit(1);
|
|
@@ -78,7 +78,7 @@ program
|
|
|
78
78
|
if (fs.existsSync(envPath)) {
|
|
79
79
|
const envContent = fs.readFileSync(envPath, 'utf-8');
|
|
80
80
|
const appNameMatch = envContent.match(/^APP_NAME=(.+)$/m);
|
|
81
|
-
|
|
81
|
+
|
|
82
82
|
if (appNameMatch && appNameMatch[1]) {
|
|
83
83
|
const rawAppName = appNameMatch[1].trim().replace(/^["']|["']$/g, '');
|
|
84
84
|
appName = rawAppName.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-|-$/g, '');
|
|
@@ -90,8 +90,9 @@ program
|
|
|
90
90
|
|
|
91
91
|
fs.writeFileSync(targetPath, templateContent, 'utf-8');
|
|
92
92
|
|
|
93
|
-
console.log('Successfully created sst.config.ts');
|
|
94
|
-
console.log('You can now customize the configuration for your Laravel application.');
|
|
93
|
+
console.log('✅ Successfully created sst.config.ts');
|
|
94
|
+
console.log('💡 You can now customize the configuration for your own Laravel application.');
|
|
95
|
+
console.log('🔏 Your default configuration is set to look for a .env.{stage} file when deploying. You can customize this in the sst.config.ts file as needed.');
|
|
95
96
|
} catch (error) {
|
|
96
97
|
console.error('Error:', (error as Error).message);
|
|
97
98
|
process.exit(1);
|
|
@@ -222,7 +223,7 @@ program
|
|
|
222
223
|
const taskId = task.taskArn?.split('/').pop() || '';
|
|
223
224
|
const containerName = task.containers?.[0]?.name || 'unknown';
|
|
224
225
|
const status = task.lastStatus || 'unknown';
|
|
225
|
-
|
|
226
|
+
|
|
226
227
|
return {
|
|
227
228
|
name: `${containerName} (${taskId.substring(0, 8)}...) - ${status}`,
|
|
228
229
|
value: task,
|
package/package.json
CHANGED
|
@@ -12,9 +12,21 @@ export default $config({
|
|
|
12
12
|
async run() {
|
|
13
13
|
const { Laravel } = await import("@kirschbaum-development/sst-laravel");
|
|
14
14
|
const vpc = new sst.aws.Vpc("MyVpc");
|
|
15
|
+
// you can also use an existing VPC
|
|
16
|
+
// const vpc = sst.aws.Vpc.get("DefaultVpc", "vpc-12345678901234567");
|
|
17
|
+
|
|
18
|
+
const database = new sst.aws.Postgres('MyDB', { vpc });
|
|
15
19
|
|
|
16
20
|
const app = new Laravel("MyLaravelApp", {
|
|
17
21
|
vpc,
|
|
22
|
+
link: [database],
|
|
23
|
+
|
|
24
|
+
config: {
|
|
25
|
+
php: 8.4,
|
|
26
|
+
environment: {
|
|
27
|
+
file: `.env.${$app.stage}`,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
18
30
|
|
|
19
31
|
web: {
|
|
20
32
|
domain: $app.stage === "production"
|