Skip to content

Development

Start by retrieving the code by cloning the repository:

Info

You can use the following URI for anonymous access, but you won't be able to push any changes that way.

git clone https://framagit.org/kaihuri/mobilizon && cd mobilizon

Info

This requires to have an account on Framagit, Framasoft's self-hosted Gitlab code forge.

git clone git@framagit.org:kaihuri/mobilizon.git && cd mobilizon

Run Mobilizon:

  • with Docker and Docker Compose (Recommended)
  • without Docker and Docker Compose (This involves more work on your part, use Docker and Docker Compose if you can)

With Docker

  • Copy .env.template to .env and tweak it to your likening
  • Install Make
  • Install Docker and Docker Compose for your system.
    Note: Podman versions ≥ 3 should work as well with the podman-compose command (instead of docker compose).
  • Run make setup to build, then make to launch a database container and an API container.
  • Follow the progress of the build with make logs.
  • Access localhost:4000 in your browser once the containers are fully built and launched.
  • Stop everything with make stop

Mix tasks

For instance creating an admin user

docker compose exec api mix mobilizon.users.new "your@email.com" --admin --password "mypassword"

All other Mix commands (from Mobilizon and dependencies) are available in the same way. For instance to generate a new migration:

docker compose exec api mix ecto.gen.migration MyMigrationModuleName
Then once it's written
docker compose exec api mix ecto.migrate
(or the shortcut version make migrate)

If you need to execute the iex while running, you can launch the database container on its own:

docker compose start postgres
And then run the API container with iex:
docker compose run --service-ports --rm api iex -S mix phx.server

Without Docker

Install system dependencies

You must install different libraries:

  • Elixir (and Erlang)
  • PostgreSQL ≥ 11 with PostGIS
  • Install NodeJS (we guarantee support for the latest LTS)
  • cmake, inotify-tools, ImageMagick, webp and basic build tools

For that, in Linux Debian:

sudo apt-get install build-essential curl unzip openssl git cmake file
To install other libraries, we recommand to use ASDF:
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.13.1
echo '. "$HOME/.asdf/asdf.sh"' >> ~/.bashrc
echo '. "$HOME/.asdf/completions/asdf.bash"' >> ~/.bashrc
. ~/.bashrc
With specifique plug-in:
asdf plugin-add elixir
asdf plugin-add erlang
asdf plugin-add nodejs
asdf plugin-add postgres
asdf plugin-add python

Build Mobilizon

Extract Mobilizon source:

git clone https://framagit.org/kaihuri/mobilizon.git mobilizon && cd mobilizon
You can create a fork of this git repository to propose "Merge Request" with your propositions.

Install your software link by asdf

asdf install

activate pre-commit hooks for linter

git config --local core.hooksPath ".husky/_"

Import Mobilizon libraraies and run build.

cp -r ../mobilizon/{deps,_build,node_modules} ./
MIX_ENV=dev mix deps.get
MIX_ENV=dev mix deps.compile
npm install
npm run build
MIX_ENV=dev mix phx.digest

Configure the database

It's easier to use docker instance of PostgreSQL:

docker pull postgis/postgis:16-3.4
docker run -d --name mobilizon_dev4 -p 65432:5432 -e POSTGRES_PASSWORD=postgres -e POSTGRES_USER=postgres -e POSTGRES_DB=mobilizon_dev4 postgis/postgis:16-3.4

So, define environment variables for database

export MOBILIZON_DATABASE_HOST="127.0.0.1"
export MOBILIZON_DATABASE_PORT="65432"
export MOBILIZON_DATABASE_DBNAME=mobilizon_dev4
export MOBILIZON_DATABASE_USERNAME=postgres
export MOBILIZON_DATABASE_PASSWORD=postgres

If you want to backup SQL dump, use:

docker exec -i mobilizon_dev4 pg_dump -U $MOBILIZON_DATABASE_USERNAME -d $MOBILIZON_DATABASE_DBNAME > mobilizon_backup.sql

If you want to restore SQL dump, use:

docker exec -i mobilizon_dev4 psql -U $MOBILIZON_DATABASE_USERNAME -d $MOBILIZON_DATABASE_DBNAME < mobilizon_backup.sql

Create your database with mix ecto.create Run database migrations: mix ecto.migrate

Configure your dev Mobilizon

  • Generate configuration mix mobilizon.instance gen. Answer the following for these questions:
    • domain: localhost
    • database host: localhost (default)
    • database port: 65432 (5432 by default)
    • database name: mobilizon_dev
    • database username: mobilizon (default)
    • database password: mobilizon (or whatever you've chosen before)

The rest can be left to default is possible or be set to whatever you prefer.

Tip

To make sure URLs are generated properly, edit config/runtime.exs and add , port: 4000 behind url: [host: "localhost".

Generate first user

Generate your first user with the mix mobilizon.users.new task

mix mobilizon.users.new john.doe@localhost.com --admin

You should have a similar output:

A user has been created with the following information:
  - email: john.doe@localhost.com
  - password: r/EKpKr5o7ngQY+r
  - Role: user
The user will be prompted to create a new profile after login for the first time.

Start the server

Start Phoenix endpoint with mix phx.server. The client development server will also automatically be launched and will reload on file change. Now you can visit localhost:4000 in your browser and see the website (server and client) in action.

If you want to access iex while the server is running, you can use this command to launch the server:

iex -S mix phx.server

Run unit-tests backend

# Compile
set -x
mix deps.get
mix compile
mix tz_world.update
mix ecto.create
mix ecto.migrate
set +x

# start test
mix test 

to launch only 1 elixir test file, presise it after last command. Example with ./test/graphql/resolvers/config_test.exs:

mix test "test/graphql/resolvers/config_test.exs" 

Run unit-tests frontend

Check dependancy

npm install

Run test with watchdog (The locally changed tests will be automatically re-launch by this command if a file is changed)

npm run test

Run test full with coverage

npm run coverage

Run test with snapshots refresh

npx vitest run -u

Run e2e tests

Configure and launch e2e server

export MIX_ENV="e2e"
export MOBILIZON_DATABASE_HOST="127.0.0.1"
export MOBILIZON_DATABASE_PORT="55432"
export MOBILIZON_DATABASE_DBNAME=mobilizon_e2e
export MOBILIZON_DATABASE_USERNAME=mobilizon_e2e
export MOBILIZON_DATABASE_PASSWORD=mobilizon_e2e
DOCKER_NAME="mobilizon_e2e"

docker rm -f -v $DOCKER_NAME 2>/dev/null || echo "-- no old docker 'dktest' --"
docker run -d --name $DOCKER_NAME -p $MOBILIZON_DATABASE_PORT:5432 -e POSTGRES_PASSWORD=$MOBILIZON_DATABASE_PASSWORD -e POSTGRES_USER=$MOBILIZON_DATABASE_USERNAME -e POSTGRES_DB=$MOBILIZON_DATABASE_DBNAME postgis/postgis:16-3.4
sleep 10

mix deps.get
mix ecto.create
mix ecto.migrate
mix run priv/repo/e2e.seed.exs
mix phx.digest
mix phx.server

launch test in other console

# install dependancy before
npm install && npm run build && npx playwright install
# launch with firefox
npx playwright test --project firefox
# launch with chromium
npx playwright test --project chromium

Documentation on project components

For backend

Elixir

Ecto

Phoenix Framework

GraphQL

For frontend

Vue.js

Tailwind CSS

Oruga UI

FAQ

Issues with argon2 when creating users.

This is because you installed deps through Docker and are now using Mobilizon without it, or the other way around. Just rm -r deps/argon2_elixir and trigger mix deps.get again.

‘libcrypto.so.1.1: cannot open shared object file: No such file or directory’

Under Linux Mint 21.3 or Linux Mint 22 (Debian bookworm), in case of error "'libcrypto.so.1.1: cannot open shared object file: No such file or directory'" :

wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2.23_amd64.deb
sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2.23_amd64.deb

Last update: October 31, 2025