project,

Deploy Wechaty in AWS ec2

charleswu charleswu Follow Aug 28, 2020 · 1 min read
Deploy Wechaty in AWS ec2

This article is about to deploy wechaty node.js application into AWS EC2 steps by steps.

Prerequisites

Steps

Step 1 Launch a linux ec2 instance

Follow the AWS official Document to launch a linux instance. Launching an instance using the Launch Instance Wizard

With a successful launch, you shall be able to see the instance status is running as screen below EC2 is running

Step 2 Connect the ec2 instance by ssh

Follow the AWS documents to connect the ec2 instance by ssh client

With a successful connection, you shall be able to see the console prompt as below:

[ec2-user@ip-172-31-8-111 ~]$

Step 3 Install nvm and node

  • Install node version manager (nvm) by typing the following at the command line.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
  • Use nvm to install the latest version of Node.js by typing the following at the command line.
nvm install node

Step 4 install git and clone wechaty

  • To install git, run below commands in the terminal:
sudo yum update -y
sudo yum install git -y
  • Clone wechaty from github
git clone https://github.com/wechaty/wechaty-getting-started.git

Step 5 Install wechaty dependencies and set up environment

npm install
export WECHATY_PUPPET=wechaty-puppet-padplus
export WECHATY_PUPPET_PADPLUS_TOKEN='xxxxxx'

Step 6

Start Wechaty with logs

npm start > output.log 2> error.log

Todo

  • Externalize the memory card file into s3.
  • For some unknown reason, the nodejs server stops. Need to investigate
Join Newsletter
Get the latest news right in your inbox. We never spam!
Written by charleswu
keep learning keep growing