Packages
electric
1.0.0-beta.13
1.7.8
1.7.7
1.7.6
1.7.5
1.7.4
1.7.3
1.7.2
1.7.1
1.7.0
1.6.10
1.6.9
1.6.8
1.6.7
1.6.6
1.6.5
1.6.4
1.6.3
1.6.2
1.6.1
1.6.0
1.5.1
1.5.0
1.4.16
1.4.16-beta-1
1.4.15
1.4.14
1.4.13
1.4.12
1.4.11
1.4.10
1.4.8
1.4.7
1.4.6
1.4.5
1.4.4
1.4.3
1.4.2
1.4.1
1.4.0
1.3.4
1.3.3
1.3.2
1.2.4
1.2.3
1.2.2
1.2.1
1.2.0
1.1.14
1.1.13
1.1.12
1.1.11
1.1.10
1.1.9
1.1.8
1.1.7
1.1.6
retired
1.1.5
retired
1.1.4
retired
1.1.3
retired
1.1.2
1.1.1
1.1.0
1.0.24
1.0.23
1.0.22
1.0.21
1.0.20
1.0.19
1.0.18
1.0.17
1.0.15
1.0.13
1.0.12
1.0.11
1.0.10
1.0.9
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
1.0.0-beta.23
1.0.0-beta.22
1.0.0-beta.20
1.0.0-beta.19
1.0.0-beta.18
1.0.0-beta.17
1.0.0-beta.16
1.0.0-beta.15
1.0.0-beta.14
1.0.0-beta.13
1.0.0-beta.12
1.0.0-beta.11
1.0.0-beta.10
1.0.0-beta.9
1.0.0-beta.8
1.0.0-beta.7
1.0.0-beta.6
1.0.0-beta.5
1.0.0-beta.4
1.0.0-beta.3
1.0.0-beta.2
1.0.0-beta.1
0.9.5
0.9.4
0.9.3
0.9.2
0.9.1
0.9.0
0.8.1
0.8.0
0.7.7
0.7.6
0.7.5
0.7.4
0.7.3
0.7.2
0.7.1
0.7.0
0.6.3
0.6.2
0.6.1
0.5.2
0.4.4
Postgres sync engine. Sync little subsets of your Postgres data into local apps and services.
Current section
Files
Jump to
Current section
Files
mix.exs
defmodule Electric.MixProject do
use Mix.Project
@github_repo "https://github.com/electric-sql/electric"
def project do
[
app: :electric,
version: version(),
elixir: "~> 1.17",
elixirc_paths: elixirc_paths(Mix.env()),
start_permanent: Mix.env() == :prod,
deps: deps(),
aliases: aliases(),
preferred_cli_env: [
dialyzer: :test,
coveralls: :test,
"coveralls.detail": :test,
"coveralls.post": :test,
"coveralls.html": :test,
"coveralls.cobertura": :test,
"coveralls.lcov": :test
],
releases: [
electric: [
applications: [
electric: :permanent,
# This order of application is important to ensure proper startup sequence of
# application dependencies, namely, inets.
opentelemetry_exporter: :permanent,
opentelemetry: :temporary
],
include_executables_for: [:unix]
]
],
default_release: :electric,
test_coverage: [
tool: ExCoveralls,
ignore_modules: [
Electric,
Electric.Telemetry,
Electric.Postgres.ReplicationClient.State,
~r/Electric.Postgres.LogicalReplication.Messages.*/,
~r/^Support.*/
]
],
dialyzer: [
plt_add_apps: [:mix, :ex_unit],
check_plt: true
],
description: description(),
package: package(),
docs: docs(),
source_url: "#{@github_repo}/tree/main/packages/sync-service",
homepage_url: "https://electric-sql.com"
]
end
def application do
[
extra_applications: [:logger, :tls_certificate_check, :os_mon, :runtime_tools],
# Using a compile-time flag to select the application module or lack thereof allows
# using this app as a dependency with this additional flag
mod:
application_mod(Mix.env(), Application.get_env(:electric, :start_in_library_mode, false))
]
end
# Empty application module for the test environment because there we skip setting up the root
# supervision tree and instead start processes as needed for specific tests.
defp application_mod(:test, _), do: []
defp application_mod(_, true), do: []
defp application_mod(_, _), do: {Electric.Application, []}
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]
defp deps do
List.flatten([
[
{:backoff, "~> 1.1"},
{:bandit, "~> 1.5"},
# Here we use a fork of CubDB that allows for hibernating all of it's processes.
#
# Electric currently uses a CubDB instance per shape, each instance has 4 processes, and those processes
# can keep references to large binaries. Hibernate these processes when not in use can significantly reduce
# the memory footprint.
#
# See: https://github.com/lucaong/cubdb/pull/78
{:electric_cubdb, "~> 2.0"},
{:dotenvy, "~> 0.8"},
{:ecto, "~> 3.11"},
{:gen_stage, "~> 1.2"},
{:jason, "~> 1.4"},
{:nimble_options, "~> 1.1"},
{:opentelemetry, "~> 1.5"},
{:opentelemetry_exporter, "~> 1.8"},
{:opentelemetry_telemetry, "~> 1.1"},
{:opentelemetry_semantic_conventions, "~> 1.27"},
{:otel_metric_exporter, "~> 0.2"},
{:pg_query_ex, "0.5.3"},
{:plug, "~> 1.16"},
{:postgrex, "~> 0.19"},
{:retry, "~> 0.18"},
{:remote_ip, "~> 1.2"},
{:req, "~> 0.5"},
{:sentry, "~> 10.0"},
{:telemetry_metrics_prometheus_core, "~> 1.1"},
{:telemetry_metrics_statsd, "~> 0.7"},
{:telemetry_poller, "~> 1.1", runtime: false},
{:tls_certificate_check, "~> 1.23"},
{:tz, "~> 0.27"}
],
dev_and_test_deps()
])
end
defp dev_and_test_deps do
[
{:dialyxir, "~> 1.4", only: [:test], runtime: false},
{:excoveralls, "~> 0.18", only: [:test], runtime: false},
{:mox, "~> 1.1", only: [:test]},
{:ex_doc, ">= 0.0.0", only: :dev, runtime: false}
]
end
defp aliases() do
[
start_dev: "cmd --cd dev docker compose up -d",
stop_dev: "cmd --cd dev docker compose down -v",
clean_persistent: "cmd rm -rf persistent",
reset: "do clean_persistent, stop_dev, start_dev"
]
end
defp version(default \\ "0.0.0") do
with :error <- version_from_env(),
:error <- version_from_package_json() do
default
end
end
defp version_from_env do
with {:ok, version} <- System.fetch_env("ELECTRIC_VERSION"),
trimmed = String.trim(version),
{:ok, _} <- Version.parse(trimmed) do
trimmed
end
end
defp version_from_package_json do
case File.read("./package.json") do
{:ok, binary} -> binary |> :json.decode() |> Map.fetch!("version")
{:error, _} -> :error
end
end
defp description do
"Postgres sync engine. Sync little subsets of your Postgres data into local apps and services. "
end
defp package do
[
licenses: ["Apache-2.0"],
links: %{
"Electric SQL" => "https://electric-sql.com",
"Github" => @github_repo
},
files: ~w(lib .formatter.exs mix.exs README.md CHANGELOG.md LICENSE package.json)
]
end
defp docs do
version = version("main")
tag = URI.encode("@core/sync-service@#{version}", &(&1 != ?@))
[
main: "readme",
extras: ["README.md"],
source_url_pattern: fn path, line ->
"#{@github_repo}/tree/#{tag}/packages/sync-service/#{path}#L#{line}"
end
]
end
end