Continuous Deployment using Netlify Workshop

This is a place for the information related to the upcoming Aiven workshop Configure your app and data for Continuous Delivery with Netlify.

The prerequisites for the workshop are (click on each :point_down: to jump to the appropriate section):

  • A GitHub account, and we’ll be using git at the command line :point_down:
  • A suitable terminal window :point_down:
  • Sign up for an Aiven account - a Free Trial works excellently :point_down:
  • Install the netlify command, following the Netlify instructions, which requires Node.js. If you’re on a Mac, you can instead use “brew install netlify-cli”. :point_down:
  • Fork the GitHub repository, and clone it to your machine :point_down:

If you don’t have a Netlify account, we’ll show how to set that up in the workshop itself. (But if you want to skip ahead, the Netlify sign up page is here)

We discuss all of the other prerequisites in more detail below.

If you get stuck, please ask for help!

A GitHub account, and using git at the command line

You’ll need a GitHub account. See GitHub’s own Getting started with your GitHub account if you need to set one up.

We’ll be using a couple of git commands at the command line, so you’ll need git installed. Again, GitHub have useful documentation on how to Install Git.
Alternatively, the git website has a “Downloads” page which links to instructions for Mac, Windows and Linux.

We’ll use the following git commands:

  • git clone
  • git status
  • git add
  • git commit
  • git push

We’ll explain what we’re doing, and put the commands into the chat window so you can copy them :slight_smile:

A terminal window and shell

Any shell where you can run git commands should be OK. On Linux we would recommend bash, on a Mac the default is zsh, and on Windows either bash (if you’re using the WSL) or PowerShell should work.

An Aiven account

Rather than get you to set up PostgreSQL® and Redis®* locally, or by some other means, we’re going to use Aiven for PostgreSQL® and Aiven for Redis®* on the Aiven platform.

In fact, for this workshop, our free versions of both of those are perfectly OK - and you can continue using them afterwards, too.

There are instructions at Creating an Aiven account

Install the netlify command

OK, on this one there isn’t actually any extra information.

If you’re on a Mac, you can use brew install netlify-cli.

Otherwise, it’s best to follow the Netflify instructions, which require Node.js - basically they say to do:

npm install netlify-cli -g

Note If you are on Windows (either Ubuntu/WSL and PowerShell), after running npm install netlify-cli -g you will need to add npm to your PATH environment variable so that the terminal can find the netlify command. See node.js - Node JS NPM modules installed but command not recognized - Stack Overflow for more information. (And thanks to Warwick_Allen for figuring this out.)

Fork the demo repository, and clone it

The workshop needs you to have made your own fork of the repository at GitHub - Aiven-Labs/nextjs-no-netlify: Recipe library built with Next.js, PostgreSQL and Redis, for workshop use, to have cloned it to the computer where you’re working, and then you also need to cd into the cloned directory.

The GitHub page Fork a repo teaches all about forks and how to use them, much more than we’ll need for this workshop. Note that you can choose whether you’re on Mac, Windows or Linux, and whether you’re using GitHub CLI (Command Line Interface), Desktop or Web browser.

We’ll summarise two ways to do it:

Fork using a web browser, then clone at the terminal

In this case, first go to your GitHub account, and make sure you’re logged in (if you forget this step, GitHub will ask you to login when you try to make the fork).

Then go to the repository we want to fork using your web browser. The top of the page should look like:

At the right of the page, you should see a “Fork” button:

Click on it, which should take you to the “Create a fork” page. Choose your GitHub user name under Owner:

You can update the name and description if you want, and then click on Create fork. That should take you to the page for your copy of the repository.

Now go to the Code button, and click on it to get download options. If you’ve got SSH set up for your GitHub account, then the default SSH is OK, but if you’re not sure, select HTTPS. Then use the
Screenshot 2023-11-14 at 10.59.58
to copy the URL.

Now, in your terminal window, clone the repository. With SSH that would look like the following (but with YOURUSER replaced by your GitHub user name):

git clone git@github.com:YOURUSER/nextjs-no-netlify.git

and with HTTPS like:

git clone https://github.com/YOURUSER/nextjs-no-netlify.git

Once the repository has been downloaded, you can cd into the new directory:

cd nextjs-no-netlify

and we’re ready for the workshop!

Use the gh command line tool to fork and clone at the terminal

GitHub provide a command line tool called gh, which can be used to do many GitHub operations at the command line. You can find out more about it at About GitHub CLI. Instructions on how to install it are on its own GitHub page - scroll down to find your operating system.

Once you’ve installed gh, you can fork and clone the nextjs-no-netlify repository with one command as follows:

gh repo fork \
    https://github.com/Aiven-Labs/nextjs-netlify.git \
    --clone --remote

and then cd into the new directory:

cd nextjs-no-netlify

and we’re ready for the workshop!

On Windows (for both Ubuntu/WSL and PowerShell), after running npm install netlify-cli -g I had to add ‘npm’ my PATH environment variable to get the terminal to find the netlify command. See node.js - Node JS NPM modules installed but command not recognized - Stack Overflow

1 Like

Thanks so much for figuring this out - that’s very useful to know. I’ve updated the page above with a note.

Apologies that you had to sort this out yourself.