Wednesday, June 15, 2016

Find What Process is Running on a Port OSX

17:12:52 ~/data/github/dronze {feature/#58} $ lsof -i :8000
COMMAND   PID          USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
java    29680 claytongraham  143u  IPv6 0xb9a0c6ac4b96e77f      0t0  TCP *:irdmi (LISTEN)

Monday, June 13, 2016

Minimum Mongo Restore Permissions

So this would work to restore a single database: Backup
sudo mongodump -h localhost -d stuffdb --username restoreSingleDB --password Moon1234 \
  -o stuffdb.20160724.dump
Restore
db.addUser( {
    user: "restoreSingleDB",
    pwd: "Moon1234",
    roles: [ "readWrite", "userAdmin" ]
} )

mongorestore --db  --username restoreSingleDB --password Moon1234 /
So this would work to restore all databases including user data:
db.addUser( {
    user: "restoreAll",
    pwd: "Moon1234",
    roles: [ "readWriteAnyDatabase", "userAdminAnyDatabase" ]
} )

mongorestore --username restoreAll --password Moon1234 /

Sunday, June 05, 2016

Documenting a REST API

I have found that MkDocs is pretty good. I can integrate it into a CICD build with little effort. What was not obvious was best practices for writing API docs. So I create a template! Check it out:

Subdomain CNAME with Cloudfront

Automation is good. It means less mistakes and simple cookbooks for runbooks and deployments. Here is a simple recipe for deploying a subdomain CNAME with cloudfront.