diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d9b0e22..bd59dff0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,63 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## 1.1.0-beta.1 - 10-03-2021 + +This version introduces a new way to install and host Mobilizon : Elixir releases. This is the new default way of installing Mobilizon. Please read [UPGRADE.md](./UPGRADE.md#upgrading-from-10-to-11) for details on how to migrate to Elixir binary releases or stay on source install. + +### Added + +- **Add a group activity logbook** +- **Possibility for user to define a location in their settings to get close events** +- **Support for Elixir releases and runtime.exs, allowing to change configuration without recompiling** +- Support for Sentry +- Added support for custom plural rules on front-end (only Gaelic supported for now) +- Added possibility to bookmark search by location through geohash + +### Changed + +- Prune done background jobs +- Improved search form +- Improved backend error page +- Added a confirmation step before deleting a conversation + +### Removed + +- Support for Elixir versions < 1.11 + +### Fixes + +- Fixed editing a group discussion +- Fixed accessing terms and privacy pages +- Fixed refreshing only groups which are stale +- Fixed success message when validating group follower +- Fixed formatted dates using system locale instead of browser/Mobilizon's locale +- Fixed federating draft status +- Fixed group draft posts being sent to followers +- Fixed detecting membership status on group page +- Fixed admin language selection + +### Translations + +- Arabic +- Belarusian +- Bengali +- Catalan +- Chinese (Traditional) +- English +- French +- Gaelic +- Galician +- German +- Hungarian +- Italian +- Occitan +- Portuguese (Brazil) +- Slovenian +- Spanish +- Russian + ## 1.0.7 - 27-02-2021 ### Fixed diff --git a/UPGRADE.md b/UPGRADE.md new file mode 100644 index 00000000..257e16eb --- /dev/null +++ b/UPGRADE.md @@ -0,0 +1,44 @@ +# Upgrading from 1.0 to 1.1 + +The 1.1 version of Mobilizon brings Elixir releases support. An Elixir release is a self-contained directory that contains all of Mobilizon's code (front-end and backend), it's dependencies, as well as the Erlang Virtual Machine and runtime (only the parts you need). As long as the release has been assembled on the same OS and architecture, it can be deploy and run straight away. [Read more about releases](https://elixir-lang.org/getting-started/mix-otp/config-and-releases.html#releases). + +## Comparison +Migrating to releases means: +* You only get a precompiled binary, so you avoid compilation times when updating +* No need to have Elixir/NodeJS installed on the system +* Code/data/config location is more common (/opt, /var/lib, /etc) +* More efficient, as only what you need from the Elixir/Erlang standard libraries is included and all of the code is directly preloaded +* You can't hardcode modifications in Mobilizon's code + +Staying on source releases means: +* You need to recompile everything with each update +* Compiling frontend and backend has higher system requirements than just running Mobilizon +* You can change things in Mobilizon's code and recompile right away to test changes + +## Releases +If you want to migrate to releases, [we provide a full guide](https://docs.joinmobilizon.org/administration/upgrading/source_to_release/). You may do this at any time. + +## Source install +To stay on a source release, you just need to check the following things: +* Rename your configuration file `config/prod.secret.exs` to `config/runtime.exs`. +* If your config file includes `server: true` under `Mobilizon.Web.Endpoint`, remove it. + ```diff + config :mobilizon, Mobilizon.Web.Endpoint, + - server: true, + ``` +* The uploads default directory is now `/var/lib/mobilizon/uploads`. To keep it in the previous `uploads/` directory, just add the following line to `config/runtime.exs`: + ```elixir + config :mobilizon, Mobilizon.Web.Upload.Uploader.Local, uploads: "uploads" + ``` + Or you may use any other directory where the `mobilizon` user has write permissions. +* The GeoIP database default directory is now `/var/lib/mobilizon/geo/GeoLite2-City.mmdb`. To keep it in the previous `priv/data/GeoLite2-City.mmdb` directory, just add the following line to `config/runtime.exs`: + ```elixir + config :geolix, databases: [ + %{ + id: :city, + adapter: Geolix.Adapter.MMDB2, + source: "priv/data/GeoLite2-City.mmdb" + } + ] + ``` + Or you may use any other directory where the `mobilizon` user has read permissions. \ No newline at end of file diff --git a/config/config.exs b/config/config.exs index 499cf18a..3d0c6ac3 100644 --- a/config/config.exs +++ b/config/config.exs @@ -81,7 +81,7 @@ config :mobilizon, Mobilizon.Web.Upload, ] ] -config :mobilizon, Mobilizon.Web.Upload.Uploader.Local, uploads: "uploads" +config :mobilizon, Mobilizon.Web.Upload.Uploader.Local, uploads: "/var/lib/mobilizon/uploads" config :mobilizon, :media_proxy, enabled: true, @@ -149,7 +149,7 @@ config :geolix, %{ id: :city, adapter: Geolix.Adapter.MMDB2, - source: "priv/data/GeoLite2-City.mmdb" + source: "/var/lib/mobilizon/geo/GeoLite2-City.mmdb" } ] diff --git a/config/releases.exs b/config/docker.exs similarity index 100% rename from config/releases.exs rename to config/docker.exs diff --git a/docker/production/Dockerfile b/docker/production/Dockerfile index e0904d22..90537df1 100644 --- a/docker/production/Dockerfile +++ b/docker/production/Dockerfile @@ -20,7 +20,7 @@ RUN mix local.hex --force \ COPY lib ./lib COPY priv ./priv -COPY config/config.exs config/prod.exs config/releases.exs ./config/ +COPY config/config.exs config/prod.exs config/docker.exs ./config/ COPY rel ./rel COPY --from=assets ./priv/static ./priv/static @@ -55,6 +55,7 @@ EXPOSE 4000 ENV MOBILIZON_DOCKER=true COPY --from=builder --chown=nobody:nobody _build/prod/rel/mobilizon ./ +RUN mv config/docker.exs /etc/mobilizon/config.exs COPY docker/production/docker-entrypoint.sh ./ ENTRYPOINT ["./docker-entrypoint.sh"] diff --git a/js/package.json b/js/package.json index a4ccc018..0738d166 100644 --- a/js/package.json +++ b/js/package.json @@ -1,6 +1,6 @@ { "name": "mobilizon", - "version": "1.0.7", + "version": "1.1.0", "private": true, "scripts": { "serve": "vue-cli-service serve", diff --git a/lib/mix/tasks/mobilizon/common.ex b/lib/mix/tasks/mobilizon/common.ex index 5fdb6af4..5c441b3a 100644 --- a/lib/mix/tasks/mobilizon/common.ex +++ b/lib/mix/tasks/mobilizon/common.ex @@ -9,6 +9,7 @@ defmodule Mix.Tasks.Mobilizon.Common do """ def start_mobilizon do + if mix_task?(), do: Mix.Task.run("app.config") Application.put_env(:phoenix, :serve_endpoints, false, persistent: true) {:ok, _} = Application.ensure_all_started(:mobilizon) @@ -64,6 +65,8 @@ defmodule Mix.Tasks.Mobilizon.Common do @doc "Performs a safe check whether `Mix.shell/0` is available (does not raise if Mix is not loaded)" def mix_shell?, do: :erlang.function_exported(Mix, :shell, 0) + def mix_task?, do: :erlang.function_exported(Mix.Task, :run, 1) + def escape_sh_path(path) do ~S(') <> String.replace(path, ~S('), ~S(\')) <> ~S(') end diff --git a/lib/mix/tasks/mobilizon/instance.ex b/lib/mix/tasks/mobilizon/instance.ex index 4055a24c..dcb4e552 100644 --- a/lib/mix/tasks/mobilizon/instance.ex +++ b/lib/mix/tasks/mobilizon/instance.ex @@ -41,6 +41,7 @@ defmodule Mix.Tasks.Mobilizon.Instance do options, strict: [ force: :boolean, + source: :boolean, output: :string, output_psql: :string, domain: :string, @@ -55,7 +56,8 @@ defmodule Mix.Tasks.Mobilizon.Instance do ], aliases: [ o: :output, - f: :force + f: :force, + s: :source ] ) @@ -67,6 +69,7 @@ defmodule Mix.Tasks.Mobilizon.Instance do will_overwrite = Enum.filter(paths, &File.exists?/1) proceed? = Enum.empty?(will_overwrite) or Keyword.get(options, :force, false) + source_install? = Keyword.get(options, :source, false) if proceed? do [domain, port | _] = @@ -148,7 +151,8 @@ defmodule Mix.Tasks.Mobilizon.Instance do database_password: dbpass, instance_secret: instance_secret, auth_secret: auth_secret, - listen_port: listen_port + listen_port: listen_port, + release: source_install? == false ) result_psql = @@ -193,7 +197,7 @@ defmodule Mix.Tasks.Mobilizon.Instance do {:error, err} -> shell_error( - "\nERROR: Unable to write config file to #{config_path}. Make sure you have permissions on the destination.\n" + "\nERROR: Unable to write config file to #{config_path}. Make sure you have permissions on the destination and that the parent path exists.\n" ) {:error, err} @@ -209,7 +213,7 @@ defmodule Mix.Tasks.Mobilizon.Instance do {:error, err} -> shell_error( - "\nERROR: Unable to write psql file to #{psql_path}. Make sure you have permissions on the destination.\n" + "\nERROR: Unable to write psql file to #{psql_path}. Make sure you have permissions on the destination and that the parent path exists.\n" ) {:error, err} diff --git a/priv/templates/config.template.eex b/priv/templates/config.template.eex index f0cc0e68..6d2eb4be 100644 --- a/priv/templates/config.template.eex +++ b/priv/templates/config.template.eex @@ -3,7 +3,7 @@ import Config config :mobilizon, Mobilizon.Web.Endpoint, - server: true, + server: <%= release %>, url: [host: "<%= instance_domain %>"], http: [port: <%= listen_port %>], secret_key_base: "<%= instance_secret %>" diff --git a/rel/overlays/bin/mobilizon_ctl b/rel/overlays/bin/mobilizon_ctl index 458de578..acff8719 100755 --- a/rel/overlays/bin/mobilizon_ctl +++ b/rel/overlays/bin/mobilizon_ctl @@ -32,8 +32,15 @@ else if [ $# -gt 0 ]; then shift fi + echo "$1" | grep "^-" >/dev/null + if [ $? -eq 1 ]; then + SUBACTION="$1" + if [ $# -gt 0 ]; then + shift + fi + fi - if [ "$ACTION" = "migrate" ] || [ "$ACTION" = "rollback" ] || [ "$ACTION" = "create" ] || [ "$MOBILIZON_CTL_RPC_DISABLED" = true ]; then + if [ "$ACTION" = "migrate" ] || [ "$ACTION" = "rollback" ] || [ "$ACTION" = "create" ] || [ "$ACTION $SUBACTION" = "instance gen" ] || [ "$MOBILIZON_CTL_RPC_DISABLED" = true ]; then "$SCRIPTPATH"/mobilizon eval 'Mobilizon.CLI.run("'"$FULL_ARGS"'")' else "$SCRIPTPATH"/mobilizon rpc 'Mobilizon.CLI.run("'"$FULL_ARGS"'")'