Deploy to aws ec2 #143
Answered
by
yandeu
NilsChr
asked this question in
Help / Questions
Deploy to aws ec2
#143
-
Is it possible to get an example of how to host an app on AWS? F.ex the Demo chat app. I cant get the connection right when trying this out |
Beta Was this translation helpful? Give feedback.
Answered by
yandeu
Dec 4, 2021
Replies: 1 comment 1 reply
-
Try this on Ubuntu 20.04 (AWS EC2): Security Group (Firewall)
Installation ScriptThe name of the user is #!/bin/bash
# tested on ubuntu 20.04 / t3a.nano
sudo apt update && \
sudo apt upgrade -yq && \
sudo apt install cmake -yq && \
# Node.js 16.x (https://github.com/nodesource/distributions/blob/master/README.md#deb)
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash - && \
sudo apt-get install -y nodejs && \
sudo npm install -g [email protected] && \
# Install pm2
sudo npm install -g pm2@latest && \
# Install gitget
sudo npm install -g gitget@latest && \
# Navigate home
cd /home/ubuntu && \
# Download Repository
sudo -u ubuntu gitget geckosio/simple-chat-app-example#httpServer && \
# Install
cd simple-chat-app-example && \
sudo -u ubuntu npm install && \
# PM2
sudo -u ubuntu pm2 start npm -- run serve && \
sudo -u ubuntu pm2 save && \
sudo env PATH="$PATH:/usr/bin" /usr/lib/node_modules/pm2/bin/pm2 startup systemd -u ubuntu --hp /home/ubuntu && \
sudo -u ubuntu pm2 save && \
# Finish
cd ../ && \
sudo -u ubuntu echo "done" | sudo tee status.txt && \
sudo shutdown -r now |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
NilsChr
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Try this on Ubuntu 20.04 (AWS EC2):
Security Group (Firewall)
Installation Script
The name of the user is
ubuntu
.