build(phoenix): use sqlite instead of postgres

This commit is contained in:
Anhgelus Morhtuuzh 2025-08-12 13:30:01 +02:00
parent 4a0cbeb094
commit ce8d963331
Signed by: anhgelus
GPG key ID: 617773CACE89052C
10 changed files with 31 additions and 31 deletions

View file

@ -20,7 +20,7 @@ config :learning_phoenix, LearningPhoenixWeb.Endpoint,
layout: false
],
pubsub_server: LearningPhoenix.PubSub,
live_view: [signing_salt: "6KnRBd1u"]
live_view: [signing_salt: "U5f+cEa0"]
# Configures the mailer
#

View file

@ -2,13 +2,10 @@ import Config
# Configure your database
config :learning_phoenix, LearningPhoenix.Repo,
username: "postgres",
password: "postgres",
hostname: "localhost",
database: "learning_phoenix_dev",
database: Path.expand("../learning_phoenix_dev.db", __DIR__),
pool_size: 5,
stacktrace: true,
show_sensitive_data_on_connection_error: true,
pool_size: 10
show_sensitive_data_on_connection_error: true
# For development, we disable any cache and enable
# debugging and code reloading.
@ -23,7 +20,7 @@ config :learning_phoenix, LearningPhoenixWeb.Endpoint,
check_origin: false,
code_reloader: true,
debug_errors: true,
secret_key_base: "PHGloVHjG6wlc7H7AHlnsKEaz7lpSvLf4xktetauKxkuVHp0ILosEQcBDMUilq1f",
secret_key_base: "R8eKg8o2XOUxMSUrfzLxQ3qDFrBpaJxiYW1xRo8BnT1fGZiTWsAzNJjsIWGwhj6X",
watchers: [
esbuild: {Esbuild, :install_and_run, [:learning_phoenix, ~w(--sourcemap=inline --watch)]},
tailwind: {Tailwind, :install_and_run, [:learning_phoenix, ~w(--watch)]}

View file

@ -21,22 +21,16 @@ if System.get_env("PHX_SERVER") do
end
if config_env() == :prod do
database_url =
System.get_env("DATABASE_URL") ||
database_path =
System.get_env("DATABASE_PATH") ||
raise """
environment variable DATABASE_URL is missing.
For example: ecto://USER:PASS@HOST/DATABASE
environment variable DATABASE_PATH is missing.
For example: /etc/learning_phoenix/learning_phoenix.db
"""
maybe_ipv6 = if System.get_env("ECTO_IPV6") in ~w(true 1), do: [:inet6], else: []
config :learning_phoenix, LearningPhoenix.Repo,
# ssl: true,
url: database_url,
pool_size: String.to_integer(System.get_env("POOL_SIZE") || "10"),
# For machines with several cores, consider starting multiple pools of `pool_size`
# pool_count: 4,
socket_options: maybe_ipv6
database: database_path,
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

View file

@ -6,18 +6,15 @@ import Config
# to provide built-in test partitioning in CI environment.
# Run `mix help test` for more information.
config :learning_phoenix, LearningPhoenix.Repo,
username: "postgres",
password: "postgres",
hostname: "localhost",
database: "learning_phoenix_test#{System.get_env("MIX_TEST_PARTITION")}",
pool: Ecto.Adapters.SQL.Sandbox,
pool_size: System.schedulers_online() * 2
database: Path.expand("../learning_phoenix_test.db", __DIR__),
pool_size: 5,
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 :learning_phoenix, LearningPhoenixWeb.Endpoint,
http: [ip: {127, 0, 0, 1}, port: 4002],
secret_key_base: "T/9ib796V1QpkkDHld7PxiBA/5GCmREIb0d9uYUAM6DNftWek9K/SVSelfjqBy3Z",
secret_key_base: "Htm54SqKYNSmzPpyH9Ifs7JKcCm41Xt4DYIEJuqHOocaM+IYHfNFYb4q+tOBPgQ4",
server: false
# In test we don't send emails