Skip to content

Commit afa9f43

Browse files
committed
Initial app setup.
1 parent 1604ca0 commit afa9f43

File tree

7 files changed

+92
-0
lines changed

7 files changed

+92
-0
lines changed

.github/dependabot.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: 'bundler'
4+
directory: '/'
5+
schedule:
6+
interval: 'daily'
7+
- package-ecosystem: 'github-actions'
8+
directory: '/'
9+
schedule:
10+
interval: 'daily'

Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM ruby:2.7.2-alpine
2+
3+
COPY Gemfile Gemfile.lock app.rb config.ru /srv/app/
4+
WORKDIR /srv/app
5+
RUN bundle install
6+
7+
EXPOSE 9292
8+
9+
CMD ["bundle", "exec", "rackup", "--host", "0.0.0.0"]

Gemfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
source "https://rubygems.org"
2+
3+
ruby "2.7.2"
4+
5+
gem "sinatra"
6+
gem "prometheus-client"

Gemfile.lock

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
mustermann (1.1.1)
5+
ruby2_keywords (~> 0.0.1)
6+
prometheus-client (2.1.0)
7+
rack (2.2.3)
8+
rack-protection (2.1.0)
9+
rack
10+
ruby2_keywords (0.0.4)
11+
sinatra (2.1.0)
12+
mustermann (~> 1.0)
13+
rack (~> 2.2)
14+
rack-protection (= 2.1.0)
15+
tilt (~> 2.0)
16+
tilt (2.0.10)
17+
18+
PLATFORMS
19+
ruby
20+
21+
DEPENDENCIES
22+
prometheus-client
23+
sinatra
24+
25+
RUBY VERSION
26+
ruby 2.7.2p137
27+
28+
BUNDLED WITH
29+
2.1.4

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Sinatra app
2+
3+
Example Sinatra app with Prometheus instrumentation.
4+
5+
Run with:
6+
7+
```sh
8+
$ bundle exec rackup
9+
```
10+
11+
The app will run at `http://localhost:9292`.
12+
13+
You can check the output of the default `/` route with `curl`:
14+
15+
```sh
16+
$ curl http://localhost:9292
17+
Hello world!
18+
```
19+
20+
Prometheus metrics are exposed at `http://localhost:9292/metrics`.

app.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# frozen_string_literal: true
2+
3+
require "sinatra"
4+
5+
get "/" do
6+
"Hello world!"
7+
end

config.ru

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# frozen_string_literal: true
2+
3+
require "./app"
4+
5+
require "prometheus/middleware/collector"
6+
require "prometheus/middleware/exporter"
7+
8+
use Prometheus::Middleware::Collector
9+
use Prometheus::Middleware::Exporter
10+
11+
run Sinatra::Application

0 commit comments

Comments
 (0)