Skip to content

Commit dd3dc11

Browse files
chadwcarlsongmoigneuthomasdiluccioAnouckColson
authored
[Laravel] Resubmit: Adding the "Getting started" guide for Laravel (#3899)
* Clone the Symfony Getting Started. The page is done. * Correct typo on get-started * WIP: First version of the laravel getting started guide * First version of the Laravel Get Started Guide * Update sites/friday/src/get-started/stacks/laravel/_index.md Co-authored-by: Thomas di Luccio <[email protected]> * Update sites/friday/src/get-started/stacks/laravel/blackfire.md Co-authored-by: Thomas di Luccio <[email protected]> * Update sites/friday/src/get-started/stacks/laravel/crons.md Co-authored-by: Thomas di Luccio <[email protected]> * Update sites/friday/src/get-started/stacks/laravel/environment-variables.md Co-authored-by: Thomas di Luccio <[email protected]> * Update sites/friday/src/get-started/stacks/laravel/faq.md Co-authored-by: Thomas di Luccio <[email protected]> * Update sites/friday/src/get-started/stacks/laravel/faq.md Co-authored-by: Thomas di Luccio <[email protected]> * Update sites/friday/src/get-started/stacks/laravel/faq.md Co-authored-by: Thomas di Luccio <[email protected]> * Update sites/friday/src/get-started/stacks/laravel/faq.md Co-authored-by: Thomas di Luccio <[email protected]> * Doc review --------- Co-authored-by: Guillaume Moigneu <[email protected]> Co-authored-by: Guillaume Moigneu <[email protected]> Co-authored-by: Thomas di Luccio <[email protected]> Co-authored-by: Anouck Colson <[email protected]>
1 parent 1166929 commit dd3dc11

File tree

16 files changed

+966
-45
lines changed

16 files changed

+966
-45
lines changed

sites/upsun/config/_default/params.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ vendor:
3535
services: .upsun/config.yaml
3636
app: .upsun/config.yaml
3737
apps: .upsun/config.yaml
38+
env: .environment
3839
prefix:
3940
apps: applications
4041
services: services

sites/upsun/src/get-started/stacks/laravel.md

Lines changed: 0 additions & 43 deletions
This file was deleted.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
title: Deploying Laravel on Upsun
3+
sidebarTitle: Laravel
4+
sectionBefore: PHP
5+
layout: single
6+
weight: -65
7+
description: |
8+
Complete the last required steps to successfully deploy Laravel on {{% vendor/name %}}.
9+
---
10+
11+
{{< note theme="info" >}}
12+
13+
Before you start, check out the [{{% vendor/name %}} demo app](https://console.upsun.com/projects/create-project) and the main [Getting started guide](/get-started/here/_index.md).
14+
They provide all of the core concepts and common commands you need to know before using the materials below.
15+
16+
{{< /note >}}
17+
18+
{{< get-started/steps >}}
19+
20+
## Further resources
21+
22+
### Documentation
23+
24+
- [PHP documentation](/languages/php/)
25+
26+
- [Extensions](/languages/php/extensions)
27+
28+
- [Performance tuning](/languages/php/tuning)
29+
30+
- [PHP-FPM sizing](/languages/php/fpm)
31+
32+
- [Swoole on {{% vendor/name %}}](/languages/php/swoole)
33+
34+
- [Authenticated Composer](/languages/php/composer-auth)
35+
36+
### Community content
37+
38+
- [Laravel topics](https://support.platform.sh/hc/en-us/search?utf8=%E2%9C%93&query=laravel)
39+
40+
- [PHP topics](https://support.platform.sh/hc/en-us/search?utf8=%E2%9C%93&query=php)
41+
42+
### Blogs
43+
44+
- [_Upsun: the missing PaaS to scale Laravel applications_](https://upsun.com/blog/paas-to-scale-laravel-apps/)
45+
46+
<!-- ## Video -->
47+
48+
{{< guide-buttons next="Get started" nextLink="/get-started/stacks/laravel/get-started.md" type="*" >}}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
title: "Continous Observability with Blackfire"
3+
sidebarTitle: "Blackfire"
4+
weight: -90
5+
description: Set up a continuous observability strategy for your Laravel app with Blackfire.
6+
---
7+
8+
[Blackfire.io](/increase-observability/application-metrics/blackfire.md) is the recommended solution
9+
for monitoring and profiling web sites and apps.
10+
Blackfire works seamlessly with any app built with Laravel.
11+
12+
Blackfire PHP SDK provides the following [integrations with
13+
Laravel](https://docs.blackfire.io/php/integrations/laravel/index):
14+
15+
- [Laravel Artisan](https://docs.blackfire.io/php/integrations/laravel/artisan)
16+
- [Laravel Horizon and queue services](https://docs.blackfire.io/php/integrations/laravel/horizon)
17+
- [Laravel Tests](https://docs.blackfire.io/php/integrations/laravel/tests)
18+
- [Laravel Octane](https://docs.blackfire.io/php/integrations/laravel/octane)
19+
20+
Please refer to the [Blackfire documentation](https://docs.blackfire.io/testing-cookbooks/tests#the-code-blackfire-yaml-code-file) to set up a `.blackfire.yml` configuration to enable custom [performance tests](https://docs.blackfire.io/testing-cookbooks/index)
21+
and automated [builds](https://docs.blackfire.io/builds-cookbooks/index).
22+
23+
{{< guide-buttons previous="Back" next="Debug with Telescope" nextLink="/get-started/stacks/laravel/laravel-telescope.md" type="*" >}}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
---
2+
title: "Set up cron jobs"
3+
weight: -105
4+
description: |
5+
Understand how to configure Laravel cron jobs.
6+
---
7+
8+
Cron jobs allow you to run scheduled tasks at specified times or intervals.
9+
10+
While you can run your own custom tasks, Laravel provides a scheduler to simplify the implementation.
11+
To implement it, see the Laravel [Task Scheduling documentation](https://laravel.com/docs/master/scheduling).
12+
13+
## Set up a cron job
14+
15+
To set up a cron job, update your {{% vendor/name %}} configuration as follows:
16+
17+
```yaml {configFile="app"}
18+
applications:
19+
myapp:
20+
[...]
21+
crons:
22+
snapshot:
23+
spec: * * * * *
24+
cmd: |
25+
php artisan schedule:run >> /dev/null 2>&1
26+
```
27+
28+
## Run cron jobs based on environment type
29+
30+
To run a command in a cron hook for specific environment types,
31+
use the `PLATFORM_ENVIRONMENT_TYPE` environment variable:
32+
33+
```yaml {configFile="app"}
34+
applications:
35+
myapp:
36+
[...]
37+
crons:
38+
snapshot:
39+
spec: 0 5 * * *
40+
cmd: |
41+
# only run for the production environment, aka main branch
42+
if [ "$PLATFORM_ENVIRONMENT_TYPE" = "production" ]; then
43+
php artisan schedule:run >> /dev/null 2>&1
44+
fi
45+
```
46+
47+
## Run the Laravel scheduler every minute
48+
49+
Cron job execution on the default {{< vendor/name >}} offering are limited to once every 5 minutes.
50+
For more information, see the [documentation on crons](/create-apps/app-reference.html#crons).
51+
52+
However, you can add a [worker](/create-apps/app-reference#workers)
53+
and specify a start command that [runs the scheduler every minute](https://laravel.com/docs/11.x/scheduling#running-the-scheduler-locally).
54+
To do so, use the following configuration:
55+
56+
```yaml {configFile="app"}
57+
applications:
58+
[...]
59+
{{< variable "APP_NAME" >}}:
60+
[...]
61+
workers:
62+
scheduler:
63+
commands:
64+
start: |
65+
php artisan schedule:work
66+
```
67+
68+
{{< note title="Warning" theme="warning" >}}
69+
70+
Web and worker containers don't share mount targets.
71+
You can't share files between those containers using the filesystem.
72+
To share data between containers, use [services](/add-services/_index.md).
73+
74+
{{< /note >}}
75+
76+
{{< guide-buttons previous="Back" next="Manage observability with Blackfire" nextLink="/get-started/stacks/laravel/blackfire.md" type="*" >}}

0 commit comments

Comments
 (0)