From feec2c9630a357ec5129b06e875a18d0e3b2e643 Mon Sep 17 00:00:00 2001 From: Stephen Rushe Date: Thu, 20 Jun 2024 22:00:56 +0100 Subject: [PATCH] Update for the move from Passenger to Puma --- .gitignore | 3 +++ Gemfile | 1 + Gemfile.lock | 6 +++++- README.md | 4 +++- config.ru | 8 ++++++++ 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 0c1d97a..c869d94 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,7 @@ .env +.ruby-version +.ruby-gemset public/* spec/examples.txt +log/* tmp/* diff --git a/Gemfile b/Gemfile index 63bf4e9..872f197 100644 --- a/Gemfile +++ b/Gemfile @@ -3,6 +3,7 @@ source "https://rubygems.org" gem 'sinatra' +gem 'puma' gem 'dotenv' gem 'indieauth-token-verification' gem 'mime-types' diff --git a/Gemfile.lock b/Gemfile.lock index b8790b4..c4af78d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -9,6 +9,9 @@ GEM mime-types-data (3.2019.1009) mustermann (3.0.0) ruby2_keywords (~> 0.0.1) + nio4r (2.7.3) + puma (6.4.2) + nio4r (~> 2.0) rack (2.2.9) rack-protection (3.2.0) base64 (>= 0.1.0) @@ -28,7 +31,8 @@ DEPENDENCIES dotenv indieauth-token-verification mime-types + puma sinatra BUNDLED WITH - 2.1.4 + 2.5.13 diff --git a/README.md b/README.md index 0c231e7..665aae0 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Babbas is a Media endpoint for use with an IndieWeb [Micropub](http://micropub.r ## Installation -Babbas is currently used as the Media endpoint for my personal website (https://deeden.co.uk/) and, as such, is configured to work for me. It should work for someone else if properly configured (via `.env`). For my purposes I run Babbas through [Passenger](https://www.phusionpassenger.com/) on a [Dreamhost VPS](https://www.dreamhost.com/hosting/vps/). +Babbas is currently used as the Media endpoint for my personal website (https://deeden.co.uk/) and, as such, is configured to work for me. It should work for someone else if properly configured (via `.env`). For my purposes I run Babbas through [Puma](https://github.com/puma/puma) on a [Dreamhost VPS](https://www.dreamhost.com/hosting/vps/). ## Configuration @@ -25,6 +25,8 @@ Use of the application **requires** a number of environment variables to be spec | DATA_DIRECTORY | Directory path | A more specific directory (within `ENDPOINT_BASE`) for where your media will be stored. | | TOKEN_ENDPOINT | URL | The token endpoint used to verify any IndieAuth token | | DOMAIN | URL | The domain any IndieAuth token will be verified to be valid for | +| PORT | Number | The port number to run the server on | +| LOG_FILE | File path | The path to where logs should be written | ##### `ENDPOINT_BASE` vs `DATA_DIRECTORY` diff --git a/config.ru b/config.ru index 99971ae..b8095b7 100644 --- a/config.ru +++ b/config.ru @@ -2,4 +2,12 @@ require 'dotenv/load' require 'sinatra' require './lib/babbas/application' +set :port, ENV["PORT"] + +configure do + file = File.new(ENV["LOG_FILE"], 'a+') + file.sync = true + use Rack::CommonLogger, file +end + run Babbas::Application -- 2.45.2