Skip to content

spech66/lifelogbb

Repository files navigation

LifelogBB

Dotnet Workflow CodeQL Workflow

Lifelog - All your life related things in one place. Journal, weight, Strength training, endurance training tracker, Bucket list, Vision board, ....

This service is build for a single user. Password authentication is included for the sites and API endpoints.

All data is stored in a single SQLite database for full control and portability over the data.

Features

  • 🦄 Free open source software
  • ⚖️ Weight tracking
  • 📔 Journal
  • 🏋️ Strength training tracker
  • 🏃 Endurance training tracker
  • ✅ Todos
  • 🎯 Goals
  • 🚀 Habits
  • 🌄 Bucket list and Vision board
  • 📜 Quotes
  • 🛠️ RESTful API for all routes, Swagger UI
  • 📅 iCal feeds: Todo for Todos and Goals, Event for Habits (Time boxing/blocking)
  • ⚙️ Settings
  • 🖼 Tabler UI

TODO

Technical

  • 📦 Self hosting
  • 🔐 Authentication
  • 📂 SQLite database

Screenshots

Start Dashboard Weight Bucket List Vision Board

More screenshots

Run from docker

Clone the repository and run docker.

git clone https://github.com/spech66/lifelogbb.git
cd lifelogbb

Set database path to "/database" in the appsettings.

cd LifelogBb
docker build . -t lifelogbb
docker run -v lifelogbbdatabase:/database -p 80:80 -p 443:443 lifelogbb

Build and run from source

  • Install dotnet SDK 7.0 on Linux or Windows.
  • Install dotnet-ef for migrations dotnet tool install --global dotnet-ef
  • Checkout code (see below) or download the latest release
  • Adjust appsettings.Production.json to your needs
  • Create empty database file lifelogbb.db in the LifelogBb folder (or adjust appsettings.Production.json)
  • Create an empty file or use sqlite cli sqlite3 lifelogbb.db "VACUUM;"
  • Run migrations (see below)
  • Run dotnet watch in the LifelogBb folder
git clone https://github.com/spech66/lifelogbb.git
cd lifelogbb
cd LifelogBb
dotnet watch

Migrate database

All migrations are bundled in the efbundle file. Run it with the --connection argument. For Windows the efbundle is called efbundle.exe.

# Install dotnet-ef
dotnet tool install --global dotnet-ef | echo "already installed"

# Run efbundle
./efbundle --connection "Data Source=lifelogbb.db"

Dependencies

  • .NET 7.0 - .NET is a free, cross-platform, open source developer platform for building many different types of applications.
  • SQLite - SQLite is a C-language library that implements a small, fast, self-contained, high-reliability, full-featured, SQL database engine. SQLite is the most used database engine in the world.

Helpful tools

Configuration examples

appsettings.production.json

{
    "Logging": {
        "LogLevel": {
            "Default": "Information",
            "Microsoft.AspNetCore": "Warning"
        }
    },
    "Account": {
        "Password": "xxxx" // Generate on first run in the password dialog
    },
    "Database": {
        "Path": "/opt/lifelogbb/"
    },
    "Uploads": {
        "Path": "/opt/lifelogbb/uploads/"
    },
    "Authentication": {
        "Cookie": {
            "ExpireDays": "30"
        },
        "JwtToken": {
            "Issuer": "https://localhost:6067/",
            "Audience": "https://localhost:6067/",
            "SigningKey": "xxxxxxxx", // Generate e.g. openssl genrsa -out ./jwt.key 4096
            "TokenTimeoutMinutes": "60"
        }
    },
    "Kestrel": {
        "Endpoints": {
            "Http": {
                "Url": "http://localhost:6066"
            }
        }
    }
}

nginx

server {
    listen 443 ssl http2;
    listen       [::]:443 ssl http2;

    server_name lifelog.example.org;

    index index.html index.htm;

    ssl_certificate /etc/letsencrypt/live/lifelog.example.org/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/lifelog.example.org/privkey.pem;
    ssl_session_timeout 1d;
    ssl_session_cache shared:MozSSL:10m;  # about 40000 sessions
    ssl_session_tickets off;
    ssl_dhparam /etc/ssl/dhparam.pem;

    # intermediate configuration
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
    ssl_prefer_server_ciphers off;

    location / {
            proxy_pass http://localhost:6066; # Port of your appsettings
            proxy_http_version 1.1;
            proxy_set_header   Upgrade $http_upgrade;
            proxy_set_header   Connection keep-alive;
            proxy_set_header   Host $host;
            proxy_cache_bypass $http_upgrade;
            proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header   X-Forwarded-Proto $scheme;
    }
}

Service file

Assuming a release is installed in /var/www/lifelogbb and the www-data user has write access to the database. For enhanced security you can create a dedicated user for the service.

[Unit]
Description=LifelogBbDeamon

[Service]
WorkingDirectory=/var/www/lifelogbb
ExecStart=/usr/bin/dotnet /var/www/lifelogbb/LifelogBb.dll
Restart=always
# Restart service after 10 seconds if the dotnet service crashes:
RestartSec=10
KillSignal=SIGINT
SyslogIdentifier=dotnet-lifelogbb
User=www-data
Environment=ASPNETCORE_ENVIRONMENT=Production
Environment=DOTNET_PRINT_TELEMETRY_MESSAGE=false

[Install]
WantedBy=multi-user.target

Development

Clone the repository and either install Visual Studio or just the dotnet tools.

Run it by pressing F5 in Visual Studio or using the dotnet cli.

git clone https://github.com/spech66/lifelogbb.git
cd lifelogbb
cd LifelogBb
dotnet watch

Swagger UI at https://localhost:7290/Swagger/.

Generate database migrations using Add-Migration NAME.

Apply migrations using Update-Database.

Additional resources