-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
56 changed files
with
1,058 additions
and
187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,28 @@ | ||
db/*.yml | ||
# See https://help.github.com/articles/ignoring-files for more about ignoring files. | ||
# | ||
# If you find yourself ignoring temporary files generated by your text editor | ||
# or operating system, you probably want to add a global ignore instead: | ||
# git config --global core.excludesfile '~/.gitignore_global' | ||
|
||
# Ignore bundler config. | ||
/.bundle | ||
|
||
# Ignore the default SQLite database. | ||
/db/*.sqlite3 | ||
/db/*.sqlite3-* | ||
|
||
# Ignore all logfiles and tempfiles. | ||
/log/* | ||
/tmp/* | ||
!/log/.keep | ||
!/tmp/.keep | ||
|
||
# Ignore pidfiles, but keep the directory. | ||
/tmp/pids/* | ||
!/tmp/pids/ | ||
!/tmp/pids/.keep | ||
|
||
.byebug_history | ||
|
||
# Ignore master key for decrypting credentials and more. | ||
/config/master.key |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,18 @@ | ||
FROM ruby:2.7.1 | ||
FROM ruby:3.0.0-alpine | ||
|
||
RUN apk add --update --no-cache bash build-base tzdata postgresql-dev git | ||
|
||
WORKDIR /code | ||
COPY . /code | ||
|
||
COPY Gemfile Gemfile.lock /code/ | ||
RUN bundle install | ||
|
||
EXPOSE 8080 | ||
COPY . /code/ | ||
|
||
COPY docker/entrypoint-web.sh /usr/bin/ | ||
RUN chmod +x /usr/bin/entrypoint-web.sh | ||
ENTRYPOINT ["entrypoint-web.sh"] | ||
|
||
EXPOSE 3000 | ||
|
||
CMD ["bundle", "exec", "rackup", "--host", "0.0.0.0", "-p", "8080"] | ||
CMD ["bundle", "exec", "rails", "server", "-b", "0.0.0.0", "-p", "3000"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,38 @@ | ||
# frozen_string_literal: true | ||
source 'https://rubygems.org' | ||
git_source(:github) { |repo| "https://github.com/#{repo}.git" } | ||
|
||
source "https://rubygems.org" | ||
ruby '3.0.0' | ||
|
||
gem "rack" | ||
gem "yaml" | ||
gem "activesupport" | ||
# Rails | ||
gem 'activesupport' | ||
gem 'actionpack' | ||
gem 'actionview' | ||
gem 'activemodel' | ||
gem 'activerecord' | ||
gem 'railties' | ||
|
||
# Use postgresql as the database for Active Record | ||
gem 'pg', '~> 1.1' | ||
|
||
# Use Puma as the app server | ||
gem 'puma', '~> 5.0' | ||
|
||
# Use Active Model has_secure_password | ||
# gem 'bcrypt', '~> 3.1.7' | ||
|
||
# Use Rack CORS for handling Cross-Origin Resource Sharing (CORS), making cross-origin AJAX possible | ||
# gem 'rack-cors' | ||
|
||
gem 'not_analytics_client', '~> 0.2.0', github: '12joan/not-analytics-client', branch: 'main' | ||
|
||
group :development, :test do | ||
# Call 'byebug' anywhere in the code to stop execution and get a debugger console | ||
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] | ||
end | ||
|
||
group :development do | ||
gem 'listen', '~> 3.3' | ||
end | ||
|
||
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem | ||
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,120 @@ | ||
GIT | ||
remote: https://github.com/12joan/not-analytics-client.git | ||
revision: 0fbe42e65dd54c4f0c3614fb32d260b67451833d | ||
branch: main | ||
specs: | ||
not_analytics_client (0.2.0) | ||
base64 (~> 0.1) | ||
json (~> 2.5) | ||
net-http (~> 0.1.1) | ||
openssl (~> 2.2) | ||
securerandom (~> 0.1) | ||
|
||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
activesupport (6.0.3.3) | ||
actionpack (6.1.3) | ||
actionview (= 6.1.3) | ||
activesupport (= 6.1.3) | ||
rack (~> 2.0, >= 2.0.9) | ||
rack-test (>= 0.6.3) | ||
rails-dom-testing (~> 2.0) | ||
rails-html-sanitizer (~> 1.0, >= 1.2.0) | ||
actionview (6.1.3) | ||
activesupport (= 6.1.3) | ||
builder (~> 3.1) | ||
erubi (~> 1.4) | ||
rails-dom-testing (~> 2.0) | ||
rails-html-sanitizer (~> 1.1, >= 1.2.0) | ||
activemodel (6.1.3) | ||
activesupport (= 6.1.3) | ||
activerecord (6.1.3) | ||
activemodel (= 6.1.3) | ||
activesupport (= 6.1.3) | ||
activesupport (6.1.3) | ||
concurrent-ruby (~> 1.0, >= 1.0.2) | ||
i18n (>= 0.7, < 2) | ||
minitest (~> 5.1) | ||
tzinfo (~> 1.1) | ||
zeitwerk (~> 2.2, >= 2.2.2) | ||
concurrent-ruby (1.1.7) | ||
i18n (1.8.5) | ||
i18n (>= 1.6, < 2) | ||
minitest (>= 5.1) | ||
tzinfo (~> 2.0) | ||
zeitwerk (~> 2.3) | ||
base64 (0.1.0) | ||
builder (3.2.4) | ||
byebug (11.1.3) | ||
concurrent-ruby (1.1.8) | ||
crass (1.0.6) | ||
erubi (1.10.0) | ||
ffi (1.15.0) | ||
i18n (1.8.9) | ||
concurrent-ruby (~> 1.0) | ||
minitest (5.14.2) | ||
io-wait (0.1.0) | ||
json (2.5.1) | ||
listen (3.5.0) | ||
rb-fsevent (~> 0.10, >= 0.10.3) | ||
rb-inotify (~> 0.9, >= 0.9.10) | ||
loofah (2.9.0) | ||
crass (~> 1.0.2) | ||
nokogiri (>= 1.5.9) | ||
method_source (1.0.0) | ||
minitest (5.14.4) | ||
net-http (0.1.1) | ||
net-protocol | ||
uri | ||
net-protocol (0.1.0) | ||
io-wait | ||
timeout | ||
nio4r (2.5.7) | ||
nokogiri (1.11.2-x86_64-linux) | ||
racc (~> 1.4) | ||
openssl (2.2.0) | ||
pg (1.2.3) | ||
puma (5.2.2) | ||
nio4r (~> 2.0) | ||
racc (1.5.2) | ||
rack (2.2.3) | ||
thread_safe (0.3.6) | ||
tzinfo (1.2.7) | ||
thread_safe (~> 0.1) | ||
yaml (0.1.0) | ||
zeitwerk (2.4.0) | ||
rack-test (1.1.0) | ||
rack (>= 1.0, < 3) | ||
rails-dom-testing (2.0.3) | ||
activesupport (>= 4.2.0) | ||
nokogiri (>= 1.6) | ||
rails-html-sanitizer (1.3.0) | ||
loofah (~> 2.3) | ||
railties (6.1.3) | ||
actionpack (= 6.1.3) | ||
activesupport (= 6.1.3) | ||
method_source | ||
rake (>= 0.8.7) | ||
thor (~> 1.0) | ||
rake (13.0.3) | ||
rb-fsevent (0.10.4) | ||
rb-inotify (0.10.1) | ||
ffi (~> 1.0) | ||
securerandom (0.1.0) | ||
thor (1.1.0) | ||
timeout (0.1.1) | ||
tzinfo (2.0.4) | ||
concurrent-ruby (~> 1.0) | ||
uri (0.10.1) | ||
zeitwerk (2.4.2) | ||
|
||
PLATFORMS | ||
ruby | ||
x86_64-linux | ||
|
||
DEPENDENCIES | ||
actionpack | ||
actionview | ||
activemodel | ||
activerecord | ||
activesupport | ||
rack | ||
yaml | ||
byebug | ||
listen (~> 3.3) | ||
not_analytics_client (~> 0.2.0)! | ||
pg (~> 1.1) | ||
puma (~> 5.0) | ||
railties | ||
tzinfo-data | ||
|
||
RUBY VERSION | ||
ruby 3.0.0p0 | ||
|
||
BUNDLED WITH | ||
2.1.4 | ||
2.2.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,77 +1,24 @@ | ||
# not Analytics | ||
# README | ||
|
||
don't be creepy. | ||
This README would normally document whatever steps are necessary to get the | ||
application up and running. | ||
|
||
## Quick start | ||
Things you may want to cover: | ||
|
||
```sh | ||
git clone https://github.com/12joan/not-analytics.git && | ||
cd not-analytics && | ||
bundle install && | ||
echo && | ||
echo "Your app id is..." && | ||
cat /dev/urandom | tr -dc 'a-f0-9' | fold -w 32 | head -n 1 | tee conf/apps && # <-- Generate a random app id | ||
echo && | ||
rm db/.deleteme && | ||
rackup --host 0.0.0.0 -p 8080 | ||
``` | ||
* Ruby version | ||
|
||
`conf/apps` should contain a list of allowed app ids, one per line. | ||
* System dependencies | ||
|
||
## Docker | ||
* Configuration | ||
|
||
``` | ||
git clone https://github.com/12joan/not-analytics.git && | ||
docker build --tag not-analytics not-analytics && | ||
mkdir -p $HOME/not-analytics/{db,conf} && | ||
echo && | ||
echo "Your app id is..." && | ||
cat /dev/urandom | tr -dc 'a-f0-9' | fold -w 32 | head -n 1 | tee $HOME/not-analytics/conf/apps && # <-- Generate a random app id | ||
echo && | ||
docker run \ | ||
--rm \ | ||
-d \ | ||
-p 8080:8080 \ | ||
-v $HOME/not-analytics/db:/code/db \ | ||
-v $HOME/not-analytics/conf:/code/conf \ | ||
--name not-analytics \ | ||
not-analytics | ||
``` | ||
* Database creation | ||
|
||
## Recording hits | ||
* Database initialization | ||
|
||
For every hit you want to track, send a request to the metrics server. | ||
* How to run the test suite | ||
|
||
``` | ||
https://metricsserver.com/app_id/path | ||
``` | ||
* Services (job queues, cache servers, search engines, etc.) | ||
|
||
For example, to register a hit to `/12joan/not-analytics`, send the following request. | ||
|
||
``` | ||
https://metricsserver.com/14b6a51577c125505e0524226783c895/12joan/not-analytics | ||
``` | ||
|
||
**Please filter out query parameters before pinging the metrics server.** | ||
|
||
## Perusing data | ||
|
||
Hits are logged to `db/app_id.yml` with a resolution of one hour | ||
|
||
```yaml | ||
$ cat db/14b6a51577c125505e0524226783c895.yml | ||
--- | ||
Wed 6 Nov 2019 09:00: | ||
"/about/us": 12 | ||
"/": 31 | ||
Wed 6 Nov 2019 10:00: | ||
"/": 11 | ||
Wed 6 Nov 2019 11:00: | ||
"/": 2 | ||
"/about/us": 2 | ||
``` | ||
## Privacy | ||
Consider linking to this GitHub repo in your privacy policy, so that users can see for themselves how their data is collected. | ||
* Deployment instructions | ||
|
||
* ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Add your own tasks in files placed in lib/tasks ending in .rake, | ||
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. | ||
|
||
require_relative "config/application" | ||
|
||
Rails.application.load_tasks |
Oops, something went wrong.