Skip to content
This repository has been archived by the owner on Aug 16, 2022. It is now read-only.
/ pumatra Public archive

bits-service spike on Sinatra with Puma

Notifications You must be signed in to change notification settings

suhlig/pumatra

Repository files navigation

Pumatra = Puma + Sinatra

Source: https://gist.github.com/ctalkington/4448153

Install

bundle install
mkdir -p tmp/puma tmp/uploads tmp/store

First Start

Start Sinatra app

bundle exec puma --config puma.rb

Start nginx

$ nginx -p $PWD -c nginx.conf

-p sets the prefix path, which will be used in nginx.conf when evaluating relative paths. See this SO article for details.

Test

Upload a file (plain HTTP PUT):

curl -X PUT -H "Content-Type:application/octet-stream" --data-binary README.markdown "http://localhost/droplets/550b1d35946db2844bc30ed343599ca573fb9058f3d5c33d777822657c3f51b3"

Deployment

gem install foreman and then run the following command in the project's directory:

foreman start

Development

For fast iteration, watch the nginx config and reload nginx on change:

$ fswatch nginx.conf | xargs -I {} nginx -s reload

This assumes that nginx was already running (see above).

Rerun does the reloading for Ruby files:

$ rerun -- bundle exec puma --config puma.rb

The .tmuxinator.yml file starts all of these commands in a single tmux window.

About

bits-service spike on Sinatra with Puma

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages