Configure Puma-Dev with Ruby on Rails in Ubuntu

I was working with Puma-Dev with Ruby on Rails and there are so many difficulties to find the instructions on setup Puma-Dev on the Ubuntu environment.

So I am writing this blog for some steps I followed to setup Puma-Dev on my Ubuntu system. I Hope it will help.

If you want to try yourself or need some guidance here is the Link for Puma-Dev Doc for reference.

There are some dependencies before installing Puma-Dev.

  1. Go Installation:

Go to the terminal and run

sudo apt install golang-go

You can verify if it’s installed or not by running:

go version

2. Installing build-essential and git packages

Run the command

sudo apt-get install build-essential git

3. Install authbind

run the command

sudo apt install authbind

Initiating puma-dev

Now first we need to get the Github repo on our local using the command:

go get github.com/puma/puma-dev/...

after doing this you will get one repo with directory name go for further step I am using $GOPATH as it may vary as your current location:

cd $GOPATH/src/github.com/puma/puma-dev/

If you look into this directory you will get makefile which will do the trick for us

make && make install

After this the puma-dev in installed on the system but for confirmation let’s do some check

$GOBIN/puma-dev -V

here $GOBIN path for me is go/bin can vary for you.

If everything is well until now… we have completed the initial stage…

Configure certificates

If you try to go to ~/.puma-dev-ssl/ you will find nothing so first we have to run puma-dev

$GOBIN/puma-dev

Now if you go to this path ~/.puma-dev-ssl/ you will find two files cert.pem and key.pem .

Now in series you have to run these commands

sudo mkdir -p /usr/local/share/ca-certificates
sudo cp ~/.puma-dev-ssl/cert.pem /usr/local/share/ca-certificates/puma-dev-pem.crt
sudo update-ca-certificates

Now we have configure the certificates now one more thing we have to do is resolve TLDs.

Resolve TLDs

Clone dev-tld-resolver

git clone https://github.com/mnishihan/dev-tld-resolver.git

run the following set of commands to install

cd dev-tld-resolver/src && make
sudo make install

Now go to /etc/environment file and add the following line

DEV_TLD_DOMAINS=dev,wp,dpl

here dev , wp , and dpl are the top-level domains

and at last in the file /etc/nsswitch.conf there is a line looks like:

hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4

edit it as:

hosts: files mdns4_minimal [NOTFOUND=return] dev_tld dns mdns4

Now try to ping

ping test.dev

If it ping you are good to go.

Start the Puma-Dev server with binding

sudo authbind $GOBIN/puma-dev -http-port 80 -https-port 443

Thanks for reading. Have FUN…

Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store