From the course: Learning Static Site Building with Jekyll
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
Connect to the server
From the course: Learning Static Site Building with Jekyll
Connect to the server
- [Instructor] Let's create the deploy.js script. I'll do New File, call it deploy.js, and we'll start writing the code that we need. I'll start by doing const sftpclient equals require ssh2-sftp-client, which is one of the packages we grabbed via npm. I'll also do next sftp equals new SftpClient. I'm going to declare a variable called itemsToUpload. We'll come back to this in a second. But first I want to have the SFTP client connect to the server. I'll do sftp.connect and pass it some connection information. We need to specify a host, and I'm going to not hardcode the host, but I'm going to do process.env.FTP_DEPLOY_HOST. That'll pull a value from environment variables, and I'll show you how to hook that up a little bit later. I'm going to do the same thing for port, FTP_DEPLOY_PORT, and for username and password, as well. So the password comes from process.env like the other ones, FTP_DEPLOY_PASSWORD. Storing connection information, especially passwords, in environment variables is…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
(Locked)
Deploy via FTP overview2m 2s
-
(Locked)
Set up Node and npm1m 40s
-
(Locked)
Connect to the server7m 21s
-
(Locked)
Collect the local files4m 51s
-
(Locked)
Remove old files from the server5m 39s
-
(Locked)
Upload the site content2m 43s
-
(Locked)
Deploy via FTP with Travis CI3m 10s
-
(Locked)
FTP next steps1m 2s
-
(Locked)
-
-
-