Skip to content

Commit d4977ed

Browse files
Laravel Cloud guide (statamic#1631)
1 parent 1bc7b7d commit d4977ed

12 files changed

+118
-34
lines changed

content/collections/docs/git-automation.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
id: c095fb87-4c02-462c-9e6f-dfe0b6889248
33
blueprint: page
44
title: 'Git Automation'
5-
intro: 'Statamic can automate your version control workflow with Git. It can automatically commit and push content as it''s changed, schedule commits, or allow users to commit and push changes from the control panel without having to understand how git works.'
5+
intro: "Statamic can automate your version control workflow with Git. It can automatically commit and push content as it's changed, schedule commits, or allow users to commit and push changes from the control panel without having to understand how git works."
66
pro: true
77
updated_by: 3a60f79d-8381-4def-a970-5df62f0f5d56
88
updated_at: 1632512218
9+
related_entries:
10+
- b46adc3b-c4de-4148-a388-c8ff498ae9c9
911
---
1012
## Overview
1113

@@ -298,4 +300,4 @@ class PunSaved extends Event implements ProvidesCommitMessage
298300
return __('Pun saved');
299301
}
300302
}
301-
```
303+
```
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
---
2+
id: 68d936b0-b1b0-431d-bbe0-a8356decf251
3+
blueprint: page
4+
title: 'Deploying Statamic with Laravel Cloud'
5+
intro: |-
6+
Laravel Cloud is a fully managed infrastructure platform. It's relentlessly optimized for Laravel and PHP. It's our favorite way to deploy Statamic sites that need to scale.
7+
parent: c4f17d05-78bd-41bf-8e06-8dd52f6ec154
8+
---
9+
Before deploying to Laravel Cloud, there are a few things you should do to prepare your Statamic site:
10+
11+
* Right now, Statamic's [Git automation](/git-automation) doesn't work on Laravel Cloud. You can work around this by either:
12+
* Moving [content](/tips/storing-content-in-a-database) and [users](https://statamic.dev/tips/storing-users-in-a-database) into the database.
13+
* Disabling the Control Panel on Laravel Cloud, and pushing any content changes from your local environment.
14+
* You should move any assets from the local filesystem to Laravel Cloud's object storage feature.
15+
16+
If you don't want to move content to a database, we recommend using a VPS-based solution, like [Laravel Forge](/deploying/laravel-forge).
17+
18+
19+
## Creating your application
20+
21+
Once you've created your [Laravel Cloud](https://app.laravel.cloud) account, click "New application" to get started.
22+
23+
If it's your first application, you'll be asked to connect your Git provider of choice (GitHub, GitLab or Bitbucket).
24+
25+
From there, select the repository you want to deploy, give it a name and pick the region where you want your application deployed.
26+
27+
<figure>
28+
<img src="/img/deployment-cloud-new-application.png" alt="New application modal">
29+
</figure>
30+
31+
Upon creation, you can setup any "resources" needed for your application, like a database or object storage bucket.
32+
33+
<figure>
34+
<img src="/img/deployment-cloud-project-overview.png" alt="Application overview">
35+
</figure>
36+
37+
Make sure to click "Save" after making changes to your application's resources.
38+
39+
:::tip Note
40+
New applications on Laravel Cloud use PHP 8.4 by default. However, some of Statamic's third-party dependencies still need to be updated for PHP 8.4.
41+
42+
For the time being, we recommend downgrading to PHP 8.3 in your environment's settings.
43+
:::
44+
45+
### Creating a database
46+
47+
If you're storing content and users in the database (which), you'll need to create a database cluster in Laravel Cloud. You can do this from the environment overview page:
48+
49+
<figure>
50+
<img src="/img/deployment-cloud-new-database-cluster.png" alt="New database cluster modal">
51+
</figure>
52+
53+
Once you've created your database cluster, you'll probably need to import data from an existing database you might have, whether that be locally or from a staging server.
54+
55+
You can use a database GUI, like [TablePlus](https://tableplus.com/) to do this.
56+
57+
1. Open your existing database, select all of the tables, and right click "Export". Make sure to save your export as a `.sql` file.
58+
2. Connect to your new Laravel Cloud database using the "View credentials" button.
59+
60+
<figure>
61+
<img src="/img/deployment-cloud-db-credentials.png" alt="Database credentials modal">
62+
</figure>
63+
64+
If you're using TablePlus (or another GUI that supports it), you can open the database directly from the "Deeplink" tab.
65+
3. Finally, import your database by right-clicking the tables list and selecting "Import -> From SQL File". From here, you can choose the `.sql` file you just exported.
66+
67+
68+
### Creating an object storage bucket
69+
70+
Since the [Git Automation](/git-automation) doesn’t work on Laravel Cloud, we recommend moving assets to Laravel Cloud's object storage service.
71+
72+
You can create a new bucket from the environment overview page:
73+
74+
<figure>
75+
<img src="/img/deployment-cloud-new-bucket.png" alt="">
76+
</figure>
77+
78+
It'll ask you which filesystem disk the bucket should provide. This should match a disk in your `config/filesystems.php` config file.
79+
80+
Once created, you can upload existing assets using an app like [Transmit](https://panic.com/transmit/), [Cyberduck](https://cyberduck.io/), or any similar app that supports S3-compatible filesystems.
81+
82+
## Deploying your application
83+
84+
Now that you've got everything set up, all thats left to do is trigger your first deployment. 🚀
85+
86+
If you're using Vite to build CSS/JavaScript, make sure to uncomment the `npm` commands in your application's deployment settings.
87+
88+
For more information about Laravel Cloud, please see its [documentation](https://cloud.laravel.com/docs).
89+
90+
91+
## Troubleshooting
92+
93+
### Upstream sent too big header while reading response header from upstream
94+
95+
You may encounter this error when submitting a form on the frontend, or updating content in the Control Panel.
96+
97+
You can fix it by changing your application's session driver from `cookie` to another driver, like `database` or `redis`.
98+
99+
You can find more information about session drivers on the [Laravel documentation](https://laravel.com/docs/12.x/session#introduction).

content/collections/docs/workflow.md renamed to content/collections/tips/git-workflow.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
2-
id: f703b2eb-ad29-4e28-b778-20b00dc5f2b4
3-
blueprint: page
4-
title: Workflow
2+
id: b46adc3b-c4de-4148-a388-c8ff498ae9c9
3+
blueprint: tips
4+
title: 'Git Workflow'
55
intro: 'A good workflow revolving around git to manage your deployments is a key factor in a pain-free and efficient project.'
6-
parent: c4f17d05-78bd-41bf-8e06-8dd52f6ec154
6+
template: page
77
---
88
Given a properly configured VPS solution (like Laravel Forge or similar), your typical deployment workflow would normally look like this:
99

@@ -48,4 +48,4 @@ Whatever the reason, you can ignore the `content` directory in your `.gitignore`
4848

4949
- [Gitflow Workflow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow) – When working with a team (and even when by yourself) it's a good practice to follow a standardized workflow for working with git. We recommend Gitflow.
5050

51-
- [Zero Downtime Deployment Tips](/tips/zero-downtime-deployments#understanding-zero-downtime-deployment-file-structure) - If you plan on using a zero downtime deployment tool like [Envoyer](https://envoyer.io/), [Deployer](https://deployer.org/), etc. be sure to read our tips & tricks guide.
51+
- [Zero Downtime Deployment Tips](/tips/zero-downtime-deployments#understanding-zero-downtime-deployment-file-structure) - If you plan on using a zero downtime deployment tool like [Envoyer](https://envoyer.io/), [Deployer](https://deployer.org/), etc. be sure to read our tips & tricks guide.

content/trees/collections/docs.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ tree:
4848
children:
4949
-
5050
entry: 8fd95af9-f635-45bb-a3d1-1fa1db7be4a2
51+
-
52+
entry: 68d936b0-b1b0-431d-bbe0-a8356decf251
5153
-
5254
entry: cf38dba4-5cce-4b81-a2f5-e82665e4e11f
5355
-
@@ -56,8 +58,6 @@ tree:
5658
entry: 7f809a5e-e555-4ccc-8488-d7310ff8c89c
5759
-
5860
entry: 01ab4b2b-bee2-4697-b3c6-cb129d783589
59-
-
60-
entry: f703b2eb-ad29-4e28-b778-20b00dc5f2b4
6161
-
6262
entry: 94c521e3-bacb-45e3-b385-00bad3cac401
6363
-
@@ -194,8 +194,6 @@ tree:
194194
entry: d0e99506-d01d-484c-884f-46dfc4dcf4c5
195195
-
196196
entry: 1d1920fb-604c-4ac1-8c99-f0de44abc06b
197-
-
198-
entry: 8ecc72e1-f1b7-4708-bf61-8fb98073da64
199197
-
200198
entry: 268d444c-88e3-4b52-bfc6-165749ef3ec1
201199
-
Loading
73.3 KB
Loading
90.9 KB
Loading
Loading
99.7 KB
Loading

public/img/laravel-cloud-logo.svg

Lines changed: 1 addition & 0 deletions
Loading

resources/views/deploying.antlers.html

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,6 @@ <h1>{{ title }}</h1>
1111
</header>
1212

1313
<section class="mt-0 md:pb-16"">
14-
<header class="markdown">
15-
<h2 id="vps">
16-
Managed VPS Guides
17-
<a class="anchor" href="#vps">#</a>
18-
</h2>
19-
</header>
2014
<div class="grid md:grid-cols-2 lg:grid-cols-3 gap-y-6 md:gap-6 mt-8">
2115
<a href="/deploying/laravel-forge" class="bg-white border text-center shadow-stack-sm hover:shadow-stack-yellow-sm rounded-sm px-3 py-6 hover:bg-gradient-to-tl from-gray-lightest dark:bg-gray-darkest dark:text-white dark:shadow-none">
2216
<div class="h-16 flex items-center mb-2">
@@ -25,6 +19,11 @@ <h2 id="vps">
2519
<h2 class="text-2xl mb-2 font-bold font-display">Laravel Forge</h2>
2620
<p class="text-sm font-mono-alt">Server Management Platform</p>
2721
</a>
22+
<a href="/deploying/laravel-cloud" class="bg-white border text-center shadow-stack-sm hover:shadow-stack-yellow-sm rounded-sm px-3 py-6 hover:bg-gradient-to-tl from-gray-lightest dark:bg-gray-darkest dark:text-white dark:shadow-none">
23+
<img class="mx-auto mb-2 h-16" src="/img/laravel-cloud-logo.svg" alt="Laravel Cloud Logo">
24+
<h2 class="text-2xl mb-2 font-bold font-display">Laravel Cloud</h2>
25+
<p class="text-sm font-mono-alt">Managed Infrastructure Provider</p>
26+
</a>
2827
<a href="/deploying/ploi" class="bg-white border text-center shadow-stack-sm hover:shadow-stack-yellow-sm rounded-sm px-3 py-6 hover:bg-gradient-to-tl from-gray-lightest dark:bg-gray-darkest dark:text-white dark:shadow-none">
2928
<img class="mx-auto mb-2 h-16" src="/img/ploi-cake.png" alt="Ploi Logo">
3029
<h2 class="text-2xl mb-2 font-bold font-display">Ploi</h2>
@@ -44,11 +43,6 @@ <h2 class="text-2xl mb-2 font-bold font-display">Fortrabbit</h2>
4443
<h2 class="text-2xl mb-2 font-bold font-display">Buddy</h2>
4544
<p class="text-sm font-mono-alt">CI/CD Platform</p>
4645
</a>
47-
<a href="/deploying/workflow" class="bg-white border text-center shadow-stack-sm hover:shadow-stack-yellow-sm rounded-sm px-3 py-6 hover:bg-gradient-to-tl from-gray-lightest dark:bg-gray-darkest dark:text-white dark:shadow-none">
48-
<img class="mx-auto mb-2 h-16" src="/img/code-fork.svg" alt="Git Branch Icon">
49-
<h2 class="text-2xl mb-2 font-bold font-display">Git Workflow</h2>
50-
<p class="text-sm font-mono-alt">Best Practices</p>
51-
</a>
5246
<a href="https://kinsta.com/docs/statamic-example-application/" target="_blank" class="bg-white border text-center shadow-stack-sm hover:shadow-stack-yellow-sm rounded-sm px-3 py-6 hover:bg-gradient-to-tl from-gray-lightest dark:bg-gray-darkest dark:text-white dark:shadow-none">
5347
<div class="h-16 flex items-center mb-2">
5448
<img class="mx-auto mb-2 h-16 rounded-lg" src="/img/Kinsta_Icon_Black.svg" alt="Kinsta Logo">
@@ -66,18 +60,7 @@ <h2 class="text-2xl mb-2 font-bold font-display">Server Pilot</h2>
6660
<h2 class="text-2xl mb-2 font-bold font-display">Digital Ocean</h2>
6761
<p class="text-sm font-mono-alt">DIY Ubuntu Droplet</p>
6862
</a> #}}
69-
</div>
70-
</section>
71-
72-
<section class="mt-6 md:mt-24 md:pb-16">
73-
<header class="markdown">
74-
<h2 id="static">
75-
Static Site/Jamstack Guides
76-
<a class="anchor" href="#static">#</a>
77-
</h2>
78-
</header>
79-
<div class="grid md:grid-cols-2 lg:grid-cols-3 gap-y-6 md:gap-6 mt-8">
80-
{{# <a href="#" class="bg-white border text-center shadow-stack-sm hover:shadow-stack-yellow-sm rounded-sm px-3 py-6 hover:bg-gradient-to-tl from-gray-lightest dark:bg-gray-darkest dark:text-white dark:shadow-none">
63+
{{# <a href="#" class="bg-white border text-center shadow-stack-sm hover:shadow-stack-yellow-sm rounded-sm px-3 py-6 hover:bg-gradient-to-tl from-gray-lightest dark:bg-gray-darkest dark:text-white dark:shadow-none">
8164
<img class="mx-auto mb-2 h-16" src="/img/digital-ocean-logo.svg" alt="Digital Ocean Logo">
8265
<h2 class="text-2xl mb-2 font-bold font-display">Digital Ocean</h2>
8366
<p class="text-sm font-mono-alt">App Platform</p>

routes/web.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@
2020
Route::permanentRedirect('new-antlers-parser', 'antlers');
2121
Route::permanentRedirect('/tips/storing-entries-in-a-database', '/tips/building-your-own-entries-repository');
2222
Route::permanentRedirect('/account-api-sites', '/sites-api');
23+
Route::permanentRedirect('/deploying/workflow', '/tips/git-workflow');
2324
// Route::permanentRedirect('extending/queries', 'content-queries');

0 commit comments

Comments
 (0)