You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i. [Log in to Netlify](http://app.netlify.com). If you haven't made an account yet, then [sign up](https://app.netlify.com/signup).
27
27
@@ -54,21 +54,18 @@ netlify dev
54
54
55
55
</details>
56
56
57
-
<details><summary>Part 2: Understanding deploy contexts and CI/CD</summary>
57
+
<details><summary>Part 2: Understanding deploy contexts and CI/CD</summary><br />
58
58
59
59
Create a new branch, commit changes, push the branch, and open a pull request.
60
60
61
61
```bash
62
-
git checkout -b feat/bookshelf
63
-
git add -A
64
-
git commit -m "Adding a list of books to the home page"
65
-
git push origin feat/bookshelf
62
+
git checkout -b testing
63
+
git commit -m "Changing some headings to red"
64
+
git push origin testing
66
65
```
67
66
68
67
You should see a link to the Deploy Preview as a comment by the Netlify bot on the pull request. Pushing to an open pull request [will kick off a new build](https://www.netlify.com/products/build/) in the Continuous Integration pipeline, and you can inspect the deploy logs as the build is building and deploying.
69
68
70
-
In addition to deploy logs, the Netlify UI gives you access to function logs as well. You can change the region a function executes by changing the region selector in **Site configuration > Build & deploy > Functions**.
71
-
72
69
In the Deploy Preview itself, you'll notice a floating toolbar anchored to the bottom of your screen. This is the [Netlify Drawer](https://www.netlify.com/products/deploy-previews/). You and your teammates can use this to leave feedback to each other about the Deploy Preview. Any comments you make will sync back to the pull request on GitHub (or any Git service that you may use).
73
70
74
71
Back in the pull request, merge to main. This will kick off a production build. Every deploy is [atomic](https://jamstack.org/glossary/atomic/) and [immutable](https://jamstack.org/glossary/immutable/), which makes [instant rollbacks](https://docs.netlify.com/site-deploys/manage-deploys/#rollbacks) a breeze.
@@ -84,29 +81,37 @@ git pull origin main
84
81
85
82
</details>
86
83
87
-
<details><summary>Part 3: Share environment variables with your team</summary>
84
+
<details><summary>Part 3: Share environment variables with your team</summary><br />
85
+
86
+
You can securely manage and share environment variables with your teammates in both the Netlify CLI and UI. Let's start with the CLI.
88
87
89
-
You can manage environment variables in the UI and CLI.
88
+
It's common practice for projects to have a gitignored `.env` file in the root of the repo. This one doesn't, so let's add a dummy one now:
90
89
91
-
Go to **Site configuration > Environment variables** to add site-specific env vars to your site.
90
+
```bash
91
+
echo"MY_API_TOKEN=asdf123456789"> .env
92
+
```
92
93
93
-
In the CLI, enter the following command to create an environment variable that is scoped to the Functions runtime:
94
+
To share this hypothetically-sensitive value with your team, simply use the `env:import` command:
Now, when you go to **Site configuration > Environment variables** in the Netlify UI, you should see your environment variable that you had saved in your `.env` file.
101
+
102
+
You can adjust deploy contexts and scopes in the UI, and in the CLI too.
103
+
99
104
π‘ Learn more about [environment variables](https://docs.netlify.com/environment-variables/overview/) in our docs.
100
105
101
106
</details>
102
107
103
108
### Platform features
104
109
105
-
<details><summary>Part 1: Getting acquainted with the Netlify UI</summary>
110
+
<details><summary>Part 1: Getting acquainted with the Netlify UI</summary><br />
106
111
107
112
Here, we'll take a quick segue from our CLI and dev environment to showcase more features from the Netlify UI.
-[Real User Metrics](https://docs.netlify.com/monitor-sites/real-user-metrics/)
@@ -115,63 +120,78 @@ Here, we'll take a quick segue from our CLI and dev environment to showcase more
115
120
116
121
</details>
117
122
118
-
<details><summary>Part 2: High-level overview of platform primitives</summary>
119
-
120
-
Here, we'll list out use cases and limitations of core primitives, and why you would choose one over the other.
121
-
122
-
- Functions
123
-
- Edge Functions
124
-
- Blobs
125
-
- Image CDN
123
+
<details><summary>Part 2: High-level overview of platform primitives</summary><br />
124
+
125
+
These are the primitives that we'll be talking more about in Day 2 of this workshop. It's useful to understand their benefits and how they compare to one another.
126
+
127
+
-**Functions**
128
+
- Built on AWS Lambda
129
+
- Runs in a single region (this is configurable)
130
+
- 10s execution time (can be extended up to 26s)
131
+
- 50MB bundle size max, 6MB payload size max
132
+
- Supports streaming
133
+
-**Edge Functions**
134
+
- Built on Deno Deploy
135
+
- Runs on the edge, geographically close to user
136
+
- Must respond with headers within 40s
137
+
- 20MB bundle size max
138
+
- Supports streaming
139
+
-**Blobs**
140
+
- Built on AWS S3
141
+
- Ubiquitously available in build, functions, edge functions
142
+
- Optimized for frequent reads / infrequent writes
143
+
- Supports CRUD operations
144
+
- Deploy-specific stores
145
+
-**Image CDN**
146
+
- Built on Imgix
147
+
- Dynamically optimize and cache images at request-time
148
+
149
+
Netlify offers more primitives than this -- for example, you can create serverless cron jobs with [Scheduled Functions](https://docs.netlify.com/functions/scheduled-functions/), and run long-running tasks with [Background Functions](https://docs.netlify.com/functions/background-functions/)! But we won't dive into those topics during this workshop.
126
150
127
151
</details>
128
152
129
153
### Platform primitives
130
154
131
-
<details><summary>Part 1: Configuring headers, proxies, and redirects</summary>
155
+
<details><summary>Part 1: Configuring headers, proxies, and redirects</summary><br />
132
156
133
-
Inside your publish directory (for this repo, `/public`), add a `_redirects` file that contains the following:
157
+
You can configure many aspects of your site in code with the [netlify.toml](https://docs.netlify.com/configure-builds/file-based-configuration/#sample-netlify-toml-file) file.
134
158
135
-
```
136
-
/* /index.html 200
137
-
```
138
-
139
-
For every fallthrough case (i.e. whenever a route is accessed and there isn't a file match), it will now redirect back to `/index.html`, where `react-router` will route accordingly.
140
-
141
-
Similar to the `_redirects` file is the `_headers` file. Here you can set custom headers for routes of your choosing. Create a `/public/_headers` file, and save the following:
159
+
Similar to the `_redirects` file is the `_headers` file. Here you can set custom headers for routes of your choosing. Inside the `/public/_headers` file, and save the following:
142
160
143
161
```
144
162
/*
145
-
X-Frame-Options: SAMEORIGIN
163
+
X-Frame-Options: deny
146
164
```
147
165
148
166
This will prevent your site from being loaded in an iframe, a technique that help your site prevent [clickjacking](https://en.wikipedia.org/wiki/Clickjacking) attacks.
149
167
150
168
You can also configure both redirects and headers inside the `/netlify.toml` file. Here is the `netlify.toml` equivalents of the above:
151
169
152
170
```
153
-
[[redirects]]
154
-
from = "/*"
155
-
to = "/index.html"
156
-
status = 200
157
-
158
171
[[headers]]
159
172
for = "/*"
160
173
[headers.values]
161
-
X-Frame-Options = "SAMEORIGIN"
174
+
X-Frame-Options = "deny"
162
175
```
163
176
164
-
π‘ Learn more about [redirects](https://docs.netlify.com/routing/redirects/) and [custom headers](https://docs.netlify.com/routing/headers/) in our docs.
177
+
π‘ Learn more about [redirects and rewrites](https://docs.netlify.com/routing/redirects/) and [custom headers](https://docs.netlify.com/routing/headers/) in our docs.
165
178
166
179
</details>
167
180
168
-
<details><summary>Part 2: Rendering techniques and caching strategies</summary>
181
+
<details><summary>Part 2: Rendering techniques and caching strategies</summary><br />
182
+
183
+
**π§βπ» Relevant demo and code:**
184
+
185
+
-[Static site generation (SSG)](https://netlify-core-workshop.netlify.app/rendering-strategies/ssg) ([src/pages/rendering-strategies/ssg.tsx](https://github.com/netlify/netlify-workshop/blob/main/src/pages/rendering-strategies/ssg.tsx))
0 commit comments