March 2017

archive

Find process that is bound to a port Mar
06
1
7

 Sometimes when developing you'll lose control of a process that binds to a specific port. When that happens you can no longer start up another process until you kill the running process that controls the port you want to use.

You can find and kill the process that is controlling the port with the following commands

lsof -i tcp:8000
kill <pid>

comments

Mongo setting global admin user Mar
06
1
7

Auth is turned off by default for Mongo. To set a global admin you need to create an admin user and turn on auth.

If you want to additionally allow external connections you can change the bind ip from 127.0.0.1 that only allows for local connections.

/etc/mongod.conf

bind_ip = 0.0.0.0
port = 27017
auth = trueuse admin
db.addUser({user: "user", pwd: "pass", roles: ["userAdminAnyDatabase", "dbAdminAnyDatabase", "readWriteAnyDatabase"]})

comments

install the latest golang on ubuntu Mar
04
1
7

 You can install golang in ubuntu through apt-get, but it tends to be out of date by a few versions. Luckily, it's easy to install the latest version on any system.

Head to the golang download page: https://golang.org/dl/ and grab the download link. Then back on the server run the following:

wget https://storage.googleapis.com/golang/go1.8.linux-amd64.tar.gz
tar -xvzf go1.8.linux-amd64.tar.gz
sudo mv go /usr/local/go

Next, you just need to set up your envars:

export GOROOT=/usr/local/go
export GOPATH=~/go
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH

# check that it installed correctly
go version
go env

That's it!

comments