Update logging settings

This commit is contained in:
Eugene Burmakin 2024-07-09 20:09:43 +02:00
parent 3d8c8bd26e
commit 54446f1c3c
8 changed files with 49 additions and 3 deletions

View file

@ -1 +1 @@
0.8.6 0.8.7

View file

@ -5,6 +5,26 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/) The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/). and this project adheres to [Semantic Versioning](http://semver.org/).
## [0.8.7] — 2024-07-09
### Changed
- Added a logging config to the `docker-compose.yml` file to prevent logs from overflowing the disk. Now logs are being rotated and stored in the `log` folder in the root of the application. You can find usage example in the the repository's `docker-compose.yml` [file](https://github.com/Freika/dawarich/blob/master/docker-compose.yml#L50). Make sure to add this config to both `dawarich_app` and `dawarich_sidekiq` services.
```yaml
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "5"
```
### Fixed
- Visiting notifications page now marks this notifications as read
---
## [0.8.6] — 2024-07-08 ## [0.8.6] — 2024-07-08
### Added ### Added

View file

@ -10,6 +10,7 @@ gem 'data_migrate'
gem 'devise' gem 'devise'
gem 'geocoder' gem 'geocoder'
gem 'importmap-rails' gem 'importmap-rails'
gem 'lograge'
gem 'oj' gem 'oj'
gem 'pg' gem 'pg'
gem 'puma' gem 'puma'

View file

@ -152,6 +152,11 @@ GEM
json-schema (4.3.0) json-schema (4.3.0)
addressable (>= 2.8) addressable (>= 2.8)
language_server-protocol (3.17.0.3) language_server-protocol (3.17.0.3)
lograge (0.14.0)
actionpack (>= 4)
activesupport (>= 4)
railties (>= 4)
request_store (~> 1.0)
loofah (2.22.0) loofah (2.22.0)
crass (~> 1.0.2) crass (~> 1.0.2)
nokogiri (>= 1.12.0) nokogiri (>= 1.12.0)
@ -264,6 +269,8 @@ GEM
regexp_parser (2.9.2) regexp_parser (2.9.2)
reline (0.5.9) reline (0.5.9)
io-console (~> 0.5) io-console (~> 0.5)
request_store (1.7.0)
rack (>= 1.4)
responders (3.1.1) responders (3.1.1)
actionpack (>= 5.2) actionpack (>= 5.2)
railties (>= 5.2) railties (>= 5.2)
@ -406,6 +413,7 @@ DEPENDENCIES
foreman foreman
geocoder geocoder
importmap-rails importmap-rails
lograge
oj oj
pg pg
pry-byebug pry-byebug

File diff suppressed because one or more lines are too long

View file

@ -9,7 +9,9 @@ class NotificationsController < ApplicationController
current_user.notifications.order(created_at: :desc).paginate(page: params[:page], per_page: 20) current_user.notifications.order(created_at: :desc).paginate(page: params[:page], per_page: 20)
end end
def show; end def show
@notification.update!(read_at: Time.zone.now) unless @notification.read_at?
end
def mark_as_read def mark_as_read
current_user.notifications.unread.update_all(read_at: Time.zone.now) current_user.notifications.unread.update_all(read_at: Time.zone.now)

View file

@ -82,4 +82,9 @@ Rails.application.configure do
config.hosts.concat(hosts.split(',')) if hosts.present? config.hosts.concat(hosts.split(',')) if hosts.present?
config.force_ssl = ENV.fetch('APPLICATION_PROTOCOL', 'http').downcase == 'https' config.force_ssl = ENV.fetch('APPLICATION_PROTOCOL', 'http').downcase == 'https'
# Direct logs to STDOUT
config.logger = Logger.new($stdout)
config.lograge.enabled = true
config.lograge.formatter = Lograge::Formatters::Json.new
end end

View file

@ -47,6 +47,11 @@ services:
APPLICATION_HOSTS: localhost APPLICATION_HOSTS: localhost
TIME_ZONE: Europe/London TIME_ZONE: Europe/London
APPLICATION_PROTOCOL: http APPLICATION_PROTOCOL: http
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "5"
depends_on: depends_on:
- dawarich_db - dawarich_db
- dawarich_redis - dawarich_redis
@ -74,6 +79,11 @@ services:
APPLICATION_HOSTS: localhost APPLICATION_HOSTS: localhost
BACKGROUND_PROCESSING_CONCURRENCY: 10 BACKGROUND_PROCESSING_CONCURRENCY: 10
APPLICATION_PROTOCOL: http APPLICATION_PROTOCOL: http
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "5"
depends_on: depends_on:
- dawarich_db - dawarich_db
- dawarich_redis - dawarich_redis