Skip to content

is-wh-lin/2023-05-11_Hexschool_Tutorial

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AWS 校園大使 - Node.js 進階應用

直播時間:5/11 (四) 20:00 ~ 21:00 校園大使:Andy Lee, Johnny Yeng

1. Fork This Repo

fork

2. 建立 EC2 實例

可自己部署亦可參考下列方法

  1. 註冊 AWS Educate 帳號
  2. 開啟 EC2 Lab
  3. EC2 的「安全群組」需允許 port 3000 的傳入規則
  4. 從 AWS Educate Details 裡複製 Credentials credentials
  5. 因這次工作坊會在 port 3000 上,需在安全群組裡允許傳入規則 inbound allow-port-3000

3. 設定 Github Actions 所需要用到的資訊

加入以下 key pair HOST_DNS:EC2 網址 USERNAME:ec2-user EC2_SSH_KEY:<YOUR_SSH_KEY> add-github-secrets

4. Clone 自己剛 fork 的 repo

sudo yum update
sudo yum install git -y
git clone <YOUR_OWN_REPO>

5. 安裝 Node

  1. Connect to your Linux instance as ec2-user using SSH.
  2. Install node version manager (nvm) by typing the following at the command line.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash

We will use nvm to install Node.js because nvm can install multiple versions of Node.js and allow you to switch between them. 3. Activate nvm by typing the following at the command line.

. ~/.nvm/nvm.sh
  1. Use nvm to install the latest version of Node.js by typing the following at the command line.

Amazon Linux 2 does not currently support the current LTS release (version 18.x) of Node.js. Use Node.js version 16.x with the following command instead.

nvm install 16
nvm use 16

Installing Node.js also installs the Node Package Manager (npm) so you can install additional modules as needed. 5. Test that Node.js is installed and running correctly by typing the following at the command line. bash node -e "console.log('Running Node.js ' + process.version)" This displays the following message that shows the version of Node.js that is running.

Running Node.js VERSION

6. 執行範例 webapp

  1. 進到專案資料夾
cd 2023-05-11_Hexschool_Tutorial
  1. 安裝相依套件
npm install
npm install pm2 -g
  1. 執行
pm2 start index.js

7. 建立 S3 實例

  1. 使用無痕或是另一個瀏覽器開 S3 Lab
  2. 建立 S3 儲存佇體

    region: us-east-1
    bucket-name: <YOUR_S3_NAME>

8. 開啟 Github Actions

  1. 開啟功能
  2. 使用 Github Codespaces 在 fileparser.js 加入 regionbucket-name
  3. 儲存後會觸發 Github Actions 做自動化部署

Reference

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%