# 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 suto change torootuser.- Create new user with sudo privileges.
- Create a
.sshdirectory in the home diretory of the new user. If you have issues userchmod 700 .sshdirectory to close it to public access.- add
authorized_keysfile to the.sshdirectory. - Copy in rsa-id key into the file ( can use the default one from ubuntu user)
- add
- change back to
rootuser ( leave window open do not exit ) - try to ssh in as new user.
- Once successful disable login password for
ubuntuuser 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_keyfromubunutuhome 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
Arecord 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 statusand removeNginx HTTPand 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 Fullfor 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.