Skip to content

Commit eb3470e

Browse files
committed
First commit
0 parents  commit eb3470e

16 files changed

+387
-0
lines changed

.dockerignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
.git
2+
.dockerignore
3+
.byebug_history
4+
.vagrant
5+
/log/*
6+
/tmp/*

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
log
2+
.vagrant
3+
tmp
4+
*.log

Dockerfile

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
FROM ruby:2.6.5-alpine3.11
2+
3+
MAINTAINER Andrew Kane <[email protected]>
4+
5+
RUN apk add --update ruby-dev build-base \
6+
libxml2-dev libxslt-dev pcre-dev libffi-dev \
7+
postgresql-dev git
8+
9+
RUN gem install bundler
10+
11+
ENV INSTALL_PATH /app
12+
13+
RUN mkdir -p $INSTALL_PATH
14+
15+
WORKDIR $INSTALL_PATH
16+
17+
COPY Gemfile Gemfile.lock ./
18+
19+
RUN bundle install --binstubs
20+
21+
COPY . .
22+
23+
RUN bundle exec rake RAILS_ENV=production DATABASE_URL=postgresql://user:[email protected]/dbname SECRET_TOKEN=dummytoken assets:precompile
24+
25+
ENV PORT 8080
26+
27+
EXPOSE 8080
28+
29+
CMD puma -C config/puma.rb

Gemfile

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
source "https://rubygems.org"
2+
3+
gem "rails"
4+
gem "pg"
5+
gem "blazer"
6+
gem "puma"
7+
gem "tzinfo-data"

Gemfile.lock

+153
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
actioncable (6.0.2.1)
5+
actionpack (= 6.0.2.1)
6+
nio4r (~> 2.0)
7+
websocket-driver (>= 0.6.1)
8+
actionmailbox (6.0.2.1)
9+
actionpack (= 6.0.2.1)
10+
activejob (= 6.0.2.1)
11+
activerecord (= 6.0.2.1)
12+
activestorage (= 6.0.2.1)
13+
activesupport (= 6.0.2.1)
14+
mail (>= 2.7.1)
15+
actionmailer (6.0.2.1)
16+
actionpack (= 6.0.2.1)
17+
actionview (= 6.0.2.1)
18+
activejob (= 6.0.2.1)
19+
mail (~> 2.5, >= 2.5.4)
20+
rails-dom-testing (~> 2.0)
21+
actionpack (6.0.2.1)
22+
actionview (= 6.0.2.1)
23+
activesupport (= 6.0.2.1)
24+
rack (~> 2.0, >= 2.0.8)
25+
rack-test (>= 0.6.3)
26+
rails-dom-testing (~> 2.0)
27+
rails-html-sanitizer (~> 1.0, >= 1.2.0)
28+
actiontext (6.0.2.1)
29+
actionpack (= 6.0.2.1)
30+
activerecord (= 6.0.2.1)
31+
activestorage (= 6.0.2.1)
32+
activesupport (= 6.0.2.1)
33+
nokogiri (>= 1.8.5)
34+
actionview (6.0.2.1)
35+
activesupport (= 6.0.2.1)
36+
builder (~> 3.1)
37+
erubi (~> 1.4)
38+
rails-dom-testing (~> 2.0)
39+
rails-html-sanitizer (~> 1.1, >= 1.2.0)
40+
activejob (6.0.2.1)
41+
activesupport (= 6.0.2.1)
42+
globalid (>= 0.3.6)
43+
activemodel (6.0.2.1)
44+
activesupport (= 6.0.2.1)
45+
activerecord (6.0.2.1)
46+
activemodel (= 6.0.2.1)
47+
activesupport (= 6.0.2.1)
48+
activestorage (6.0.2.1)
49+
actionpack (= 6.0.2.1)
50+
activejob (= 6.0.2.1)
51+
activerecord (= 6.0.2.1)
52+
marcel (~> 0.3.1)
53+
activesupport (6.0.2.1)
54+
concurrent-ruby (~> 1.0, >= 1.0.2)
55+
i18n (>= 0.7, < 2)
56+
minitest (~> 5.1)
57+
tzinfo (~> 1.1)
58+
zeitwerk (~> 2.2)
59+
blazer (2.2.1)
60+
activerecord (>= 5)
61+
chartkick (>= 3.2)
62+
railties (>= 5)
63+
safely_block (>= 0.1.1)
64+
builder (3.2.4)
65+
chartkick (3.3.1)
66+
concurrent-ruby (1.1.5)
67+
crass (1.0.6)
68+
errbase (0.2.0)
69+
erubi (1.9.0)
70+
globalid (0.4.2)
71+
activesupport (>= 4.2.0)
72+
i18n (1.8.2)
73+
concurrent-ruby (~> 1.0)
74+
loofah (2.4.0)
75+
crass (~> 1.0.2)
76+
nokogiri (>= 1.5.9)
77+
mail (2.7.1)
78+
mini_mime (>= 0.1.1)
79+
marcel (0.3.3)
80+
mimemagic (~> 0.3.2)
81+
method_source (0.9.2)
82+
mimemagic (0.3.4)
83+
mini_mime (1.0.2)
84+
mini_portile2 (2.4.0)
85+
minitest (5.14.0)
86+
nio4r (2.5.2)
87+
nokogiri (1.10.7)
88+
mini_portile2 (~> 2.4.0)
89+
pg (1.2.2)
90+
puma (4.3.1)
91+
nio4r (~> 2.0)
92+
rack (2.1.2)
93+
rack-test (1.1.0)
94+
rack (>= 1.0, < 3)
95+
rails (6.0.2.1)
96+
actioncable (= 6.0.2.1)
97+
actionmailbox (= 6.0.2.1)
98+
actionmailer (= 6.0.2.1)
99+
actionpack (= 6.0.2.1)
100+
actiontext (= 6.0.2.1)
101+
actionview (= 6.0.2.1)
102+
activejob (= 6.0.2.1)
103+
activemodel (= 6.0.2.1)
104+
activerecord (= 6.0.2.1)
105+
activestorage (= 6.0.2.1)
106+
activesupport (= 6.0.2.1)
107+
bundler (>= 1.3.0)
108+
railties (= 6.0.2.1)
109+
sprockets-rails (>= 2.0.0)
110+
rails-dom-testing (2.0.3)
111+
activesupport (>= 4.2.0)
112+
nokogiri (>= 1.6)
113+
rails-html-sanitizer (1.3.0)
114+
loofah (~> 2.3)
115+
railties (6.0.2.1)
116+
actionpack (= 6.0.2.1)
117+
activesupport (= 6.0.2.1)
118+
method_source
119+
rake (>= 0.8.7)
120+
thor (>= 0.20.3, < 2.0)
121+
rake (13.0.1)
122+
safely_block (0.3.0)
123+
errbase (>= 0.1.1)
124+
sprockets (4.0.0)
125+
concurrent-ruby (~> 1.0)
126+
rack (> 1, < 3)
127+
sprockets-rails (3.2.1)
128+
actionpack (>= 4.0)
129+
activesupport (>= 4.0)
130+
sprockets (>= 3.0.0)
131+
thor (1.0.1)
132+
thread_safe (0.3.6)
133+
tzinfo (1.2.6)
134+
thread_safe (~> 0.1)
135+
tzinfo-data (1.2019.3)
136+
tzinfo (>= 1.0.0)
137+
websocket-driver (0.7.1)
138+
websocket-extensions (>= 0.1.0)
139+
websocket-extensions (0.1.4)
140+
zeitwerk (2.2.2)
141+
142+
PLATFORMS
143+
ruby
144+
145+
DEPENDENCIES
146+
blazer
147+
pg
148+
puma
149+
rails
150+
tzinfo-data
151+
152+
BUNDLED WITH
153+
2.1.4

LICENSE.txt

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Copyright (c) 2020 Andrew Kane
2+
3+
MIT License
4+
5+
Permission is hereby granted, free of charge, to any person obtaining
6+
a copy of this software and associated documentation files (the
7+
"Software"), to deal in the Software without restriction, including
8+
without limitation the rights to use, copy, modify, merge, publish,
9+
distribute, sublicense, and/or sell copies of the Software, and to
10+
permit persons to whom the Software is furnished to do so, subject to
11+
the following conditions:
12+
13+
The above copyright notice and this permission notice shall be
14+
included in all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Procfile

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web: bundle exec puma -C config/puma.rb

README.md

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Blazer Docker
2+
3+
An experimental Docker image for [Blazer](https://github.com/ankane/blazer)
4+
5+
Build
6+
7+
```sh
8+
docker build -t blazer .
9+
```
10+
11+
Run
12+
13+
```sh
14+
docker run -ti -e DATABASE_URL=postgres://user:password@hostname:5432/dbname -p 8080:8080 blazer
15+
```
16+
17+
And visit [http://localhost:8080](http://localhost:8080)
18+
19+
> On Mac, use `host.docker.internal` instead of `localhost` to access the host machine (requires Docker 18.03+)
20+
21+
Plan
22+
23+
- instructions for migrations
24+
- instructions for customizing
25+
- instructions for authentication
26+
- more adapters
27+
- publish to Docker Hub

Rakefile

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Add your own tasks in files placed in lib/tasks ending in .rake,
2+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3+
4+
require File.expand_path('../config/application', __FILE__)
5+
6+
Rails.application.load_tasks

app/assets/config/manifest.js

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class ApplicationController < ActionController::Base
2+
end

config.ru

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# This file is used by Rack-based servers to start the application.
2+
3+
require ::File.expand_path('../config/environment', __FILE__)
4+
map ENV["RAILS_RELATIVE_URL_ROOT"] || "/" do
5+
run Rails.application
6+
end

config/application.rb

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
require "bundler/setup"
2+
Bundler.require
3+
require "rails/all"
4+
5+
module BlazerSolo
6+
class Application < Rails::Application
7+
routes.append do
8+
mount Blazer::Engine, at: "/"
9+
end
10+
11+
config.cache_classes = true
12+
config.eager_load = true
13+
config.log_level = :info
14+
config.secret_key_base = ENV["SECRET_KEY_BASE"] || SecureRandom.hex(30)
15+
16+
config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"] != "disabled"
17+
18+
if ENV["RAILS_LOG_TO_STDOUT"] != "disabled"
19+
logger = ActiveSupport::Logger.new(STDOUT)
20+
logger.formatter = config.log_formatter
21+
config.logger = ActiveSupport::TaggedLogging.new(logger)
22+
end
23+
end
24+
end

config/blazer.yml

+73
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# see https://github.com/ankane/blazer for more info
2+
3+
data_sources:
4+
main:
5+
url: <%= ENV["DATABASE_URL"] %>
6+
7+
# statement timeout, in seconds
8+
# none by default
9+
# timeout: 15
10+
11+
# caching settings
12+
# can greatly improve speed
13+
# off by default
14+
# cache:
15+
# mode: slow # or all
16+
# expires_in: 60 # min
17+
# slow_threshold: 15 # sec, only used in slow mode
18+
19+
# wrap queries in a transaction for safety
20+
# not necessary if you use a read-only user
21+
# true by default
22+
# use_transaction: false
23+
24+
smart_variables:
25+
# zone_id: "SELECT id, name FROM zones ORDER BY name ASC"
26+
# period: ["day", "week", "month"]
27+
# status: {0: "Active", 1: "Archived"}
28+
29+
linked_columns:
30+
# user_id: "/admin/users/{value}"
31+
32+
smart_columns:
33+
# user_id: "SELECT id, name FROM users WHERE id IN {value}"
34+
35+
# create audits
36+
audit: true
37+
38+
# change the time zone
39+
# time_zone: "Pacific Time (US & Canada)"
40+
41+
# class name of the user model
42+
# user_class: User
43+
44+
# method name for the current user
45+
# user_method: current_user
46+
47+
# method name for the display name
48+
# user_name: name
49+
50+
# custom before_action to use for auth
51+
# before_action_method: require_admin
52+
53+
# email to send checks from
54+
# from_email: [email protected]
55+
56+
# webhook for Slack
57+
# slack_webhook_url: <%%= ENV["BLAZER_SLACK_WEBHOOK_URL"] %>
58+
59+
check_schedules:
60+
- "1 day"
61+
- "1 hour"
62+
- "5 minutes"
63+
64+
# enable anomaly detection
65+
# note: with trend, time series are sent to https://trendapi.org
66+
# anomaly_checks: trend / r
67+
68+
# enable forecasting
69+
# note: with trend, time series are sent to https://trendapi.org
70+
# forecasting: trend
71+
72+
# enable map
73+
# mapbox_access_token: <%%= ENV["MAPBOX_ACCESS_TOKEN"] %>

config/environment.rb

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Load the Rails application.
2+
require File.expand_path('../application', __FILE__)
3+
4+
# Initialize the Rails application.
5+
Rails.application.initialize!

0 commit comments

Comments
 (0)