How to Install wger on OpenBSD

wger is a free, open-source web application to manage your personal fitness, nutrition, and health data.

If you want to use wger on your OpenBSD system, you can follow these steps:

Requirements

Installation

  1. Open the terminal on your OpenBSD system.

  2. Update the system's package manager:

    $ doas pkg_add -u
    
  3. Install the required packages:

    $ doas pkg_add -i gmake py3-pip postgresql-server postgresql-contrib
    
  4. Add PostgreSQL to the system's rc.conf file:

    $ doas rcctl enable postgresql
    $ doas rcctl start postgresql
    
  5. Create a PostgreSQL user and database for wger:

    $ doas su - postgres
    $ psql
    postgres=# CREATE USER wger WITH PASSWORD 'password';
    postgres=# CREATE DATABASE wger OWNER wger;
    postgres=# \q
    
  6. Install wger using pip:

    $ doas pip-3.8 install wger
    
  7. Run the database migrations:

    $ doas su - _wger
    $ wger migrate
    $ exit
    

Configuration

  1. Create a configuration file named wger.ini in the _wger user's home directory:

    $ doas su - _wger
    $ cp /usr/local/lib/python3.8/site-packages/wger/wsgi.ini wger.ini
    $ exit
    
  2. Edit the configuration file using your preferred text editor:

    $ doas nano /home/_wger/wger.ini
    
  3. Change the following lines in the configuration file:

    [server:main]
    use = egg:waitress#main
    host = 0.0.0.0  # Change to '127.0.0.1' if running locally only
    port = 8000
    
    [app:main]
    sqlalchemy.url = postgresql://wger:password@localhost:5432/wger
    
  4. Save and exit the configuration file.

Running wger

  1. Start the wger server:

    $ doas su - _wger
    $ wger serve --reload
    
  2. Open a web browser and go to http://localhost:8000/ (or the IP address of your server) to access the wger application.

Congratulations! You have successfully installed and configured wger on your OpenBSD system.

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!