Skip to content

Commit 5d282f1

Browse files
committed
Update docs for Bref Cloud
1 parent 680d808 commit 5d282f1

7 files changed

Lines changed: 225 additions & 77 deletions

File tree

docs/default/cli-commands.mdx

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { Tab, Tabs } from 'nextra/components';
2+
13
# CLI commands
24

35
We can run CLI commands and scripts on AWS Lambda by deploying a "console" function with `serverless.yml`.
@@ -13,15 +15,33 @@ The function uses the [Console runtime](../runtimes/console.mdx).
1315
1416
To execute the script on Lambda, run the command below:
1517
16-
```bash
17-
serverless bref:cli
18-
```
18+
<Tabs items={['Serverless CLI', 'Bref Cloud']}>
19+
<Tab>
20+
```bash
21+
serverless bref:cli
22+
```
23+
</Tab>
24+
<Tab>
25+
```bash
26+
bref command
27+
```
28+
</Tab>
29+
</Tabs>
1930

2031
We can also pass arguments to the script:
2132

22-
```bash
23-
serverless bref:cli --args="extra command line arguments and options"
24-
```
33+
<Tabs items={['Serverless CLI', 'Bref Cloud']}>
34+
<Tab>
35+
```bash
36+
serverless bref:cli --args="extra command line arguments and options"
37+
```
38+
</Tab>
39+
<Tab>
40+
```bash
41+
bref command "extra command line arguments and options"
42+
```
43+
</Tab>
44+
</Tabs>
2545

2646
Our script will be invoked inside AWS Lambda and the result will be printed to the console.
2747

docs/default/getting-started.mdx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Cards, Card } from 'nextra/components';
1+
import { Cards, Card, Tabs, Tab } from 'nextra/components';
22
// Path relative to the copy in the `website/` folder
33
import { LaravelIcon } from '../../../components/icons/LaravelIcon';
44
import { SymfonyIcon } from '../../../components/icons/SymfonyIcon';
@@ -70,9 +70,18 @@ plugins:
7070
7171
To deploy, run:
7272
73-
```bash
74-
serverless deploy
75-
```
73+
<Tabs items={['Serverless CLI', 'Bref Cloud']}>
74+
<Tab>
75+
```bash
76+
serverless deploy
77+
```
78+
</Tab>
79+
<Tab>
80+
```bash
81+
bref deploy
82+
```
83+
</Tab>
84+
</Tabs>
7685

7786
Once the command finishes, it should print a URL like this one:
7887

docs/laravel/getting-started.mdx

Lines changed: 37 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Callout } from 'nextra/components';
22
import { NextSeo } from 'next-seo';
3+
import { Tab, Tabs } from 'nextra/components';
34

45
<NextSeo description="Run Laravel serverless on AWS Lambda using Bref." />
56

@@ -50,9 +51,18 @@ When running in AWS Lambda, the Laravel application will automatically cache its
5051

5152
Let's deploy now:
5253

53-
```bash
54-
serverless deploy
55-
```
54+
<Tabs items={['Serverless CLI', 'Bref Cloud']}>
55+
<Tab>
56+
```bash
57+
serverless deploy
58+
```
59+
</Tab>
60+
<Tab>
61+
```bash
62+
bref deploy
63+
```
64+
</Tab>
65+
</Tabs>
5666

5767
When finished, the `deploy` command will show the URL of the application.
5868

@@ -90,15 +100,30 @@ As you may have noticed, we define a function named "artisan" in `serverless.yml
90100

91101
For example, to execute an `artisan` command on Lambda, run the command below:
92102

93-
```bash
94-
serverless bref:cli --args="<artisan command and options>"
95-
```
96-
97-
For example:
98-
99-
```bash
100-
serverless bref:cli --args="route:list"
101-
```
103+
<Tabs items={['Serverless CLI', 'Bref Cloud']}>
104+
<Tab>
105+
```bash
106+
serverless bref:cli --args="{artisan command and options}"
107+
```
108+
109+
For example:
110+
111+
```bash
112+
serverless bref:cli --args="route:list"
113+
```
114+
</Tab>
115+
<Tab>
116+
```bash
117+
bref command "{artisan command and options}"
118+
```
119+
120+
For example:
121+
122+
```bash
123+
bref command "route:list"
124+
```
125+
</Tab>
126+
</Tabs>
102127

103128
For more details follow [the "Console" guide](../runtimes/console.mdx).
104129

docs/laravel/passport.mdx

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { Steps } from 'nextra/components';
22
import { NextSeo } from 'next-seo';
3+
import { Tab, Tabs } from 'nextra/components';
34

45
<NextSeo description="Laravel Passport on AWS Lambda with Bref" />
56

@@ -38,21 +39,39 @@ Instead, here is what you need to do:
3839
3940
You can now redeploy the application:
4041
41-
```yaml
42-
serverless deploy
43-
```
44-
45-
Note, that during deployment the keys will be stored at `./storage` path not at `/var/task/storage`. Workaround for this is to adjust Passport path with `Passport::loadKeysFrom('storage')`.
46-
42+
<Tabs items={['Serverless CLI', 'Bref Cloud']}>
43+
<Tab>
44+
```bash
45+
serverless deploy
46+
```
47+
</Tab>
48+
<Tab>
49+
```bash
50+
bref deploy
51+
```
52+
</Tab>
53+
</Tabs>
54+
55+
Note, that during deployment the keys will be stored at `./storage` path, not at `/var/task/storage`. Workaround for this is to adjust Passport path with `Passport::loadKeysFrom('storage')`.
4756

4857
### Create tokens
4958

5059
Finally, you can create the tokens (which is the second part of the `passport:install` command):
5160

52-
```bash
53-
serverless bref:cli --args="passport:client --personal --name 'Laravel Personal Access Client'"
54-
serverless bref:cli --args="passport:client --password --name 'Laravel Personal Access Client'"
55-
```
61+
<Tabs items={['Serverless CLI', 'Bref Cloud']}>
62+
<Tab>
63+
```bash
64+
serverless bref:cli --args="passport:client --personal --name 'Laravel Personal Access Client'"
65+
serverless bref:cli --args="passport:client --password --name 'Laravel Personal Access Client'"
66+
```
67+
</Tab>
68+
<Tab>
69+
```bash
70+
bref command "passport:client --personal --name 'Laravel Personal Access Client'"
71+
bref command "passport:client --password --name 'Laravel Personal Access Client'"
72+
```
73+
</Tab>
74+
</Tabs>
5675

5776
</Steps>
5877

docs/monitoring.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ By default, AWS Lambda publishes all logs and general metrics (HTTP response tim
44

55
It is possible to view these logs and metrics directly in the [AWS console](https://us-east-1.console.aws.amazon.com/cloudwatch/home?region=us-east-1). However, the CloudWatch UI can be complex and overwhelming.
66

7-
As an alternative, we can use the [Bref Dashboard](https://dashboard.bref.sh/?ref=bref) to view these logs and metrics. It provides a simpler UI designed for serverless PHP applications.
7+
As an alternative, we can use the [Bref Cloud](/cloud) to view these logs and metrics. It provides a simpler UI designed for serverless PHP applications.
88

99
For advanced metrics and profiling, we can use [Tideways](https://tideways.com/?ref=bref), or [Sentry's performance monitoring](/sentry). Note that [Serverless.com's Dashboard](https://www.serverless.com/) is not compatible with PHP.
1010

docs/runtimes/console.mdx

Lines changed: 55 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { NextSeo } from 'next-seo';
2+
import { Tab, Tabs } from 'nextra/components';
23

34
<NextSeo description="Learn how to run serverless console commands on AWS Lambda with Symfony Console or Laravel Artisan." />
45

@@ -18,6 +19,7 @@ Console functions can be invoked:
1819

1920
- via a cron schedule
2021
- via the `serverless bref:cli` command
22+
- via the `bref command` command when using [Bref Cloud](/cloud)
2123
- manually by invoking the function via the AWS API
2224

2325
## Usage
@@ -69,37 +71,68 @@ Read the dedicated documentation for [running cron tasks on AWS Lambda](../use-c
6971

7072
### CLI invocation
7173

72-
To manually run a console command on AWS Lambda, run `serverless bref:cli` on your computer:
74+
To manually run a console command on AWS Lambda, run the following command on your computer:
7375

74-
```bash
75-
serverless bref:cli --args="<command to run in lambda>"
76-
```
76+
<Tabs items={['Serverless CLI', 'Bref Cloud']}>
77+
<Tab>
78+
```bash
79+
serverless bref:cli --args="{arguments and options for the script}"
80+
```
7781

78-
The `bref:cli` command will automatically detect which function (in `serverless.yml`) uses the `console` runtime and will run the command on that function.
82+
The `bref:cli` command will automatically detect which function (in `serverless.yml`) uses the `console` runtime and will run the command on that function.
7983

80-
Pass your command arguments and options in the `--args` flag (shortcut: `-a`). Remember to escape quotes properly. Some examples:
84+
Pass your command arguments and options in the `--args` flag (shortcut: `-a`). Remember to escape quotes properly. Some examples:
8185

82-
```bash
83-
# Runs the CLI application without arguments and displays the help
84-
$ serverless bref:cli
85-
# ...
86+
```bash
87+
# Runs the CLI application without arguments and displays the help
88+
$ serverless bref:cli
89+
# ...
8690
87-
$ serverless bref:cli --args="doctrine:migrations:migrate"
88-
Your database will be migrated.
89-
To execute the SQL queries run the command with the `--force` option.
91+
$ serverless bref:cli --args="doctrine:migrations:migrate"
92+
Your database will be migrated.
93+
To execute the SQL queries run the command with the `--force` option.
9094

91-
$ serverless bref:cli -a "doctrine:migrations:migrate --force"
92-
Your database has been migrated.
95+
$ serverless bref:cli -a "doctrine:migrations:migrate --force"
96+
Your database has been migrated.
9397

94-
$ serverless bref:cli --stage=prod -a "db:dump --file='/tmp/dump.sql' --verbose"
95-
# ...
98+
$ serverless bref:cli --stage=prod -a "db:dump --file='/tmp/dump.sql' --verbose"
99+
# ...
96100

97-
# You can use environment variables to configure AWS credentials (e.g. in CI)
98-
$ AWS_ACCESS_KEY_ID=foo AWS_SECRET_ACCESS_KEY=bar serverless bref:cli
99-
# ...
100-
```
101+
# You can use environment variables to configure AWS credentials (e.g. in CI)
102+
$ AWS_ACCESS_KEY_ID=foo AWS_SECRET_ACCESS_KEY=bar serverless bref:cli
103+
# ...
104+
```
105+
106+
The `bref:cli` command can be used to run CLI commands in Lambda from your machine, but can also be used in CI/CD to run DB migrations for example.
107+
</Tab>
108+
<Tab>
109+
```bash
110+
bref command "{arguments and options for the script}"
111+
```
112+
113+
It will automatically detect which function (in `serverless.yml`) uses the `console` runtime and will run the command on that function.
114+
115+
Pass your command arguments and options as a single string. Remember to escape quotes properly. Some examples:
116+
117+
```bash
118+
# Runs the CLI application without arguments and displays the help
119+
$ bref command
120+
# ...
121+
122+
$ bref command "doctrine:migrations:migrate"
123+
Your database will be migrated.
124+
To execute the SQL queries run the command with the `--force` option.
125+
126+
$ bref command "doctrine:migrations:migrate --force"
127+
Your database has been migrated.
128+
129+
$ bref command --env=prod "db:dump --file='/tmp/dump.sql' --verbose"
130+
# ...
131+
```
101132

102-
The `bref:cli` command can be used to run CLI commands in Lambda from your machine, but can also be used in CI/CD to run DB migrations for example.
133+
The `bref command` command can be used to run CLI commands in Lambda from your machine, but can also be used in CI/CD to run DB migrations for example.
134+
</Tab>
135+
</Tabs>
103136

104137
### Interactive terminal
105138

0 commit comments

Comments
 (0)