Migrate from Source install to Release install¶
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.
We provide a small script to handle things like open the interactive shell, restart the release or execute mix tasks.
With releases, we adopt a more traditional way of managing configuration and media files.
Configuration is now assumed to be in
You can change the path with the
MOBILIZON_CONFIG_PATHenvironment variable. As this file holds Mobilizon only read-access to this file.
Uploads are now assumed to be in
/var/lib/mobilizon/uploadsby default. You can change the path in your config file, with the following config:
config :mobilizon, Mobilizon.Web.Upload.Uploader.Local, uploads: "/var/lib/mobilizon/uploads`
The release files will be assumed to located in
Feel free to put them elsewhere and adapt the following instructions, like
These steps are to be executed as root or with
sudo, in your mobilizon current folder:
Start by stopping the Mobilizon process:
systemctl stop mobilizon
Download and install¶
To get the latest package URL, you should go to our release page and copy the URL from the latest
The https://joinmobilizon.org/latest-package URL redirects to the latest release package available (Gitlab doesn't allow to do this directly currently), but you shouldn't use it it you want to get a beta version or a different version.
- Download the latest release build and unzip it:
curl -L 'https://joinmobilizon.org/latest-package' -o /tmp/mobilizon.tar.gz tar xzf /tmp/mobilizon.tar.gz -C /tmp/
Move the release to the install folder:
mv /tmp/mobilizon /opt/ rm /tmp/mobilizon.tar.gz
Set the proper owner to
chown -R mobilizon:mobilizon /opt/mobilizon
Move the configuration¶
- Create the config directory
mkdir -p /etc/mobilizon
Your configuration file might be either in
config/runtime.exs. Make sure to copy the correct file.
cp config/prod.secret.exs /etc/mobilizon/config.exs
Adapt the configuration¶
Make sure the top of the config file starts with
import Config and not
use Mix.Config. If not, replace it.
If your config file doesn't includes
server: true under
Mobilizon.Web.Endpoint, add it.
config :mobilizon, Mobilizon.Web.Endpoint, + server: true,
Move the media uploads¶
Create the media directory
mkdir -p /var/lib/mobilizon/uploads
Move all uploads to the new location:
mv uploads/* /var/lib/mobilizon/uploads
- Make sure the uploaded files have the proper owner:
chown -R mobilizon:mobilizon /var/lib/mobilizon/uploads
Execute pending database migrations¶
You may have updated to a newer version, so let's run database migrations just to be sure:
sudo -u mobilizon /opt/mobilizon/bin/mobilizon_ctl migrate
Test that the instance starts properly¶
Run Mobilizon as a daemon to test the startup
/opt/mobilizon/bin/mobilizon daemon && tail tmp/log/erlang.log.1 -f
Access Mobilizon.Web.Endpoint at https://yourinstance.comwithout any error messages, it should be fine. Otherwise your configuration is probably incorrect and you need to check it.
Either way, exit the
tail -f with Ctrl+C then stop the daemon with:
Edit the nginx configuration¶
Edit the nginx virtual host file to change paths:
- /home/mobilizon/live/priv/static + /opt/mobilizon/priv/static - /home/mobilizon/live/priv/errors + /opt/mobilizon/priv/errors
Test that configuration is correct and reload nginx
nginx -t && systemctl reload nginx
Edit the systemd configuration¶
- Edit the systemd unit file to change the path to mobilizon: And change the following lines:
- WorkingDirectory=/home/mobilizon/live - ExecStart=/usr/bin/env mix phx.server - ExecReload=/bin/kill $MAINPID + WorkingDirectory=/opt/mobilizon + ExecStart=/opt/mobilizon/bin/mobilizon start + ExecStop=/opt/mobilizon/bin/mobilizon stop
Finally, restart the Mobilizon service
systemctl restart mobilizon
Remove the source install¶
Once we're confident everything works properly, we can get rid of the source install.
Go to the
$HOMEdirectory and remove the
livedirectory and dependencies cache.
cd /home/mobilizon rm -r live/ .cache/ .hex/ .mix/ .yarn/
$HOMEdirectory to the new mobilizon root folder. The
usermodutility will issue a warning telling that the directory already exists, but it will perform the change.
systemctl stop mobilizon usermod -m -d /opt/mobilizon mobilizon systemctl start mobilizon