Releases fixes
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
parent
91567ba7d4
commit
239457a219
@ -7,13 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## 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. If you want to migrate to a release install from a source release, you can read [more details here](./UPGRADE.md#upgrading-from-10-to-11). You may also stay on source install for now, or upgrade at any time.
|
||||
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
|
||||
- **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
|
||||
|
33
UPGRADE.md
33
UPGRADE.md
@ -2,14 +2,43 @@
|
||||
|
||||
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
|
||||
* You can change things in Mobilizon's code and recompile right away
|
||||
* 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
|
||||
|
||||
If you want to migrate to releases, [we provide a guide](https://docs.joinmobilizon.org/administration/upgrading/source_to_release/).
|
||||
## 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.
|
@ -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"
|
||||
}
|
||||
]
|
||||
|
||||
|
@ -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"]
|
||||
|
@ -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
|
||||
|
@ -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}
|
||||
|
@ -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 %>"
|
||||
|
@ -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"'")'
|
||||
|
Loading…
Reference in New Issue
Block a user