# Ubuntu Setup 20.04 LTS
# Tutorial
- Setup ssh config with .pem file from AWS Instance.
- file permission chmod 600 on pem.
- ssh as ubuntu user (default)
sudo su
to change toroot
user.- Create new user with sudo privileges.
- Create a
.ssh
directory in the home diretory of the new user. If you have issues userchmod 700 .ssh
directory to close it to public access.- add
authorized_keys
file to the.ssh
directory. - Copy in rsa-id key into the file ( can use the default one from ubuntu user)
- add
- change back to
root
user ( leave window open do not exit ) - try to ssh in as new user.
- Once successful disable login password for
ubuntu
user by expiring the password withsudo usermod --expiredate 1 ubuntu
- re-enable with
sudo usermod --expiredate "" ubuntu
.
- re-enable with
- Setup UFW firewall
- Ensure OpenSSH is allowed!
- Do not logout before ensuring OpenSSH is enabled and UFW is on.
# References
# Flask Setup
# Tutorial
Notes
- ufw allow OpenSSH
- create non-root user, if using same .pem key. copy
authorized_key
fromubunutu
home directory to new user directory under.ssh
- ssh into instance with new user
- Assign Elastic IP address to ec2 instance
- Login into AWS Route 53 and create a new
A
record for domain. i.e,. Megatron.kpfui.dev and set target to elastic IP address (AKA public ip address). - Once you obtain SSL certs run
sudo ufw status
and removeNginx HTTP
and addNginx Full
.
# Updating
Uwsgi server is setup to update when scout.py
is changed and will perform a graceful reload. Must install dependencies manually on server under the scout_env
virtual enviornment.
Currenty installed
- Pandas
- Numpy
# References
# Node Setup
# Tutorial
- Follow basic setup for Nginx on Ubuntu
- Make sure to enable
Nginx Full
for http and https traffic.
# PM2
The server is constructed by the ecosystem.config.js
file. The file contains environmental authentication variables.
Useful Commands
pm2 logs
shows real-time logs
pm2 status
shows status of cluster nodes
pm2 restart ecosystem.config.js
restarts the cluster with settings from the ecosystem config file.
pm2 momnit
GUI of cluster information
# References
PM2 Ecosystem Config Basic Setup
# MongoDB
TIP
Set Firewall to home + app IP address and comment out bindIP
option in /etc/mongo.conf
.