Your deploy script first needs to connect to your FTP server via SFTP. Learn how to do this while keeping passwords and other connection information secure by using environment variables.
- [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 much better…than storing them directly in this file…
- Advantages of static sites
- Installing Jekyll and Git
- Creating a new Jekyll site
- Installing themes
- Adding posts, pages, and static content
- Setting up for deployment with GitHub, Travis CI, Node, and npm
- Deploying to FTP, AWS, and Netlify
- Adding a custom, secure domain
Skill Level Beginner
1. How Static Sites Work
2. Set Up Jekyll
3. Build a Website
4. Prepare for Publishing
5. Deploy via FTP
6. Deploy to AWS
7. Deploy with Netifly
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.