How to Install Loomio on OpenBSD

Loomio is a free and open-source web application that enables groups to make decisions together online. In this tutorial, we will guide you through the process of installing Loomio on OpenBSD.

Prerequisites

Before proceeding with the installation, please make sure you have the following:

Step 1: Install Required Packages

OpenBSD has a number of packages that must be installed prior to running Loomio. Use the following commands to install the necessary packages:

$ sudo pkg_add ruby ruby-bundler ruby-sasslib postgresql-server postgresql-client

Step 2: Set Up PostgreSQL

Loomio requires a PostgreSQL database to be created. To set up PostgreSQL, use the following commands:

$ su - _postgresql
$ /usr/local/bin/initdb -D /var/postgresql/data
$ exit

Afterwards, start the PostgreSQL server:

$ rcctl enable postgresql
$ rcctl start postgresql

Finally, create a database user and database for Loomio:

$ sudo -u _postgresql createuser -s loomio
$ sudo -u _postgresql createdb -O loomio loomio_production

Step 3: Download and Install Loomio

Create a new directory for the Loomio source code:

$ mkdir /var/www/loomio
$ cd /var/www/loomio

Clone the Loomio source code repository:

$ git clone https://github.com/loomio/loomio.git

Switch to the stable branch:

$ cd loomio
$ git checkout stable

Install the Ruby dependencies:

$ bundle install --deployment --without=development test

Afterwards, create a file called .env.production in the root of the Loomio directory:

$ nano .env.production

Add the following contents to the file:

# Database settings
DATABASE_URL=postgresql://loomio@localhost/loomio_production

# Email settings
SMTP_SERVER=smtp.example.com
SMTP_USERNAME=username
SMTP_PASSWORD=password
DEFAULT_FROM=loomio@example.com

# Misc settings
SECRET_KEY_BASE=generate_this_with_rake_secret

Replace the values in this file with appropriate values for your PostgreSQL and email settings. Generate the SECRET_KEY_BASE by running the following command:

rake secret

This will generate a base64-encoded string that you should paste into the SECRET_KEY_BASE value in the .env.production file.

Step 4: Configure Web Server

Apache

If you are using Apache, create a new virtual host configuration file:

$ nano /etc/httpd/conf.d/loomio.conf

Then, add the following configuration to the file:

<VirtualHost *:80>
    ServerName loomio.example.com
    DocumentRoot /var/www/loomio/public

    <Directory /var/www/loomio/public>
        Options -Indexes +FollowSymLinks +ExecCGI
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog /var/log/loomio-error.log
    CustomLog /var/log/loomio-access.log combined

    # Proxy Settings
    ProxyPreserveHost On
    ProxyPass / http://localhost:3000/
    ProxyPassReverse / http://localhost:3000/
</VirtualHost>

Replace loomio.example.com with your own server name. Afterwards, restart Apache:

$ rcctl restart httpd

Nginx

If you are using Nginx, create a new virtual host configuration file:

$ nano /etc/nginx/http.d/loomio.conf

Then, add the following configuration to the file:

upstream loomio {
    server unix:/tmp/unicorn.sock fail_timeout=0;
}

server {
    listen   80;
    server_name loomio.example.com;
    root /var/www/loomio/public;

    location / {
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;

        proxy_pass http://loomio;
        break;
    }

    error_page 404 /404.html;
    error_page 500 502 503 504 /50x.html;

    # Proxy Settings
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

    access_log /var/log/loomio-access.log;
    error_log /var/log/loomio-error.log;
}

Replace loomio.example.com with your own server name. Afterwards, restart Nginx:

$ rcctl restart nginx

Step 5: Start the Loomio Server

To start the Loomio server, use the following command:

$ bundle exec unicorn -c /var/www/loomio/config/unicorn.rb

Alternatively, you can add this command to your system startup script so that the Loomio server is automatically started when your system boots.

Conclusion

In this tutorial, we have installed Loomio on OpenBSD along with required packages, set up PostgreSQL, and configured a web server. We hope that you have found this tutorial helpful and enjoy using Loomio to make collaborative decisions with your team.

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!