1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-03-25 01:14:43 +00:00

Added influxdb to wrestlingdev

This commit is contained in:
2021-04-01 19:52:18 +00:00
parent e36de59971
commit e1cba865b0
8 changed files with 204 additions and 24 deletions

View File

@@ -38,7 +38,6 @@ gem 'spring', :group => :development
# Use debugger # Use debugger
# gem 'debugger', group: [:development, :test] # gem 'debugger', group: [:development, :test]
#Installed by me #Installed by me
group :production do group :production do
gem 'rails_12factor' gem 'rails_12factor'
@@ -48,6 +47,7 @@ group :production do
gem 'dalli' gem 'dalli'
end end
gem 'influxdb-rails'
gem 'devise' gem 'devise'
gem 'cancancan' gem 'cancancan'
gem 'round_robin_tournament' gem 'round_robin_tournament'

View File

@@ -62,11 +62,11 @@ GEM
zeitwerk (~> 2.3) zeitwerk (~> 2.3)
addressable (2.4.0) addressable (2.4.0)
ast (2.4.2) ast (2.4.2)
backports (3.20.2) backports (3.21.0)
bcrypt (3.1.16) bcrypt (3.1.16)
brakeman (5.0.0) brakeman (5.0.0)
builder (3.2.4) builder (3.2.4)
bullet (6.1.3) bullet (6.1.4)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
uniform_notifier (~> 1.11) uniform_notifier (~> 1.11)
cancancan (3.2.1) cancancan (3.2.1)
@@ -85,10 +85,10 @@ GEM
dalli (2.7.11) dalli (2.7.11)
delayed_job (4.1.9) delayed_job (4.1.9)
activesupport (>= 3.0, < 6.2) activesupport (>= 3.0, < 6.2)
delayed_job_active_record (4.1.5) delayed_job_active_record (4.1.6)
activerecord (>= 3.0, < 6.2) activerecord (>= 3.0, < 6.2)
delayed_job (>= 3.0, < 5) delayed_job (>= 3.0, < 5)
delayed_job_web (1.4.3) delayed_job_web (1.4.4)
activerecord (> 3.0.0) activerecord (> 3.0.0)
delayed_job (> 2.0.3) delayed_job (> 2.0.3)
rack-protection (>= 1.5.5) rack-protection (>= 1.5.5)
@@ -109,7 +109,7 @@ GEM
multipart-post (>= 1.2, < 3) multipart-post (>= 1.2, < 3)
faraday_middleware (0.14.0) faraday_middleware (0.14.0)
faraday (>= 0.7.4, < 1.0) faraday (>= 0.7.4, < 1.0)
ffi (1.14.2) ffi (1.15.0)
gh (0.15.1) gh (0.15.1)
addressable (~> 2.4.0) addressable (~> 2.4.0)
backports backports
@@ -132,8 +132,12 @@ GEM
http-accept (1.7.0) http-accept (1.7.0)
http-cookie (1.0.3) http-cookie (1.0.3)
domain_name (~> 0.5) domain_name (~> 0.5)
i18n (1.8.8) i18n (1.8.10)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
influxdb (0.8.1)
influxdb-rails (1.0.1)
influxdb (~> 0.6, >= 0.6.4)
railties (>= 5.0)
jbuilder (2.11.2) jbuilder (2.11.2)
activesupport (>= 5.0.0) activesupport (>= 5.0.0)
jquery-rails (4.4.0) jquery-rails (4.4.0)
@@ -154,11 +158,13 @@ GEM
method_source (1.0.0) method_source (1.0.0)
mime-types (3.3.1) mime-types (3.3.1)
mime-types-data (~> 3.2015) mime-types-data (~> 3.2015)
mime-types-data (3.2020.1104) mime-types-data (3.2021.0225)
mimemagic (0.3.5) mimemagic (0.3.10)
mini_mime (1.0.2) nokogiri (~> 1)
rake
mini_mime (1.0.3)
mini_portile2 (2.5.0) mini_portile2 (2.5.0)
minitest (5.14.3) minitest (5.14.4)
multi_json (1.15.0) multi_json (1.15.0)
multipart-post (2.1.1) multipart-post (2.1.1)
mustermann (1.1.1) mustermann (1.1.1)
@@ -168,8 +174,8 @@ GEM
net-http-pipeline (1.0.1) net-http-pipeline (1.0.1)
netrc (0.11.0) netrc (0.11.0)
newrelic_rpm (6.15.0) newrelic_rpm (6.15.0)
nio4r (2.5.5) nio4r (2.5.7)
nokogiri (1.11.1) nokogiri (1.11.2)
mini_portile2 (~> 2.5.0) mini_portile2 (~> 2.5.0)
racc (~> 1.4) racc (~> 1.4)
orm_adapter (0.5.0) orm_adapter (0.5.0)
@@ -179,7 +185,7 @@ GEM
passenger (6.0.7) passenger (6.0.7)
rack rack
rake (>= 0.8.1) rake (>= 0.8.1)
puma (5.2.1) puma (5.2.2)
nio4r (~> 2.0) nio4r (~> 2.0)
pusher-client (0.6.2) pusher-client (0.6.2)
json json
@@ -226,7 +232,7 @@ GEM
rb-readline (0.5.5) rb-readline (0.5.5)
rdoc (6.3.0) rdoc (6.3.0)
ref (2.0.0) ref (2.0.0)
regexp_parser (2.0.3) regexp_parser (2.1.1)
responders (3.0.1) responders (3.0.1)
actionpack (>= 5.0) actionpack (>= 5.0)
railties (>= 5.0) railties (>= 5.0)
@@ -237,7 +243,7 @@ GEM
netrc (~> 0.8) netrc (~> 0.8)
rexml (3.2.4) rexml (3.2.4)
round_robin_tournament (0.1.1) round_robin_tournament (0.1.1)
rubocop (1.9.1) rubocop (1.12.0)
parallel (~> 1.10) parallel (~> 1.10)
parser (>= 3.0.0.0) parser (>= 3.0.0.0)
rainbow (>= 2.2.2, < 4.0) rainbow (>= 2.2.2, < 4.0)
@@ -250,7 +256,7 @@ GEM
parser (>= 2.7.1.5) parser (>= 2.7.1.5)
ruby-progressbar (1.11.0) ruby-progressbar (1.11.0)
ruby2_keywords (0.0.4) ruby2_keywords (0.0.4)
sdoc (2.0.3) sdoc (2.1.0)
rdoc (>= 5.0) rdoc (>= 5.0)
sinatra (2.1.0) sinatra (2.1.0)
mustermann (~> 1.0) mustermann (~> 1.0)
@@ -266,8 +272,7 @@ GEM
activesupport (>= 4.0) activesupport (>= 4.0)
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
sqlite3 (1.4.2) sqlite3 (1.4.2)
terminal-table (3.0.0) terminal-table (1.6.0)
unicode-display_width (~> 1.1, >= 1.1.1)
therubyracer (0.12.3) therubyracer (0.12.3)
libv8 (~> 3.16.14.15) libv8 (~> 3.16.14.15)
ref ref
@@ -296,8 +301,8 @@ GEM
unf (0.1.4) unf (0.1.4)
unf_ext unf_ext
unf_ext (0.0.7.7) unf_ext (0.0.7.7)
unicode-display_width (1.7.0) unicode-display_width (2.0.0)
uniform_notifier (1.13.2) uniform_notifier (1.14.2)
warden (1.2.9) warden (1.2.9)
rack (>= 2.0.9) rack (>= 2.0.9)
websocket (1.2.9) websocket (1.2.9)
@@ -320,6 +325,7 @@ DEPENDENCIES
delayed_job_web delayed_job_web
devise devise
hakiri hakiri
influxdb-rails
jbuilder jbuilder
jquery-rails jquery-rails
mysql2 mysql2

View File

@@ -54,3 +54,8 @@ The production version of this is currently deployed in Kubernetes. See [Deployi
* `MEMCACHIER_SERVERS=memcachier_hostname:memcachier_port` needed for caching * `MEMCACHIER_SERVERS=memcachier_hostname:memcachier_port` needed for caching
* `MEMCACHIER_USERNAME=memcachier_username` needed for caching * `MEMCACHIER_USERNAME=memcachier_username` needed for caching
* `WRESTLINGDEV_NEW_RELIC_LICENSE_KEY=new_relic_license_key` this is only needed to use new relic * `WRESTLINGDEV_NEW_RELIC_LICENSE_KEY=new_relic_license_key` this is only needed to use new relic
* `WRESTLINGDEV_INFLUXDB_DATABASE=influx_db_name` to send metrics to influxdb this is required
* `WRESTLINGDEV_INFLUXDB_HOST=influx_db_ip_or_hostname` to send metrics to influxdb this is required
* `WRESTLINGDEV_INFLUXDB_PORT=influx_db_port` to send metrics to influxdb this is required
* `WRESTLINGDEV_INFLUXDB_USERNAME=influx_db_username` to send metrics to influxdb this is optional
* `WRESTLINGDEV_INFLUXDB_PASSWORD=influx_db_password` to send metrics to influxdb this is optional

View File

@@ -0,0 +1,45 @@
InfluxDB::Rails.configure do |config|
## The only setting you actually need to update is the name of the
## database within the InfluxDB server instance. Don't forget to
## create this database as well.
config.client.database = "#{ENV['WRESTLINGDEV_INFLUXDB_DATABASE']}"
config.client.hosts = ["#{ENV['WRESTLINGDEV_INFLUXDB_HOST']}"]
config.client.port = ENV['WRESTLINGDEV_INFLUXDB_PORT']
## If you've setup user authentication (and activated it in the server
## config), you need to configure the credentials here.
config.client.username = "#{ENV['WRESTLINGDEV_INFLUXDB_USERNAME']}"
config.client.password = "#{ENV['WRESTLINGDEV_INFLUXDB_PASSWORD']}"
## If your InfluxDB service requires an HTTPS connection then you can
## enable it here.
# config.client.use_ssl = true
## Various other client and connection options. These are used to create
## an `InfluxDB::Client` instance (i.e. `InfluxDB::Rails.client`).
##
## See docs for the influxdb gem for the canonical list of options:
## https://github.com/influxdata/influxdb-ruby#list-of-configuration-options
##
## These defaults for the influxdb-rails gem deviate from the default
## for the influxdb gem:
# config.client.async = true # false
# config.client.read_timeout = 30 # 300
# config.client.max_delay = 300 # 30
# config.client.time_precision = "ms" # "s"
## Prior to 1.0.0, this gem has written all data points in different
## measurements (the config options were named `series_name_for_*`).
## Since 1.0.0.beta3, we're now using a single measurements
# config.measurement_name = "rails"
## Disable rails framework hooks.
# config.ignored_hooks = ['sql.active_record', 'render_template.action_view']
# Modify tags on the fly.
# config.tags_middleware = ->(tags) { tags }
## Set the application name to something meaningful, by default we
## infer the app name from the Rails.application class name.
# config.application_name = Rails.application.class.parent_name
end

View File

@@ -2,6 +2,7 @@ version: "2.2"
networks: networks:
database: database:
caching: caching:
metrics:
volumes: volumes:
mysql: mysql:
@@ -23,9 +24,13 @@ services:
- MEMCACHIER_PASSWORD= - MEMCACHIER_PASSWORD=
- WRESTLINGDEV_DEVISE_SECRET_KEY=2f29d49db6704377ba263f7cb9db085b386bcb301c0cd501126a674686ab1a109754071165b08cd72af03cec4642a4dd04361c994462254dd5d85e9594e8b9aa - WRESTLINGDEV_DEVISE_SECRET_KEY=2f29d49db6704377ba263f7cb9db085b386bcb301c0cd501126a674686ab1a109754071165b08cd72af03cec4642a4dd04361c994462254dd5d85e9594e8b9aa
- WRESTLINGDEV_SECRET_KEY_BASE=077cdbef5c2ccf22543fb17a67339f234306b7fa2e1e4463d851c444c10a5611829a2290b253da78339427f131571fac9a42c83d960b2d25ecc10a4a0a7ce1a2 - WRESTLINGDEV_SECRET_KEY_BASE=077cdbef5c2ccf22543fb17a67339f234306b7fa2e1e4463d851c444c10a5611829a2290b253da78339427f131571fac9a42c83d960b2d25ecc10a4a0a7ce1a2
- WRESTLINGDEV_INFLUXDB_DATABASE=wrestlingdev
- WRESTLINGDEV_INFLUXDB_HOST=influxdb
- WRESTLINGDEV_INFLUXDB_PORT=8086
networks: networks:
database: database:
caching: caching:
metrics:
restart: always restart: always
ports: ports:
- "80:80" - "80:80"
@@ -58,16 +63,28 @@ services:
- MEMCACHIER_PASSWORD= - MEMCACHIER_PASSWORD=
- WRESTLINGDEV_DEVISE_SECRET_KEY=2f29d49db6704377ba263f7cb9db085b386bcb301c0cd501126a674686ab1a109754071165b08cd72af03cec4642a4dd04361c994462254dd5d85e9594e8b9aa - WRESTLINGDEV_DEVISE_SECRET_KEY=2f29d49db6704377ba263f7cb9db085b386bcb301c0cd501126a674686ab1a109754071165b08cd72af03cec4642a4dd04361c994462254dd5d85e9594e8b9aa
- WRESTLINGDEV_SECRET_KEY_BASE=077cdbef5c2ccf22543fb17a67339f234306b7fa2e1e4463d851c444c10a5611829a2290b253da78339427f131571fac9a42c83d960b2d25ecc10a4a0a7ce1a2 - WRESTLINGDEV_SECRET_KEY_BASE=077cdbef5c2ccf22543fb17a67339f234306b7fa2e1e4463d851c444c10a5611829a2290b253da78339427f131571fac9a42c83d960b2d25ecc10a4a0a7ce1a2
- WRESTLINGDEV_INFLUXDB_DATABASE=wrestlingdev
- WRESTLINGDEV_INFLUXDB_HOST=influxdb
- WRESTLINGDEV_INFLUXDB_PORT=8086
networks: networks:
database: database:
caching: caching:
metrics:
restart: always restart: always
command: bundle exec bin/delayed_job -n 1 run command: bundle exec bin/delayed_job -n 1 run
influxdb:
image: influxdb:1.8-alpine
environment:
- INFLUXDB_DB=wrestlingdev
ports:
- "8086:8086"
networks:
metrics:
memcached: memcached:
image: memcached:1.5 image: memcached:1.5
mem_limit: 64000000 mem_limit: 64000000
restart: always restart: always
networks: networks:
caching: caching:

View File

@@ -0,0 +1,74 @@
---
apiVersion: v1
kind: Service
metadata:
name: wrestlingdev-influxdb
labels:
app: wrestlingdev
tier: metrics
spec:
ports:
- port: 8086
selector:
app: wrestlingdev
tier: metrics
clusterIP: None
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: wrestlingdev-influxdb
labels:
app: wrestlingdev
tier: metrics
spec:
replicas: 1
selector:
matchLabels:
app: wrestlingdev
template:
metadata:
labels:
app: wrestlingdev
tier: metrics
spec:
containers:
- name: wrestlingdev-influxdb
image: influxdb:1.8-alpine
ports:
- containerPort: 8086
env:
- name: INFLUXDB_DB
valueFrom:
secretKeyRef:
name: wrestlingdev-secrets
key: influxdb_database
volumeMounts:
- name: wrestlingdev-influxdb-persistent-storage
mountPath: /var/lib/influxdb
resources:
limits:
cpu: "0.7"
memory: "512Mi"
requests:
memory: "128Mi"
cpu: "0.5"
volumes:
- name: wrestlingdev-influxdb-persistent-storage
persistentVolumeClaim:
claimName: wrestlingdev-influxdb-pv-claim
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: wrestlingdev-influxdb-pv-claim
labels:
app: wrestlingdev
tier: metrics
spec:
storageClassName: standard
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Gi

View File

@@ -81,6 +81,21 @@ spec:
secretKeyRef: secretKeyRef:
name: wrestlingdev-secrets name: wrestlingdev-secrets
key: gmailemail key: gmailemail
- name: WRESTLINGDEV_INFLUXDB_DATABASE
valueFrom:
secretKeyRef:
name: wrestlingdev-secrets
key: influxdb_database
- name: WRESTLINGDEV_INFLUXDB_HOST
valueFrom:
secretKeyRef:
name: wrestlingdev-secrets
key: influxdb_hostname
- name: WRESTLINGDEV_INFLUXDB_PORT
valueFrom:
secretKeyRef:
name: wrestlingdev-secrets
key: influxdb_port
resources: resources:
limits: limits:
cpu: "0.5" cpu: "0.5"
@@ -187,6 +202,21 @@ spec:
secretKeyRef: secretKeyRef:
name: wrestlingdev-secrets name: wrestlingdev-secrets
key: gmailemail key: gmailemail
- name: WRESTLINGDEV_INFLUXDB_DATABASE
valueFrom:
secretKeyRef:
name: wrestlingdev-secrets
key: influxdb_database
- name: WRESTLINGDEV_INFLUXDB_HOST
valueFrom:
secretKeyRef:
name: wrestlingdev-secrets
key: influxdb_hostname
- name: WRESTLINGDEV_INFLUXDB_PORT
valueFrom:
secretKeyRef:
name: wrestlingdev-secrets
key: influxdb_port
command: ["bundle"] command: ["bundle"]
args: ["exec", "bin/delayed_job", "-n", "1", "run"] args: ["exec", "bin/delayed_job", "-n", "1", "run"]
resources: resources:

View File

@@ -11,4 +11,7 @@ stringData:
devisesecretkey: PUT_SECRET_HERE get from running rails secret devisesecretkey: PUT_SECRET_HERE get from running rails secret
railssecretkey: PUT_SECRET_HERE get from running rails secret railssecretkey: PUT_SECRET_HERE get from running rails secret
emailpassword: PUT_EMAIL_PASSWORD_HERE emailpassword: PUT_EMAIL_PASSWORD_HERE
gmailemail: PUT EMAIL ADDRESS HERE gmailemail: PUT EMAIL ADDRESS HERE
influxdb_database: PUT INFLUXDB DATABASE NAME HERE
influxdb_hostname: PUT INFLUXDB HOSTNAME OR IP HERE
influxdb_port: PUT INFLUXDB PORT HERE