diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0e7f4926a..37ec48353 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -271,7 +271,7 @@ amd64: MIX_ENV: prod before_script: &before-release - apt-get update && apt-get install -y cmake libmagic-dev - - echo "import Mix.Config" > config/prod.secret.exs + - echo "import Config" > config/prod.secret.exs - mix local.hex --force - mix local.rebar --force script: &release @@ -290,7 +290,7 @@ amd64-musl: variables: *release-variables before_script: &before-release-musl - apk add git build-base cmake file-dev openssl - - echo "import Mix.Config" > config/prod.secret.exs + - echo "import Config" > config/prod.secret.exs - mix local.hex --force - mix local.rebar --force script: *release diff --git a/CHANGELOG.md b/CHANGELOG.md index a979ff325..cf89bd70d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - MastoFE ### Changed +- **Breaking:** Elixir >=1.10 is now required (was >= 1.9) - Allow users to remove their emails if instance does not need email to register - Uploadfilter `Pleroma.Upload.Filter.Exiftool` has been renamed to `Pleroma.Upload.Filter.Exiftool.StripLocation` - Updated the recommended pleroma.vcl configuration for Varnish to target Varnish 7.0+ diff --git a/Dockerfile b/Dockerfile index e68b7ea7c..334d954f7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,11 @@ -FROM elixir:1.9-alpine as build +FROM elixir:1.10-alpine as build COPY . . ENV MIX_ENV=prod RUN apk add git gcc g++ musl-dev make cmake file-dev &&\ - echo "import Mix.Config" > config/prod.secret.exs &&\ + echo "import Config" > config/prod.secret.exs &&\ mix local.hex --force &&\ mix local.rebar --force &&\ mix deps.get --only prod &&\ diff --git a/ci/Dockerfile b/ci/Dockerfile index e6a8b438c..d39fd8d7b 100644 --- a/ci/Dockerfile +++ b/ci/Dockerfile @@ -1,7 +1,8 @@ -FROM elixir:1.9.4 +FROM elixir:1.10.4 +# Single RUN statement, otherwise intermediate images are created +# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#run RUN apt-get update &&\ - apt-get install -y libmagic-dev cmake libimage-exiftool-perl ffmpeg &&\ + apt-get install -y libmagic-dev cmake libimage-exiftool-perl ffmpeg &&\ mix local.hex --force &&\ mix local.rebar --force - diff --git a/ci/README b/ci/README new file mode 100644 index 000000000..3785adef1 --- /dev/null +++ b/ci/README @@ -0,0 +1,12 @@ +## Dependencies + +Assuming an AMD64 Alpine system, you're going to need the following packages +- `qemu qemu-openrc qemu-arm qemu-aarch64` for binfmt +- `docker-cli-buildx` for building the images + +## Setting up + +``` +docker login git.pleroma.social:5050 +doas rc-service qemu-binfmt start +``` diff --git a/config/config.exs b/config/config.exs index aa53b7653..e07c3c779 100644 --- a/config/config.exs +++ b/config/config.exs @@ -37,7 +37,7 @@ # FIGURATION! EDIT YOUR SECRET FILE (either prod.secret.exs, dev.secret.exs). # # This file is responsible for configuring your application -# and its dependencies with the aid of the Mix.Config module. +# and its dependencies with the aid of the Config module. # # This configuration file is loaded before any dependency and # is restricted to this project. diff --git a/docs/configuration/howto_database_config.md b/docs/configuration/howto_database_config.md index ae1462f9b..e5af9097a 100644 --- a/docs/configuration/howto_database_config.md +++ b/docs/configuration/howto_database_config.md @@ -59,7 +59,7 @@ The configuration of Pleroma has traditionally been managed with a config file, Here is an example of a server config stripped down after migration: ``` - use Mix.Config + import Config config :pleroma, Pleroma.Web.Endpoint, url: [host: "cool.pleroma.site", scheme: "https", port: 443] diff --git a/docs/installation/generic_dependencies.include b/docs/installation/generic_dependencies.include index 2dbd93e42..dcaacfdfd 100644 --- a/docs/installation/generic_dependencies.include +++ b/docs/installation/generic_dependencies.include @@ -1,7 +1,7 @@ ## Required dependencies * PostgreSQL 9.6+ -* Elixir 1.9+ +* Elixir 1.10+ * Erlang OTP 22.2+ * git * file / libmagic diff --git a/elixir_buildpack.config b/elixir_buildpack.config index 946408c12..1102e7145 100644 --- a/elixir_buildpack.config +++ b/elixir_buildpack.config @@ -1,2 +1,2 @@ -elixir_version=1.9.4 +elixir_version=1.10.4 erlang_version=22.3.4.1 diff --git a/lib/mix/tasks/pleroma/config.ex b/lib/mix/tasks/pleroma/config.ex index 33d147d36..3a2ea44f8 100644 --- a/lib/mix/tasks/pleroma/config.ex +++ b/lib/mix/tasks/pleroma/config.ex @@ -304,13 +304,8 @@ defmodule Mix.Tasks.Pleroma.Config do System.cmd("mix", ["format", path]) end - if Code.ensure_loaded?(Config.Reader) do - defp config_header, do: "import Config\r\n\r\n" - defp read_file(config_file), do: Config.Reader.read_imports!(config_file) - else - defp config_header, do: "use Mix.Config\r\n\r\n" - defp read_file(config_file), do: Mix.Config.eval!(config_file) - end + defp config_header, do: "import Config\r\n\r\n" + defp read_file(config_file), do: Config.Reader.read_imports!(config_file) defp write_and_delete(config, file, delete?) do config diff --git a/lib/pleroma/config/loader.ex b/lib/pleroma/config/loader.ex index 015be3d8e..bd85eccab 100644 --- a/lib/pleroma/config/loader.ex +++ b/lib/pleroma/config/loader.ex @@ -19,21 +19,10 @@ defmodule Pleroma.Config.Loader do :tesla ] - if Code.ensure_loaded?(Config.Reader) do - @reader Config.Reader - - def read(path), do: @reader.read!(path) - else - # support for Elixir less than 1.9 - @reader Mix.Config - def read(path) do - path - |> @reader.eval!() - |> elem(0) - end - end + @reader Config.Reader @spec read(Path.t()) :: keyword() + def read(path), do: @reader.read!(path) @spec merge(keyword(), keyword()) :: keyword() def merge(c1, c2), do: @reader.merge(c1, c2) diff --git a/lib/pleroma/web/activity_pub/object_validator.ex b/lib/pleroma/web/activity_pub/object_validator.ex index 9f446100d..5bcd6da46 100644 --- a/lib/pleroma/web/activity_pub/object_validator.ex +++ b/lib/pleroma/web/activity_pub/object_validator.ex @@ -247,8 +247,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidator do def cast_and_apply(o), do: {:error, {:validator_not_set, o}} - # is_struct/1 appears in Elixir 1.11 - def stringify_keys(%{__struct__: _} = object) do + def stringify_keys(object) when is_struct(object) do object |> Map.from_struct() |> stringify_keys diff --git a/mix.exs b/mix.exs index b26e498cd..1ae9e77f6 100644 --- a/mix.exs +++ b/mix.exs @@ -5,7 +5,7 @@ defmodule Pleroma.Mixfile do [ app: :pleroma, version: version("2.4.52"), - elixir: "~> 1.9", + elixir: "~> 1.10", elixirc_paths: elixirc_paths(Mix.env()), compilers: [:phoenix, :gettext] ++ Mix.compilers(), elixirc_options: [warnings_as_errors: warnings_as_errors()], diff --git a/priv/templates/sample_config.eex b/priv/templates/sample_config.eex index 0068969ac..d44c324ca 100644 --- a/priv/templates/sample_config.eex +++ b/priv/templates/sample_config.eex @@ -3,11 +3,7 @@ # NOTE: This file should not be committed to a repo or otherwise made public # without removing sensitive information. -<%= if Code.ensure_loaded?(Config) or not Code.ensure_loaded?(Mix.Config) do - "import Config" -else - "use Mix.Config" -end %> +import Config config :pleroma, Pleroma.Web.Endpoint, url: [host: "<%= domain %>", scheme: "https", port: <%= port %>], diff --git a/restarter/mix.exs b/restarter/mix.exs index 9f26f5f64..4bb9b76e2 100644 --- a/restarter/mix.exs +++ b/restarter/mix.exs @@ -5,7 +5,7 @@ defmodule Restarter.MixProject do [ app: :restarter, version: "0.1.0", - elixir: "~> 1.8", + elixir: "~> 1.10", start_permanent: Mix.env() == :prod, deps: deps() ]