Commit 748b42dc authored by jan.koester's avatar jan.koester
Browse files

florium: forum on libhttppp/libhtmlpp/libdbpp (mammut), fenrirds and mediadb

BB code via libvbulletinpp (submodule), categories/forums/threads with
quoting, editing, moderation, search; fenrirds accounts, groups and group
policies (global + per forum), e-mail verified registration (libsmtppp),
user control centre, avatars in fenrirds (FFmpeg -> WebP), images and logo
in mediadb, favicon from the logo, themes incl. FenrirOS with light/dark,
multiple domains (DOMAINS), setup wizard and administration on its own
HTTPS port, supervisor restart, Docker image on FenrirOS.

Co-Authored-By: default avatarClaude Opus 5.5 <noreply@anthropic.com>
parents
Loading
Loading
Loading
Loading
Loading

.dockerignore

0 → 100644
+3 −0
Changes for .dockerignore: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
build
build-docker
.git

.gitignore

0 → 100644
+2 −0
Changes for .gitignore: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
build/
build-docker/

.gitmodules

0 → 100644
+3 −0
Changes for .gitmodules: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
[submodule "libvbulletinpp"]
	path = libvbulletinpp
	url = git@git.tuxist.de:tuxist/libvbulletinpp.git

CMakeLists.txt

0 → 100644
+72 −0
Changes for CMakeLists.txt: 72 added lines, 0 removed lines.
Original line number Diff line number Diff line
cmake_minimum_required(VERSION 3.20)
project(florium CXX)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

include(GNUInstallDirs)

find_package(libhtmlpp REQUIRED)
find_package(libhttppp REQUIRED)
find_package(libnetplus REQUIRED)
find_package(libcmdplus REQUIRED)
find_package(libdbpp REQUIRED)
find_package(libconfplus REQUIRED)
find_package(libsmtppp REQUIRED)
find_package(FFmpeg REQUIRED)
find_package(json-c REQUIRED)
find_package(fenrirds REQUIRED)
find_package(libuuidp REQUIRED)
find_library(CRYPTO_LIBRARY crypto REQUIRED)
find_library(MEDIADB_CLIENT mediadb_client REQUIRED)

# BB code -> HTML: the installed package, otherwise the libvbulletinpp submodule
find_package(libvbulletinpp QUIET)
if(NOT libvbulletinpp_FOUND)
    set(VBULLETINPP_BUILD_TESTS OFF CACHE BOOL "" FORCE)
    set(VBULLETINPP_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
    add_subdirectory(libvbulletinpp EXCLUDE_FROM_ALL)
    add_library(vbulletinpp::vbulletinpp-static ALIAS vbulletinpp-static)
endif()

add_executable(florium
    src/main.cpp
    src/config.cpp
    src/db.cpp
    src/auth.cpp
    src/page.cpp
    src/forum.cpp
    src/admin.cpp
    src/ucp.cpp
    src/adminserver.cpp
    src/mail.cpp
    src/image.cpp
    src/media.cpp
)

target_link_libraries(florium PRIVATE
    vbulletinpp::vbulletinpp-static
    htmlpp::htmlpp
    httppp::httppp
    netplus::netplus
    cmdplus::cmdplus
    confplus::confplus
    dbpp::dbpp
    smtppp::smtppp
    FFmpeg::avcodec
    json-c::json-c
    FFmpeg::avutil
    FFmpeg::swscale
    fenrirds::client
    uuidp::uuidp
    ${MEDIADB_CLIENT}
    ${CRYPTO_LIBRARY}
)

install(TARGETS florium RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES share/layout.html share/florium.css share/florium.js
        DESTINATION ${CMAKE_INSTALL_DATADIR}/florium)
install(DIRECTORY share/themes DESTINATION ${CMAKE_INSTALL_DATADIR}/florium)
install(FILES docker/florium.yaml DESTINATION ${CMAKE_INSTALL_DATADIR}/florium/examples)

Dockerfile

0 → 100644
+89 −0
Changes for Dockerfile: 89 added lines, 0 removed lines.
Original line number Diff line number Diff line
# florium container image
#
#   build:    tuxist/fenriros-devel  (clang, cmake, ninja and the -devel packages of libhttppp,
#                                     libhtmlpp, libdbpp (+ mammut backend), libconfplus,
#                                     libcmdplus, the fenrirds client and the mediadb client)
#   runtime:  tuxist/fenriros        (minimal: systempp, fresh, rpm, dnf5)
#
#   git submodule update --init       # libvbulletinpp (BB code -> HTML)
#   docker build -t tuxist/florium .
#   docker compose up -d              # florium + mammut, see docker-compose.yml
#
# Without /etc/florium/florium.yaml florium starts its setup wizard on https://<host>:8081/
# (setup code in the container log), or the entrypoint writes the configuration from the
# FLORIUM_* environment variables (see docker/entrypoint.sh).
#
# --build-arg IMAGE_PREFIX=registry.tuxist.de/tuxist/ and FENRIROS_TAG select the base images
# (see DOCKER_PREFIX in systempp/build-chroot.sh).

ARG IMAGE_PREFIX=tuxist/
ARG FENRIROS_TAG=20261115

FROM ${IMAGE_PREFIX}fenriros-devel:${FENRIROS_TAG} AS build

WORKDIR /src/florium
COPY . .

RUN test -f libvbulletinpp/CMakeLists.txt || { echo "libvbulletinpp missing: git submodule update --init" >&2; exit 1; } \
 && cmake -S . -B build -G Ninja \
        -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DCMAKE_INSTALL_LIBDIR=lib \
 && cmake --build build --target florium \
 && DESTDIR=/stage cmake --install build \
 && install -Dm755 docker/entrypoint.sh /stage/usr/libexec/florium/entrypoint.sh

# fenriros only carries the base system, so copy the shared libraries florium needs
# (DT_NEEDED, resolved recursively against the build image) into the stage, plus what is
# dlopen()'d and so never shows up as DT_NEEDED: the confplus backends (YAML) and the
# libdbpp backends (mammut, sqlite).
RUN set -e; \
    find_lib() { for d in /usr/lib /lib /usr/local/lib; do [ -e "$d/$1" ] && { echo "$d/$1"; return 0; }; done; return 1; }; \
    todo=$(find /stage/usr/bin -type f); \
    mkdir -p /stage/usr/lib; \
    for d in confplus dbpp; do \
        [ -d /usr/lib/$d ] || continue; \
        cp -a /usr/lib/$d /stage/usr/lib/; \
        todo="$todo $(find /stage/usr/lib/$d -name '*.so*' -type f)"; \
    done; \
    seen=" "; \
    while [ -n "$todo" ]; do \
        next=""; \
        for f in $todo; do \
            for n in $(readelf -d "$f" 2>/dev/null | sed -n 's/.*(NEEDED).*\[\(.*\)\].*/\1/p'); do \
                case "$seen" in *" $n "*) continue ;; esac; \
                seen="$seen$n "; \
                [ -e "/stage/usr/lib/$n" ] && continue; \
                p=$(find_lib "$n") || { echo "warning: $n (needed by $f) not found" >&2; continue; }; \
                mkdir -p "/stage$(dirname "$p")"; \
                cp -L "$p" "/stage$p"; \
                next="$next /stage$p"; \
            done; \
        done; \
        todo=$next; \
    done

FROM ${IMAGE_PREFIX}fenriros:${FENRIROS_TAG}

# Libraries the base image already ships (libc, libc++, ...) must win over the build image's
# copies of the same files, so only fill in what is missing.
COPY --from=build /stage/ /stage/
RUN set -e; \
    cd /stage; \
    find . ! -type d | while read -r f; do \
        t="/${f#./}"; \
        case "$t" in /usr/lib/*.so*|/lib/*.so*) [ -e "$t" ] && continue ;; esac; \
        mkdir -p "$(dirname "$t")"; \
        cp -a "$f" "$t"; \
    done; \
    cd /; rm -rf /stage; \
    useradd florium; \
    mkdir -p /etc/florium

VOLUME ["/etc/florium"]
# forums (all domains) and the administration / setup wizard (HTTPS)
EXPOSE 8080 8081

ENTRYPOINT ["/usr/libexec/florium/entrypoint.sh"]
# confplus wants "<backend>:<path>"
CMD ["/usr/bin/florium", "-c", "yaml:/etc/florium/florium.yaml"]
Loading