How to Install Mobilizon on Clear Linux Latest

Mobilizon is a free and open-source federated platform to organize social events, created as an alternative to the commercial platforms. In this tutorial, you will learn how to install Mobilizon on Clear Linux latest version.

Prerequisites

To install Mobilizon on Clear Linux, you should have:

Step 1: Install Docker

Docker is necessary to run Mobilizon in a container.

$sudo swupd bundle-add containers-basic
$sudo systemctl enable --now docker.socket
$sudo usermod -a -G docker $USER

Step 2: Install PostgreSQL

Mobilizon uses PostgreSQL to store its data.

$sudo swupd bundle-add postgresql
$sudo systemctl enable --now postgresql

Step 3: Install Nginx

Nginx will act as a reverse proxy for Mobilizon and secure the communication.

$sudo swupd bundle-add nginx
$sudo systemctl enable nginx

Step 4: Get Mobilizon Docker Image

Let us first create project directory and navigate to it.

$mkdir mobilizon
$cd mobilizon

Clone Mobilizon from GitHub using the below command:

$ git clone https://github.com/Chocobozzz/Mobilizon.git

Then navigate to the Mobilizon folder using cd

$ cd Mobilizon

Step 5: Mobilizon docker-compose.yml

Create docker-compose.yml file using the below command:

$ nano docker-compose.yml

Add the following content to the docker-compose.yml file:

version: "3.6"

networks:
  proxy-tier:

services:
  db:
    image: postgres:12
    restart: unless-stopped
    environment:
      POSTGRES_DB: "mobilizon"
      POSTGRES_USER: "mobilizon"
      POSTGRES_PASSWORD: "your_strong_password_here"
    volumes:
      - pg_data:/var/lib/postgresql/data
    networks:
      proxy-tier:

  mobilizon:
    image: chocobozzz/mobilizon
    restart: unless-stopped
    environment:
      DATABASE_URL: postgresql://mobilizon:your_strong_password_here@db/mobilizon

      MOBILIZON_BASE_URL: "https://yourdomain.com"
      MOBILIZON_PUBLIC_URL: "https://yourdomain.com"
      MOBILIZON_SMTP_ADDRESS: "smtp.gmail.com"
      MOBILIZON_SMTP_PORT: 587
      MOBILIZON_SMTP_LOGIN: "youremailusername@gmail.com"
      MOBILIZON_SMTP_PASSWORD: "your_email_password_here"
      MOBILIZON_EMAIL_FROM: "youremailusername@gmail.com"

      SECRET_KEY_BASE: "your_secret_key_here" # This could be generated via `openssl rand -hex 64` command. 

    volumes:
      - media:/app/public/system
      - thumbnails:/app/public/thumbnails
    networks:
      proxy-tier:

  proxy:
    image: jwilder/nginx-proxy:alpine
    restart: unless-stopped
    ports:
      - 80:80
      - 443:443
    volumes:
      - certs:/etc/nginx/certs
      - vhost:/etc/nginx/vhost.d
      - html:/usr/share/nginx/html
      - /var/run/docker.sock:/tmp/docker.sock:ro
    networks:
      proxy-tier:

  letsencrypt:
    image: jrcs/letsencrypt-nginx-proxy-companion
    restart: unless-stopped
    environment:
      DEFAULT_EMAIL: "youremailusername@gmail.com"
      NGINX_PROXY_CONTAINER: "proxy"
    volumes:
      - certs:/etc/nginx/certs
      - vhost:/etc/nginx/vhost.d
      - html:/usr/share/nginx/html
      - /var/run/docker.sock:/var/run/docker.sock:ro
    networks:
      proxy-tier:

volumes:
  pg_data:
  media:
  thumbnails:
  certs:
  vhost:
  html:

Edit POSTGRES_PASSWORD,DATABASE_URL,MOBILIZON_BASE_URL,MOBILIZON_PUBLIC_URL,MOBILIZON_SMTP_ADDRESS,MOBILIZON_SMTP_LOGIN, MOBILIZON_SMTP_PASSWORD, and SECRET_KEY_BASE fields with appropriate values.

Save and close docker-compose.yml file.

Step 6: Start Mobilizon

Launch Mobilizon using docker-compose.

$ sudo docker-compose up -d

Step 7:Configure Nginx

Create the Nginx configuration file for your Mobilizon.

$sudo nano /etc/nginx/conf.d/mobilizon.conf

Add the following configuration to the file:

upstream mobilizon {
  server 127.0.0.1:3000;
  keepalive 1024;
}

server {
    listen 80;
    listen 443 ssl;
    server_name your.domain.com;

    ssl_certificate /etc/letsencrypt/live/your.domain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/your.domain.com/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/your.domain.com/chain.pem;

    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload;" always;
    add_header Referrer-Policy strict-origin-when-cross-origin;
    add_header X-Content-Type-Options nosniff;
    add_header X-Frame-Options SAMEORIGIN;
    add_header X-XSS-Protection "1; mode=block";

    location / {
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        client_max_body_size 10M;
        client_body_buffer_size 128k;

        proxy_busy_buffers_size 64k;
        proxy_buffer_size 128k;
        proxy_buffers 4 256k;
        proxy_read_timeout 300;
        proxy_connect_timeout 300;

        proxy_pass http://mobilizon;
        proxy_redirect off;
    }
}

Edit and replace yourdomain.com with your domain name.

Save and close the file.

Step 8: Generate SSL certificate

To generate an SSL certificate for your domain name, run the following command:

$ sudo docker-compose -f docker-compose.yml run --rm letsencrypt

Step 9: Start Mobilizon

Start the Mobilizon container.

$ sudo docker-compose up -d

Access Mobilizon on your browser using the URL https://your.domain.com.

You have successfully installed Mobilizon on Clear Linux.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!