Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Website and docs v3 #1596

Merged
merged 146 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
146 commits
Select commit Hold shift + click to select a range
6491a6b
Website v3 using Nextra
mnapoli Jul 10, 2023
af5f68f
Deploy to Vercel
mnapoli Jul 10, 2023
a71ece6
Symfony documentation
mnapoli Jul 10, 2023
d54a4e5
Custom CSS and font
mnapoli Jul 10, 2023
5bc0d2d
Docs: Deployment
mnapoli Jul 12, 2023
9c5f075
Fix deploy on Netlify
mnapoli Jul 12, 2023
043ff70
Docs improvements
mnapoli Jul 12, 2023
250257a
Docs: upgrading
mnapoli Jul 14, 2023
aff7b9d
Docs: add use cases
mnapoli Jul 18, 2023
f403fc0
Docs: local development for event-driven functions
mnapoli Jul 18, 2023
5780a63
Docs: cron
mnapoli Jul 18, 2023
3897ee3
Docs: docker
mnapoli Jul 18, 2023
0c5ffe0
Docs: runtimes
mnapoli Jul 18, 2023
2f56518
Website home
mnapoli Jul 18, 2023
f574600
Website home
mnapoli Jul 19, 2023
ad876d6
Docs: move custom domains
mnapoli Jul 19, 2023
0223312
Website home
mnapoli Jul 23, 2023
b568b67
Docs: runtimes
mnapoli Jul 23, 2023
58d3ad4
Website: companies and testimonials
mnapoli Jul 23, 2023
68b5067
Website: companies and testimonials
mnapoli Jul 23, 2023
e71f05e
Website: invocation count
mnapoli Jul 23, 2023
2c4462b
Website: use cases
mnapoli Jul 23, 2023
458d9a0
Website: theme config
mnapoli Jul 23, 2023
b83b5f2
Add sponsors
mnapoli Aug 15, 2023
dda3c76
Add credits
mnapoli Aug 17, 2023
0d94cd0
Website: use-cases
mnapoli Aug 17, 2023
da3b374
Website: add more sections (WIP)
mnapoli Aug 17, 2023
69b0151
Website: how it works
mnapoli Aug 17, 2023
5fe5a46
Website: intro
mnapoli Aug 17, 2023
2d11ffb
Website: improve use case description
mnapoli Aug 17, 2023
9a0d9b7
Website: improve use case description
mnapoli Aug 17, 2023
a8e56f8
Fix wording
mnapoli Aug 17, 2023
70edd02
Fix warning
mnapoli Aug 17, 2023
b14c5c0
Website: show invocations
mnapoli Aug 17, 2023
332b26b
Docs: move AWS CDK
mnapoli Aug 17, 2023
5996671
Docs: websites and assets
mnapoli Aug 18, 2023
cf38816
Fix
mnapoli Aug 18, 2023
610b83a
Docs: FPM runtime
mnapoli Aug 18, 2023
73d9393
Docs: function runtime
mnapoli Aug 18, 2023
2ba1e04
Website: testimonials
mnapoli Aug 22, 2023
e87249a
Docs: HTTP applications and FPM runtime
mnapoli Aug 22, 2023
a204747
Docs: check broken links
mnapoli Aug 22, 2023
54d2f06
Docs: improve IAM setup because the official serverless guide was str…
mnapoli Aug 23, 2023
2c040d7
Website: split use-cases with simple or advanced use-cases
mnapoli Aug 23, 2023
cfc882d
Docs: custom architecture
mnapoli Aug 23, 2023
ee94302
Docs: fix
mnapoli Aug 23, 2023
73c885d
Docs: review and improve "Environment" docs
mnapoli Aug 23, 2023
1bead1a
Docs: fix broken links
mnapoli Aug 23, 2023
4201267
Website: plans page
mnapoli Aug 23, 2023
0c14852
Docs: Inertia
mnapoli Aug 24, 2023
96faf08
Docs: fix syntax highlighting
mnapoli Aug 24, 2023
a248bac
Website: logo
mnapoli Aug 25, 2023
6564974
Website: costs calculator
mnapoli Aug 27, 2023
7381a4e
Website: costs calculator
mnapoli Aug 27, 2023
d436b3c
Website: add testimonial
mnapoli Sep 1, 2023
912aae9
Website: force light theme
mnapoli Sep 1, 2023
291d9aa
Website
mnapoli Sep 1, 2023
6845620
Website: fix state
mnapoli Sep 1, 2023
50da2f5
Website: home tweaks
mnapoli Sep 3, 2023
ed0e3d6
Website: sentry
mnapoli Sep 4, 2023
e54665a
Website: add contributors to the credits
mnapoli Sep 6, 2023
4d71221
Website: improve contributor list
mnapoli Sep 7, 2023
26f945c
Website: fix color contrast
mnapoli Sep 7, 2023
24e9a8c
Website: landing CTA
mnapoli Sep 8, 2023
9be38ce
Website: company list
mnapoli Sep 8, 2023
e61313d
Website: company list
mnapoli Sep 8, 2023
050875e
[website-v3] Replace a bunch of http links with https
GrahamCampbell Sep 11, 2023
1fd2e08
Website: footer
mnapoli Sep 11, 2023
89caa9b
Website: automate deployment
mnapoli Sep 11, 2023
cca3a06
Website: automate deployment
mnapoli Sep 11, 2023
10752a8
Merge pull request #1643 from GrahamCampbell/website-v3-https
mnapoli Sep 11, 2023
4770deb
Website: automate deployment
mnapoli Sep 11, 2023
96a90bb
Website: credits credentials
mnapoli Sep 11, 2023
8c12fd4
Website: CD
mnapoli Sep 11, 2023
fa2d5fc
Update docs/use-cases/sqs.mdx
mnapoli Sep 11, 2023
0194399
Website: CD
mnapoli Sep 11, 2023
8ee08ef
Website: cleanup
mnapoli Sep 11, 2023
dd0f63a
Docs: console runtime
mnapoli Sep 13, 2023
74ac8a4
Website: wording tweak
mnapoli Sep 16, 2023
291c7ef
Docs: getting started
mnapoli Sep 16, 2023
f0c9a59
Docs: CLI commands
mnapoli Sep 16, 2023
002dbb5
Website: news
mnapoli Sep 16, 2023
dac4c68
Website: fix more 404
mnapoli Sep 18, 2023
374540c
Website: support
mnapoli Sep 18, 2023
48a4791
Website: redirect anchors
mnapoli Sep 18, 2023
6af25f1
Website: redirect anchors
mnapoli Sep 18, 2023
b8b9bef
Website: plans
mnapoli Sep 18, 2023
c87bdc4
Website: force light theme
mnapoli Sep 18, 2023
ca0b59a
Docs: maturity matrix
mnapoli Sep 18, 2023
5b95938
Docs: costs
mnapoli Sep 19, 2023
77e7cf8
Website: fix link
mnapoli Sep 19, 2023
2abe360
Docs: clarify Octane behavior
mnapoli Sep 19, 2023
e00c092
Docs: console
mnapoli Sep 19, 2023
cfc8e13
Docs: Symfony
mnapoli Sep 19, 2023
97360ee
Docs: tweaks
mnapoli Sep 19, 2023
7b8c08d
Website: update logo
mnapoli Sep 19, 2023
6410766
Website: tweak
mnapoli Sep 19, 2023
30831c8
Website: companies
mnapoli Sep 21, 2023
5ee11db
Website: favicon
mnapoli Sep 22, 2023
14b1272
Website: 404
mnapoli Sep 22, 2023
cef2d5f
Website: 404 tracking
mnapoli Sep 22, 2023
b77c997
Website: refresh metrics
mnapoli Sep 22, 2023
c5e052f
Website: old redirects
mnapoli Sep 22, 2023
b20c6af
Website: sitemap
mnapoli Sep 23, 2023
89c63a3
Website: Algolia search
mnapoli Sep 23, 2023
407ced4
Website: news list page
mnapoli Sep 23, 2023
da42348
Website: fix links
mnapoli Sep 23, 2023
e8e91a3
Website: news
mnapoli Sep 23, 2023
a592165
Website: landing
mnapoli Oct 5, 2023
36aa799
Website: improve link-checker to also check URLs from the v2 website
mnapoli Oct 5, 2023
76fd232
Website: add redirects for v2 URLs
mnapoli Oct 5, 2023
93cb8e2
Website: landing
mnapoli Oct 7, 2023
b094abd
Docs: maturity matrix
mnapoli Oct 7, 2023
a4b78df
Website: redirects
mnapoli Oct 7, 2023
a15fc33
Website: redirects
mnapoli Oct 7, 2023
a4364fe
Website: redirects
mnapoli Oct 7, 2023
ae190f7
Website: redirects
mnapoli Oct 7, 2023
9cc8990
Website: redirects
mnapoli Oct 7, 2023
3c74ffb
Docs: Symfony keep-alive process
mnapoli Oct 7, 2023
100807f
Docs: improve the Symfony docs
mnapoli Oct 7, 2023
db07989
Website: redirects
mnapoli Oct 7, 2023
1d7328c
Docs: fix link
mnapoli Oct 7, 2023
32e678e
Website: redirects
mnapoli Oct 7, 2023
3941b8b
Website: redirects
mnapoli Oct 7, 2023
96214be
Website: fix CSS
mnapoli Oct 7, 2023
cd9c289
Website: testimonials
mnapoli Oct 8, 2023
8ebf93c
Website: GitHub permissions
mnapoli Oct 8, 2023
61a01aa
Website: newsletter
mnapoli Oct 9, 2023
0b609bb
Website: responsive fixes
mnapoli Oct 9, 2023
175177c
Website: apply changes from master
mnapoli Oct 9, 2023
8ab21d3
Merge branch 'master' into website-v3
mnapoli Oct 9, 2023
ffc488d
Website: support
mnapoli Oct 10, 2023
53a6fb5
Website: SEO tags
mnapoli Oct 10, 2023
8647582
Website: remove old files
mnapoli Oct 11, 2023
cfe4894
Website: improve meta tags
mnapoli Oct 11, 2023
0adddf3
Website: cleanup more files from the previous website
mnapoli Oct 11, 2023
badf370
Website: self-host the font
mnapoli Oct 11, 2023
73ec5f3
Website: social card
mnapoli Oct 11, 2023
d79b702
Website: debug SSG
mnapoli Oct 11, 2023
437cee9
Website: fix SSG
mnapoli Oct 11, 2023
62141a5
Website: fix SSG
mnapoli Oct 11, 2023
542638c
Website: fix warnings
mnapoli Oct 11, 2023
9a6da67
Website: fix title
mnapoli Oct 11, 2023
64fc440
Website: social cards
mnapoli Oct 11, 2023
11d739a
Website: solve TODOs
mnapoli Oct 11, 2023
45ec771
Website: remove log
mnapoli Oct 11, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions docs/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"index": "What is Bref and serverless?",
"-- Getting started": {
"type": "separator",
"title": "Getting started"
},
"setup": "",
"laravel": "Laravel",
"symfony": "Symfony",
"default": "Other frameworks",
"-- How it works": {
"type": "separator",
"title": "How it works"
},
"runtimes": "PHP runtimes for AWS Lambda",
"-- Workflow": {
"type": "separator",
"title": "Workflow"
},
"deploy": "Deployment",
"local-development": "Local development",
"monitoring": "",
"-- Learn more": {
"type": "separator",
"title": "Learn more"
},
"environment": "Environment",
"use-cases": "Use cases",
"upgrading": "Upgrading",
"-- Learning": {
"type": "separator",
"title": "Learning"
},
"course": {
"title": "Course",
"href": "https://serverless-visually-explained.com/?ref=bref-menu"
},
"case-studies": "",
"community": ""
}
34 changes: 34 additions & 0 deletions docs/aws-cdk.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { RemoteContent } from 'nextra/data'
import { buildDynamicMDX, buildDynamicMeta } from 'nextra/remote'

export const getStaticProps = async ({ params }) => {
const token = process.env.GITHUB_TEST_REMOTE_MDX
const res = await fetch(
'https://api.github.com/repos/brefphp/constructs/contents/README.md',
{
headers: {
Accept: 'application/vnd.github+json',
'X-GitHub-Api-Version': '2022-11-28',
...(token && { Authorization: `Bearer ${token}` })
}
}
)
const page = await res.json()
if (!page.content) {
throw new Error(
`Error while fetch data from GitHub.\n${JSON.stringify(page, null, 4)}`
)
}
const content = Buffer.from(page.content, 'base64').toString('utf8');
return {
props: {
...(await buildDynamicMDX(content, {
defaultShowCopyCode: true
})),
...(await buildDynamicMeta())
},
revalidate: 10
}
}

<RemoteContent />
4 changes: 2 additions & 2 deletions docs/case-studies.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
title: Case studies
current_menu: case-studies
introduction: A collection of case studies of serverless PHP applications built using Bref. Learn about performance, costs and migrations from existing projects.
---

# Case studies

This page collects case studies of serverless PHP applications built with or migrated to Bref.

These help learn for real use cases about costs, performance and migration efforts.
Expand Down
4 changes: 2 additions & 2 deletions docs/community.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
title: Community
current_menu: community
introduction: A collection of links to places where to discuss and learn about Bref.
---

# Community

To report bugs you can head over to the [GitHub Bref repository](https://github.com/brefphp/bref).

For support and general discussions, [open a GitHub discussion](https://github.com/brefphp/bref/discussions).
Expand Down
6 changes: 6 additions & 0 deletions docs/default/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"getting-started": "",
"index": "Web apps on AWS Lambda",
"website-assets": "Website assets",
"console": "Console commands"
}
4 changes: 2 additions & 2 deletions docs/runtimes/console.md → docs/default/console.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ functions:
runtime: php-81-console
```

Behind the scenes, the `php-xx-console` runtime will deploy a Lambda function configured to use Bref's `php-81` AWS Lambda layer plus Bref's `console` layer (read more about these in the [runtimes documentation](./README.md)).
Behind the scenes, the `php-xx-console` runtime will deploy a Lambda function configured to use Bref's `php-81` AWS Lambda layer plus Bref's `console` layer (read more about these in the [runtimes documentation](../runtimes.mdx)).

## Usage

Expand Down Expand Up @@ -99,7 +99,7 @@ aws lambda invoke \

The [Bref Dashboard](https://dashboard.bref.sh/?ref=bref) also provides a convenient way to run commands via a terminal:

[![Bref Dashboard terminal for Laravel](./dashboard-terminal.png)](https://dashboard.bref.sh/?ref=bref)
[![Bref Dashboard terminal for Laravel](../runtimes/dashboard-terminal.png)](https://dashboard.bref.sh/?ref=bref)

Functions using the "console" runtime are automatically detected, and colors are enabled by default for Laravel Artisan and Symfony Console.

Expand Down
66 changes: 66 additions & 0 deletions docs/default/getting-started.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import { Cards, Card } from 'nextra/components';
// Path relative to the copy in the `website/` folder
import { LaravelIcon } from '../../../components/icons/LaravelIcon';
import { SymfonyIcon } from '../../../components/icons/SymfonyIcon';

export const introduction = 'Run PHP serverless on AWS Lambda using Bref.';

# Getting started - Bref with any framework

This guide will help you deploy your first PHP application on AWS Lambda. The instructions below can be adapted to work with any framework.

If you are using Laravel or Symfony, check out the dedicated guides instead:

<Cards num={2}>
<Card icon={<LaravelIcon />} title="Get started with Laravel" arrow="true" href="/docs/laravel/getting-started" />
<Card icon={<SymfonyIcon />} title="Get started with Symfony" arrow="true" href="/docs/symfony/getting-started" />
</Cards>

## Setup

First, **follow the [Setup guide](../setup.mdx)** to create an AWS account and install the necessary tools.

Next, in an empty directory, install Bref using Composer:

```bash
composer require bref/bref
```

Make sure that the version of Bref that was installed is 1.0 or greater.

Then let's start by initializing a new project by running:

```bash
vendor/bin/bref init
```

Accept all the defaults by pressing "Enter". The following files will be created in your project:

- `index.php` contains the code of your application
- `serverless.yml` contains the configuration for deploying on AWS

You are free to edit the code in `index.php`. If you want to deploy an existing application, you can delete `index.php` and edit `serverless.yml` to point to your existing index file (for example it may be another file like `public/index.php`).

## Deployment

To deploy, let's run:

```bash
serverless deploy
```

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

```sh
https://3pjp2yiw97.execute-api.us-east-1.amazonaws.com
```

Open this URL and you should see your application: `index.php` is running on Lambda!

🎉 congrats on creating your first serverless application!

To learn more about deployments, head over the [Deployment guide](../deploy.mdx).

## Troubleshooting

In case your application is showing a blank page after being deployed, [have a look at the logs](../environment/logs.md).
10 changes: 5 additions & 5 deletions docs/websites.md → docs/default/website-assets.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ next:
title: Console commands
---

> Before reading this article we assume that you have read [Bref's introduction](/docs/first-steps.md) and that you are familiar with [Bref's HTTP runtime](/docs/runtimes/http.md).
> Before reading this article we assume that you have read [Bref's introduction](/docs/default/getting-started.mdx) and that you are familiar with [Bref's HTTP runtime](/docs/web-apps/index.md).

## Architectures

Websites usually contain 2 parts:

- PHP code, running on [AWS Lambda + API Gateway with the HTTP runtime](/docs/runtimes/http.md)
- PHP code, running on [AWS Lambda + API Gateway with the HTTP runtime](/docs/web-apps/index.md)
- static assets (CSS, JS…), [hosted on AWS S3](https://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteHosting.html)

![](websites/cloudfront.svg)
![](../websites/cloudfront.svg)

[CloudFront](https://aws.amazon.com/cloudfront/) (the AWS CDN) serves as an HTTP/HTTPS proxy.

Expand Down Expand Up @@ -68,9 +68,9 @@ You can access your website using the URL that Lift outputs at the end the deplo

### Setting up a domain name

Just like in the "[Custom domains](/docs/environment/custom-domains.md)" guide, you need to register your domain in **ACM** (AWS Certificate Manager) to get an HTTPS certificate.
Just like in the "[Custom domains](/docs/use-cases/http/custom-domains.mdx)" guide, you need to register your domain in **ACM** (AWS Certificate Manager) to get an HTTPS certificate.

> If you have already set up this domain as a custom domain in API Gateway (by following the [Custom domain](/docs/environment/custom-domains.md) guide), you will need to remove it before continuing.
> If you have already set up this domain as a custom domain in API Gateway (by following the [Custom domain](/docs/use-cases/http/custom-domains.mdx) guide), you will need to remove it before continuing.

- open [this link](https://console.aws.amazon.com/acm/home?region=us-east-1#/wizard/) or manually go in the ACM Console and click "Request a new certificate" **in the `us-east-1` region** (CloudFront requires certificates from `us-east-1`)
- add your domain name and click "Next"
Expand Down
54 changes: 40 additions & 14 deletions docs/deploy.md → docs/deploy.mdx
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
---
title: Deployment
current_menu: deploy
---
import { Callout } from 'nextra/components';

Bref recommends using [the Serverless framework](https://serverless.com/) to deploy your serverless application. This page will show you how.
# Deployment

Bref is designed out of the box to deploy using [the Serverless Framework](https://serverless.com/).

Bref can also work with any other deployment tool: Terraform, CloudFormation, SAM, [AWS CDK](https://github.com/brefphp/constructs), Pulumi… However, the documentation and user experience is optimized for Serverless Framework.

## Deploying manually

To deploy an application configured with `serverless.yml` to AWS, run:
To deploy to AWS an application configured with `serverless.yml`, run:

```bash
serverless deploy
```

> A `.serverless/` directory will be created. You can add it to `.gitignore`.
>
> Want to get an overview of your deployed application? Check out the [Bref Dashboard](https://dashboard.bref.sh/?ref=bref).
A `.serverless/` directory will be created. You can add it to `.gitignore`.

<Callout>
Want to get an overview of your deployed application? Check out the [Bref Dashboard](https://dashboard.bref.sh/?ref=bref).
</Callout>

## Deploying for production

Expand Down Expand Up @@ -57,7 +60,7 @@ It is possible to deploy different stages in different AWS accounts (to lock dow

## Automating deployments

If you are using Gitlab CI, Travis CI, CircleCI or any tool of the sort you will want to automate the deployment to something like this:
If you are using GitHub Actions, Gitlab CI, CircleCI, or any tool of the sort you will want to automate the deployment to something like this:

```bash
# Install Composer dependencies optimized for production
Expand Down Expand Up @@ -87,7 +90,11 @@ provider:
...
```

> If you are a first time user, using the `us-east-1` region (the default region) is recommended for the first projects. It simplifies commands and avoids a lot of mistakes when discovering AWS.
<Callout>
If you are a first time user, using the `us-east-1` region (the default region) is recommended for the first projects. It simplifies commands and avoids a lot of mistakes when discovering AWS.

I mean really… I can't count how many times a command failed or an AWS page looked empty because I was in the wrong region.
</Callout>

## Deletion

Expand All @@ -97,23 +104,42 @@ To delete the whole application you can run:
serverless remove
```

Note that this command, like `serverless deploy`, is for a specific stage. If you want to delete all stages you will have to run the command once per stage.

## How it works

### CloudFormation stacks

The `serverless deploy` command will deploy everything via a **[CloudFormation](https://aws.amazon.com/cloudformation/) stack**. A stack is nothing more than a bunch of things that compose an application:
The `serverless deploy` command will deploy everything via a **[CloudFormation](https://aws.amazon.com/cloudformation/) stack**. A "stack" is nothing more than a bunch of things that compose an application:

- lambda functions
- S3 buckets
- databases
- etc.

Stacks make it easy to group those resources together: the whole stack is updated at once on deployments, and if you delete the stack all the resources inside are deleted together too. Clean and simple.

All of this is great except CloudFormation configuration is complex. This is where *Serverless* helps.
All of this is great except CloudFormation configuration is complex. This is where Serverless Framework helps.

### Zero-downtime deployments

CloudFormation deploys using the [blue/green deployment strategy](https://docs.aws.amazon.com/whitepapers/latest/overview-deployment-options/bluegreen-deployments.html).

This means that when you deploy, a new version of your code is deployed alongside the old one. Once the new version is ready, the traffic switches to the new version. If the deployment fails at any point, the traffic stays on the old version.

#### Limits to blue/green deployment

As soon as you introduce **asynchronous behaviors** (e.g. background jobs with SQS, event-driven microservices…) you may have in-flight messages (SQS jobs, EventBridge events…) created by the old version of your code that will be processed by the new version of your code.

Code that handles asynchronous events must be able to handle messages created by older versions of the code.

#### Database migrations

Zero-downtime deployments mean that database migrations must run when code is running in production. That means either before or after the deployment (traffic switch) happens, and having a DB migration strategy compatible with that.

### `serverless.yml`

The *Serverless* framework offers a simple configuration format. This is what you are using if you use Bref. That configuration is written in your project in a `serverless.yml` file.
Serverless Framework offers a simple configuration format. This is what you are using if you use Bref. That configuration is written in your project in a `serverless.yml` file.

You can [learn more about that configuration format here](environment/serverless-yml.md).

Expand Down
3 changes: 3 additions & 0 deletions docs/deploy/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"docker": "Deploying Docker images"
}
Loading