Code Monkey home page Code Monkey logo

lifelogbb's Introduction

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

lifelogbb's People

Contributors

spech66 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

lifelogbb's Issues

Docker build error 18.08 CSC : error CS5001: Program does not contain a static 'Main' method suitable for an entry point [/src/LifelogBb/LifelogBb.csproj]

I just tried to install the docker version, but I'm getting the below during the build proces. Im running it on a Debian OS:

5.10.0-26-amd64 #1 SMP Debian 5.10.197-1 (2023-09-29) x86_64 GNU/Linux

Build log:

[+] Building 123.9s (15/17)                                                                                                                                                                    docker:default
 => [internal] load .dockerignore                                                                                                                                                                        0.0s
 => => transferring context: 2B                                                                                                                                                                          0.0s
 => [internal] load build definition from Dockerfile                                                                                                                                                     0.0s
 => => transferring dockerfile: 714B                                                                                                                                                                     0.0s
 => [internal] load metadata for mcr.microsoft.com/dotnet/sdk:7.0                                                                                                                                        0.4s
 => [internal] load metadata for mcr.microsoft.com/dotnet/aspnet:7.0                                                                                                                                     0.4s
 => [build 1/7] FROM mcr.microsoft.com/dotnet/sdk:7.0@sha256:6b9c857a60b67f968fd5bae373e414690947b8b58e7951b3228fd712b82938e8                                                                           42.7s
 => => resolve mcr.microsoft.com/dotnet/sdk:7.0@sha256:6b9c857a60b67f968fd5bae373e414690947b8b58e7951b3228fd712b82938e8                                                                                  0.1s
 => => sha256:6b9c857a60b67f968fd5bae373e414690947b8b58e7951b3228fd712b82938e8 1.79kB / 1.79kB                                                                                                           0.0s
 => => sha256:8735e8a035f1e0570dfb1445a77796553303551a1e82d5a2b6d50361b0251182 2.01kB / 2.01kB                                                                                                           0.0s
 => => sha256:8708e7f49f5ee03721b3a7cd08fcac0aa438a3bf13b7a4bf724b09a28531227a 5.31kB / 5.31kB                                                                                                           0.0s
 => => sha256:33fea50aa175135c2055291e1b467357bb9966df295a268ee223c04502808566 32.46MB / 32.46MB                                                                                                         4.8s
 => => sha256:f1a16b642b9ba3749153bc3b7a94febdd7c29f4a8b1117e1b6a34d64a075ba0e 154B / 154B                                                                                                               0.5s
 => => sha256:bb235668063aeb3b34222b7ed334c4896a8969ee05e2e9678bc700b3cfc81030 10.12MB / 10.12MB                                                                                                         4.4s
 => => sha256:afe0786398bf4a067bc9472f25a7193bc85427c74c519c09c14b797a400d4da3 25.38MB / 25.38MB                                                                                                         9.8s
 => => sha256:5ee0f6f05da7b7a3bfbdbb30450063efe9645986df6328d3e609544ff70c8d5e 181.06MB / 181.06MB                                                                                                      24.8s
 => => extracting sha256:33fea50aa175135c2055291e1b467357bb9966df295a268ee223c04502808566                                                                                                              118.4s
 => => sha256:8bc34004474621cb8a5a861be1e20661554d6d7fd3aa1788e07cd091125d6d53 13.97MB / 13.97MB                                                                                                        11.4s
 => => extracting sha256:bb235668063aeb3b34222b7ed334c4896a8969ee05e2e9678bc700b3cfc81030                                                                                                              115.9s
 => => extracting sha256:afe0786398bf4a067bc9472f25a7193bc85427c74c519c09c14b797a400d4da3                                                                                                                4.2s
 => => extracting sha256:5ee0f6f05da7b7a3bfbdbb30450063efe9645986df6328d3e609544ff70c8d5e                                                                                                               15.8s
 => => extracting sha256:8bc34004474621cb8a5a861be1e20661554d6d7fd3aa1788e07cd091125d6d53                                                                                                                1.3s
 => [internal] load build context                                                                                                                                                                        0.1s
 => => transferring context: 16.21kB                                                                                                                                                                     0.0s
 => [base 1/2] FROM mcr.microsoft.com/dotnet/aspnet:7.0@sha256:9658a001bc235f15d2d7f3a68f90cb1897f2fdc3e2e74161605c076d3472e39c                                                                          8.7s
 => => resolve mcr.microsoft.com/dotnet/aspnet:7.0@sha256:9658a001bc235f15d2d7f3a68f90cb1897f2fdc3e2e74161605c076d3472e39c                                                                               0.1s
 => => sha256:9658a001bc235f15d2d7f3a68f90cb1897f2fdc3e2e74161605c076d3472e39c 1.79kB / 1.79kB                                                                                                           0.0s
 => => sha256:48db698e04b79ef02519a0e15957cbe51f42473679d23a434e371555237934d8 1.37kB / 1.37kB                                                                                                           0.0s
 => => sha256:e064f572da944c2c04303aaf8fdcacd7dd016473edbbbdf69b0b6e9b3d2a7f40 2.35kB / 2.35kB                                                                                                           0.0s
 => => sha256:33fea50aa175135c2055291e1b467357bb9966df295a268ee223c04502808566 32.46MB / 32.46MB                                                                                                         4.8s
 => => sha256:f1a16b642b9ba3749153bc3b7a94febdd7c29f4a8b1117e1b6a34d64a075ba0e 154B / 154B                                                                                                               0.5s
 => => sha256:bb235668063aeb3b34222b7ed334c4896a8969ee05e2e9678bc700b3cfc81030 10.12MB / 10.12MB                                                                                                         4.4s
 => => extracting sha256:33fea50aa175135c2055291e1b467357bb9966df295a268ee223c04502808566                                                                                                                2.3s
 => => extracting sha256:f1a16b642b9ba3749153bc3b7a94febdd7c29f4a8b1117e1b6a34d64a075ba0e                                                                                                                0.0s
 => => extracting sha256:bb235668063aeb3b34222b7ed334c4896a8969ee05e2e9678bc700b3cfc81030                                                                                                                1.1s
 => [base 2/2] WORKDIR /app                                                                                                                                                                              3.3s
 => [final 1/2] WORKDIR /app                                                                                                                                                                             1.0s
 => [build 2/7] WORKDIR /src                                                                                                                                                                            14.7s
 => [build 3/7] COPY [LifelogBb.csproj, LifelogBb/]                                                                                                                                                      0.3s
 => [build 4/7] RUN dotnet restore LifelogBb/LifelogBb.csproj                                                                                                                                           45.8s
 => [build 5/7] COPY . .                                                                                                                                                                                 0.6s
 => [build 6/7] WORKDIR /src/LifelogBb                                                                                                                                                                   0.1s
 => ERROR [build 7/7] RUN dotnet build "LifelogBb.csproj" -c Release -o /app/build                                                                                                                      19.1s
------
 > [build 7/7] RUN dotnet build "LifelogBb.csproj" -c Release -o /app/build:
1.179 MSBuild version 17.7.4+3ebbd7c49 for .NET
4.996   Determining projects to restore...
6.455   All projects are up-to-date for restore.
18.08 CSC : error CS5001: Program does not contain a static 'Main' method suitable for an entry point [/src/LifelogBb/LifelogBb.csproj]
18.18
18.18 Build FAILED.
18.18
18.18 CSC : error CS5001: Program does not contain a static 'Main' method suitable for an entry point [/src/LifelogBb/LifelogBb.csproj]
18.18     0 Warning(s)
18.18     1 Error(s)
18.18
18.18 Time Elapsed 00:00:16.56
------
Dockerfile:14
--------------------
  12 |     COPY . .
  13 |     WORKDIR "/src/LifelogBb"
  14 | >>> RUN dotnet build "LifelogBb.csproj" -c Release -o /app/build
  15 |
  16 |     FROM build AS publish
--------------------
ERROR: failed to solve: process "/bin/sh -c dotnet build \"LifelogBb.csproj\" -c Release -o /app/build" did not complete successfully: exit code: 1

My Dockerfile:

#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
WORKDIR /src
COPY ["LifelogBb.csproj", "LifelogBb/"]
RUN dotnet restore LifelogBb/LifelogBb.csproj
COPY . .
WORKDIR "/src/LifelogBb"
RUN dotnet build "LifelogBb.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "LifelogBb.csproj" -c Release -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "LifelogBb.dll"]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.