Added log rotation for prod config (#32)
This commit is contained in:
parent
3efc533fb7
commit
610acb15f1
3 changed files with 20 additions and 3 deletions
|
|
@ -29,6 +29,8 @@ if config_env() == :prod do
|
|||
For example: /etc/pinchflat/pinchflat.db
|
||||
"""
|
||||
|
||||
log_path = System.get_env("LOG_PATH", "log/pinchflat.log")
|
||||
|
||||
config :pinchflat, yt_dlp_executable: System.find_executable("yt-dlp")
|
||||
|
||||
config :pinchflat, Pinchflat.Repo,
|
||||
|
|
@ -74,6 +76,21 @@ if config_env() == :prod do
|
|||
],
|
||||
secret_key_base: secret_key_base
|
||||
|
||||
config :pinchflat, :logger, [
|
||||
{:handler, :file_log, :logger_std_h,
|
||||
%{
|
||||
config: %{
|
||||
type: :file,
|
||||
file: String.to_charlist(log_path),
|
||||
filesync_repeat_interval: 5000,
|
||||
file_check: 5000,
|
||||
max_no_files: 5,
|
||||
max_no_bytes: 10_000_000
|
||||
},
|
||||
formatter: Logger.Formatter.new()
|
||||
}}
|
||||
]
|
||||
|
||||
# ## SSL Support
|
||||
#
|
||||
# To get SSL working, you will need to add the `https` key
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ defmodule Pinchflat.Application do
|
|||
]
|
||||
|
||||
:ok = Oban.Telemetry.attach_default_logger()
|
||||
Logger.add_handlers(:pinchflat)
|
||||
|
||||
# See https://hexdocs.pm/elixir/Supervisor.html
|
||||
# for other strategies and supported options
|
||||
|
|
|
|||
|
|
@ -96,12 +96,11 @@ RUN chown nobody /app
|
|||
# Set up data volumes
|
||||
RUN mkdir /config /downloads
|
||||
RUN chown nobody /config /downloads
|
||||
VOLUME /config
|
||||
VOLUME /downloads
|
||||
|
||||
# set runner ENV
|
||||
ENV MIX_ENV="prod"
|
||||
ENV DATABASE_PATH="/config/pinchflat.db"
|
||||
ENV DATABASE_PATH="/config/db/pinchflat.db"
|
||||
ENV LOG_PATH="/config/logs/pinchflat.log"
|
||||
ENV PORT=8945
|
||||
ENV RUN_CONTEXT="selfhosted"
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue