Install Oban with dedicated repo
This commit is contained in:
+8
-1
@@ -12,7 +12,7 @@ config :elixir, :time_zone_database, TimeZoneInfo.TimeZoneDatabase
|
||||
config :time_zone_info, update: :daily
|
||||
|
||||
config :music_library,
|
||||
ecto_repos: [MusicLibrary.Repo, MusicLibrary.ErrorRepo],
|
||||
ecto_repos: [MusicLibrary.BackgroundRepo, MusicLibrary.Repo, MusicLibrary.ErrorRepo],
|
||||
generators: [timestamp_type: :utc_datetime, binary_id: true]
|
||||
|
||||
config :music_library, MusicLibraryWeb,
|
||||
@@ -76,8 +76,15 @@ config :error_tracker,
|
||||
otp_app: :music_library,
|
||||
enabled: true
|
||||
|
||||
config :music_library, Oban,
|
||||
engine: Oban.Engines.Lite,
|
||||
queues: [default: 10],
|
||||
repo: MusicLibrary.BackgroundRepo
|
||||
|
||||
config :music_library, MusicLibrary.ErrorRepo, priv: "priv/error_repo"
|
||||
|
||||
config :music_library, MusicLibrary.BackgroundRepo, priv: "priv/background_repo"
|
||||
|
||||
# Import environment specific config. This must remain at the bottom
|
||||
# of this file so it overrides the configuration defined above.
|
||||
import_config "#{config_env()}.exs"
|
||||
|
||||
@@ -14,6 +14,12 @@ config :music_library, MusicLibrary.ErrorRepo,
|
||||
stacktrace: true,
|
||||
show_sensitive_data_on_connection_error: true
|
||||
|
||||
config :music_library, MusicLibrary.BackgroundRepo,
|
||||
database: Path.expand("../data/music_library_background_dev.db", __DIR__),
|
||||
pool_size: 5,
|
||||
stacktrace: true,
|
||||
show_sensitive_data_on_connection_error: true
|
||||
|
||||
# For development, we disable any cache and enable
|
||||
# debugging and code reloading.
|
||||
#
|
||||
|
||||
@@ -68,6 +68,19 @@ if config_env() == :prod do
|
||||
cache_size: -8000,
|
||||
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "5")
|
||||
|
||||
background_database_path =
|
||||
System.get_env("BACKGROUND_DATABASE_PATH") ||
|
||||
raise """
|
||||
environment variable BACKGROUND_DATABASE_PATH is missing.
|
||||
For example: /etc/music_library/music_library_background.db
|
||||
"""
|
||||
|
||||
config :music_library, MusicLibrary.BackgroundRepo,
|
||||
database: background_database_path,
|
||||
# 16MB * pool_size = base memory usage
|
||||
cache_size: -8000,
|
||||
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "5")
|
||||
|
||||
# The secret key base is used to sign/encrypt cookies and other secrets.
|
||||
# A default value is used in config/dev.exs and config/test.exs but you
|
||||
# want to use a different value for prod and you most likely don't want
|
||||
|
||||
@@ -16,6 +16,11 @@ config :music_library, MusicLibrary.ErrorRepo,
|
||||
pool_size: 32,
|
||||
pool: Ecto.Adapters.SQL.Sandbox
|
||||
|
||||
config :music_library, MusicLibrary.BackgroundRepo,
|
||||
database: Path.expand("../data/music_library_background_test.db", __DIR__),
|
||||
pool_size: 32,
|
||||
pool: Ecto.Adapters.SQL.Sandbox
|
||||
|
||||
# We don't run a server during test. If one is required,
|
||||
# you can enable the server option below.
|
||||
config :music_library, MusicLibraryWeb.Endpoint,
|
||||
@@ -51,3 +56,5 @@ config :music_library, MusicBrainz,
|
||||
config :phoenix_test, :endpoint, MusicLibraryWeb.Endpoint
|
||||
|
||||
config :floki, :html_parser, Floki.HTMLParser.FastHtml
|
||||
|
||||
config :music_library, Oban, testing: :manual
|
||||
|
||||
Reference in New Issue
Block a user