Skip to content

Commit 113aa0e

Browse files
committed
Update Post “2019-02-27-jamstack-and-cd-pipelines-create-a-blog-with-nuxt-netlify-cms-and-netlify”
1 parent 8c7c32c commit 113aa0e

File tree

1 file changed

+53
-1
lines changed

1 file changed

+53
-1
lines changed

content/blog/2019-02-27-jamstack-and-cd-pipelines-create-a-blog-with-nuxt-netlify-cms-and-netlify.md

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,58 @@ keywords: >-
1414
vue.js jamstack netlify cms blog how-to tutorial guide nuxt.js netlifycms cd
1515
continuous development vue nuxt
1616
date: '2019-02-27T16:15:19-06:00'
17-
thumbnail: /images/uploads/john-barkiple-539580-unsplash-min.jpg
17+
thumbnail: /images/uploads/john-barkiple-539580-unsplash-micro.jpeg
1818
---
19+
## The "old" ways
20+
Say you wanted to create a blog, you'd could easily run a Wordpress site, with a linux server distributing your content. On each page load, the server would generate the webpages, and serve them to the user.
21+
Every request puts the server to work.
22+
It's a perfectly viable option, although slower compared to more modern options, more insecure as you have to be doing the updates on your server (or paying more for a managed server), and it requires using PHP and having a database running.
23+
24+
## JAMstack to the rescue!
25+
So what is JAMstack? It stands for **J**avaScript, **A**PIs and **M**arkup. A modern way of writing webpages that are compiled to static assets right before deploying. JavaScript handles the dynamics in your page, what were server-side processes, are now abstracted into APIs if needed, and your markup is compiled during deploys. Go ahead and read all about it on the [official webpage](https://jamstack.org/).
26+
27+
The benefits that this approach has is that your webpage ends up being blazing fast and with all of your content precompiled, nothing has to be fetched every time the page is served and, you can host it in many many more places (and it's way cheaper (or even free, with [Netlify](https://netlify.com)), as it is only HTML and JS files all while getting improved SEO with your page.
28+
Your page is also more secure! Since you don't have exposed APIs, you could even use Wordpress as a CMS but without the security risks or performance problems of running Wordpress itself.
29+
The performance is definitely worth mentioning again, as it is quite easy to make your site super fast.
30+
31+
There is one caveat though. Every time you change anything, you have to rebuild your assets, and deploy them... ugh... **but wait!**, as that's were a CD pipeline comes into play!
32+
33+
## CD pipelines...?
34+
You've probably heard the terms CI/CD being thrown around, with CD sometimes referring to Continuous Delivery or Continuous Deployment. Arguments get quite long when debating about the PRECISE meaning of these words, as you can see in [this Stack Overflow](https://stackoverflow.com/questions/28608015/continuous-integration-vs-continuous-delivery-vs-continuous-deployment) question.
35+
36+
In my case, I'm talking about Continuous Deployment, as explained by Netlify [here](https://www.netlify.com/docs/continuous-deployment/).
37+
> _Continuous deployment works by connecting a Git repository to a Netlify site and keeping the two in sync._
38+
39+
Easy peasy. We want our repo to be in sync with our site.
40+
41+
### But how?
42+
Netlify is an amazing [PaaS](https://en.wikipedia.org/wiki/Platform_as_a_service/) that has SO MANY FEATURES, really, just to mention a few:
43+
- Automated builds and deployments via webhooks straight from your Git repository.
44+
- Rollbacks, as previous deployments are not erased.
45+
- Continuous Integration tests.
46+
- Deployment previews from Pull Requests.
47+
- Free SSL certificates.
48+
- A CDN.
49+
- AND S O, M U C H, M O R E.
50+
51+
Check out their [features](https://netlify.com/features/) or dive straight into the [documentation](https://www.netlify.com/docs/) pleeeeeaaaase. As everything I mentioned is included in their VERY generous free tier.
52+
So for our use case, we'll can be using their automated build and deployment (as I am).
53+
54+
55+
## Nuxt.js + Netlify, a match made in heaven
56+
In my case, I've been working with [Vue.js](https://vuejs.org) and I wanted to build my blog with Vue, so for that, I used [Nuxt.js](https://nuxtjs.org) which is a framework built on top of Vue that offers both Server Side Rendering (you need a Nuxt instance running, thus a server as well, a no-go for our project) and also offers Static Site Generator, which **compiles** all of your fancy Vue code into plain HTML and JS. That's exactly what we need for Netlify! _OH YEAH!_
57+
58+
Every time you push your code to the repo, Netlify pulls the latest version, and in my case, runs ```nuxt generate``` and then uploads the ```/dist``` folder into their CDN. And that's it! Your latest version is live in a minute or two. No need to upload anything manually or check what version is uploaded... Everything is *automated* now... Continuous Deployment FTW!
59+
60+
## Netlify CMS
61+
Last but not least. How can you manage your content like this?
62+
Remember that the [JAMstack best practices](https://jamstack.org/best-practices/) mention that ideally everything lives on your git, so anyone can, with a couple of clicks, get going and contribute to your project.
63+
64+
That's where [Netlify's CMS](https://www.netlifycms.org/) comes in. It's an Open Source Software, that helps you use your Github as a 'database' in a sense. Allowing you to create blog posts directly into ```.md``` files, which you can push into the repo to trigger the builds, creating new blog posts just like that.
65+
They have an easy to use interface, and even have an editorial workflow, that set articles to be deployed as Pull Requests on your Github, allowing you or your team to review them (using Netlify) before merging them.
66+
67+
All in all, these are amazing tools that let us create blazing fast sites, in a modern environment and require very little configuration for such an amazing final product.
68+
69+
70+
## Getting started
1971
TBD

0 commit comments

Comments
 (0)