From 45cc1d27a1622b2f6434e0fae161131ff36b226a Mon Sep 17 00:00:00 2001 From: Adam Rutkowski Date: Wed, 6 Jul 2022 16:47:31 +0200 Subject: [PATCH] Fix dev environment startup errors (#1990) * Include gelocation DB download in the development workflow * Make sure `tls_certificate_check` is started ASAP This prevents `:application_either_not_started_or_not_ready` errors on application startup. * Mark Makefile targets as PHONY By default Make assumes the targets are files, in this case none of them are. --- CONTRIBUTING.md | 1 + Makefile | 3 +++ config/runtime.exs | 2 +- mix.exs | 3 ++- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 5b8ab2f6a..bd61e881c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -15,6 +15,7 @@ Make sure Docker, Elixir, Erlang and Node.js are all installed on your developme 2. Run `mix ecto.create`. This will create the required databases in both Postgres and Clickhouse. 3. Run `mix ecto.migrate` to build the database schema. 4. Run `npm ci --prefix assets` to install the required node dependencies. + 5. Run `mix download_country_database` to fetch geolocation database 3. Run `make server` or `mix phx.server` to start the Phoenix server. 4. The system is now available on `localhost:8000`. diff --git a/Makefile b/Makefile index 0c8d61e01..612c01e21 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,10 @@ +.PHONY: install server clickhouse clickhouse-arm clickhouse-stop postgres postgres-stop dummy_event + install: mix deps.get mix ecto.create mix ecto.migrate + mix download_country_database npm install --prefix assets server: diff --git a/config/runtime.exs b/config/runtime.exs index 3eb09471a..d6cd68592 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -114,7 +114,7 @@ geolite2_country_db = get_var_from_path_or_env( config_dir, "GEOLITE2_COUNTRY_DB", - Application.app_dir(:plausible) <> "/priv/geodb/dbip-city-lite-2022-05.mmdb" + Application.app_dir(:plausible, "/priv/geodb/dbip-country.mmdb") ) ip_geolocation_db = get_var_from_path_or_env(config_dir, "IP_GEOLOCATION_DB", geolite2_country_db) diff --git a/mix.exs b/mix.exs index b46571205..14976e634 100644 --- a/mix.exs +++ b/mix.exs @@ -36,7 +36,8 @@ defmodule Plausible.MixProject do mod: {Plausible.Application, []}, extra_applications: [ :logger, - :runtime_tools + :runtime_tools, + :tls_certificate_check ] ] end