Skip to content

Commit ada0ffd

Browse files
Rishi Raj Jainphillord
Rishi Raj Jain
authored andcommitted
Guide: Deploy Zola with Layer0 (getzola#1704)
1 parent 943df3d commit ada0ffd

File tree

1 file changed

+63
-0
lines changed
  • docs/content/documentation/deployment

1 file changed

+63
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
+++
2+
title = "Layer0"
3+
weight = 50
4+
+++
5+
6+
[Layer0](https://www.layer0.co) is an all-in-one platform to develop, deploy, preview, experiment on, monitor, and run your headless frontend. It is focused on large, dynamic websites and best-in-class performance through EdgeJS (a JavaScript-based Content Delivery Network), predictive prefetching, and performance monitoring. Layer0 offers a free tier.
7+
8+
If you don't have an account with Layer0, you can sign up [here](https://app.layer0.co/signup).
9+
10+
## Manual deploys
11+
12+
For a command-line manual deploy, follow these steps:
13+
1. Install the Layer0 CLI:
14+
```bash
15+
npm i -g @layer0/cli
16+
```
17+
18+
2. Create a package.json at the root of your project with the following:
19+
```js
20+
{
21+
"name": "zola",
22+
"version": "1.0.0",
23+
"scripts": {
24+
"build": "zola build",
25+
"layer0:dev": "0 dev",
26+
"layer0:buid": "0 build",
27+
"layer0:deploy": "0 deploy"
28+
},
29+
"dependencies": {},
30+
"devDependencies": {}
31+
}
32+
```
33+
34+
3. Initialize your project with:
35+
```bash
36+
0 init
37+
```
38+
39+
4. Update routes.js at the root of your project to the following:
40+
```js
41+
// This file was added by layer0 init.
42+
// You should commit this file to source control.
43+
44+
import { Router } from '@layer0/core/router'
45+
46+
export default new Router().static('public', ({ cache }) => {
47+
cache({
48+
edge: {
49+
maxAgeSeconds: 60 * 60 * 60 * 365,
50+
forcePrivateCaching: true,
51+
},
52+
browser: {
53+
maxAgeSeconds: 0,
54+
serviceWorkerSeconds: 60 * 60 * 24,
55+
},
56+
})
57+
})
58+
```
59+
60+
5. Deploy with:
61+
```bash
62+
0 deploy
63+
```

0 commit comments

Comments
 (0)