sudo DEBUG=* node knotter.js
From any terminal
curl -Ik https://127.0.0.1/api/health_check
curl -Ik https://knotter.co/api/health_check
(If you're renewing certs, you have to stop NGINX first) (The domain must be routed to the IP that were doing this on and open to the web, aka not through NGINX, when performing first time setup)
clone certbot
git clone https://github.com/certbot/certbot.git
cd certbot
then run certbot
sudo ./certbot-auto certonly --standalone --email ehlewis@me.com -d knotter.co -d www.knotter.co
or if that has issues
sudo certbot certonly --standalone --preferred-challenges http -d knotter.co -d www.knotter.co
Finally, move the new certs to the directory for NGINX
cp cert.pem /etc/letsencrypt/live/knotter.co/
cp privkey.pem /etc/letsencrypt/live/knotter.co/
sudo apt-get update
sudo apt-get install nginx
sudo services nginx start
Insert the file located in .extras named default into /etc/nginx/sites-available
sudo service nginx restart
sudo service stop nginx
But this doesn't always work, so less gracefully
sudo pkill nginx
Install npm
sudo apt-get install npm
Then install required node packages: From within /knotter
npm install
sudo npm install pm2 -g
Do not run in sudo
pm2 start knotter.js
pm2 stop server
If this runs away
ps -eo pid,ppid,args | grep node
Kill the parent (PID on the right)
to connect to Redis from GCP vm:
telnet 10.0.0.27 6379
npm test
to run the test file
mongo
show dbs
use link
db.users.find().pretty()
db.users.updateMany({}, {$rename: {"from":"to"}})
db.users.findOne({items: {$elemMatch: {item_id:'BGGGoMG396SKWdXW1m1ntJ8xm3LzvwfwGnDaX'}}})
Returns the user entry with the given item_id
use linkDEV
db.users.remove( {"_id": ObjectId("5bc01bd8839da308ed4d817a")});
use link
db.users.drop()
redis-cli
keys *
flushall