From 723a94ce0ef81548d650df22664b1e5d441c3ce0 Mon Sep 17 00:00:00 2001 From: Stepan Usatiuk Date: Wed, 14 May 2025 18:11:53 +0200 Subject: [PATCH] update readme --- .dockerignore | 4 -- .github/workflows/server.yml | 113 +---------------------------------- Dockerfile | 35 ----------- Dockerfile.ci | 22 ------- README.md | 22 +++++-- docker-compose.example.yml | 25 -------- dockerentry.sh | 19 ------ launcher/.gitignore | 80 ------------------------- launcher/CMakeLists.txt | 26 -------- launcher/src/CMakeLists.txt | 7 --- launcher/src/LauncherApp.cpp | 58 ------------------ launcher/src/LauncherApp.h | 38 ------------ run-wrapper/update | 1 - 13 files changed, 21 insertions(+), 429 deletions(-) delete mode 100644 .dockerignore delete mode 100644 Dockerfile delete mode 100644 Dockerfile.ci delete mode 100644 docker-compose.example.yml delete mode 100644 dockerentry.sh delete mode 100644 launcher/.gitignore delete mode 100644 launcher/CMakeLists.txt delete mode 100644 launcher/src/CMakeLists.txt delete mode 100644 launcher/src/LauncherApp.cpp delete mode 100644 launcher/src/LauncherApp.h diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index 4c264a6c..00000000 --- a/.dockerignore +++ /dev/null @@ -1,4 +0,0 @@ -**/.parcel-cache -**/dist -**/node_modules -**/target diff --git a/.github/workflows/server.yml b/.github/workflows/server.yml index 50d8708e..5af05ba3 100644 --- a/.github/workflows/server.yml +++ b/.github/workflows/server.yml @@ -7,12 +7,6 @@ on: pull_request: branches: ["main"] -env: - # Use docker.io for Docker Hub if empty - REGISTRY: ghcr.io - # github.repository as / - IMAGE_NAME: ${{ github.repository }} - jobs: build-dhfs: runs-on: ubuntu-latest @@ -49,9 +43,6 @@ jobs: - name: Test with Maven run: cd dhfs-parent && mvn -T $(nproc) --batch-mode --update-snapshots package verify javadoc:aggregate - # - name: Build with Maven - # run: cd dhfs-parent && mvn --batch-mode --update-snapshots package # -Dquarkus.log.category.\"com.usatiuk.dhfs\".min-level=DEBUG - - uses: actions/upload-artifact@v4 with: name: DHFS Server Package @@ -92,107 +83,10 @@ jobs: name: Webui path: webui/dist - publish-docker: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - # This is used to complete the identity challenge - # with sigstore/fulcio when running outside of PRs. - id-token: write - - needs: [build-webui, build-dhfs] - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Download server package - uses: actions/download-artifact@v4 - with: - name: DHFS Server Package - path: dhfs-package-downloaded - - - name: Download webui - uses: actions/download-artifact@v4 - with: - name: Webui - path: webui-dist-downloaded - - - name: Show all the files - run: find . - - # Install the cosign tool except on PR - # https://github.com/sigstore/cosign-installer - - name: Install cosign - if: github.event_name != 'pull_request' - uses: sigstore/cosign-installer@v3.5.0 - with: - cosign-release: "v2.2.4" - - # Set up BuildKit Docker container builder to be able to build - # multi-platform images and export cache - # https://github.com/docker/setup-buildx-action - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - # Login against a Docker registry except on PR - # https://github.com/docker/login-action - - name: Log into registry ${{ env.REGISTRY }} - if: github.event_name != 'pull_request' - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - # Extract metadata (tags, labels) for Docker - # https://github.com/docker/metadata-action - - name: Extract Docker metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - - # Build and push Docker image with Buildx (don't push on PR) - # https://github.com/docker/build-push-action - - name: Build and push Docker image - id: build-and-push - uses: docker/build-push-action@v5 - with: - context: . - file: ./Dockerfile.ci - push: ${{ github.event_name != 'pull_request' }} - platforms: linux/amd64,linux/arm64 - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max - - # Sign the resulting Docker image digest except on PRs. - # This will only write to the public Rekor transparency log when the Docker - # repository is public to avoid leaking data. If you would like to publish - # transparency data even for private images, pass --force to cosign below. - # https://github.com/sigstore/cosign - - name: Sign the published Docker image - if: ${{ github.event_name != 'pull_request' }} - env: - # https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable - TAGS: ${{ steps.meta.outputs.tags }} - DIGEST: ${{ steps.build-and-push.outputs.digest }} - # This step uses the identity token to provision an ephemeral certificate - # against the sigstore community Fulcio instance. - run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST} - publish-run-wrapper: runs-on: ubuntu-latest permissions: contents: read - packages: write - # This is used to complete the identity challenge - # with sigstore/fulcio when running outside of PRs. - id-token: write needs: [build-webui, build-dhfs] @@ -260,13 +154,12 @@ jobs: - name: Setup Pages uses: actions/configure-pages@v5 + - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: - # Upload entire repository - path: 'dhfs-javadocs-downloaded' + path: "dhfs-javadocs-downloaded" + - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4 - - diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index d24b7a13..00000000 --- a/Dockerfile +++ /dev/null @@ -1,35 +0,0 @@ -FROM node:20-bullseye as webui-build - -WORKDIR /usr/src/app/webui-build -COPY ./webui/package*.json ./ -RUN npm i -COPY ./webui/. . -RUN npm run build - -FROM azul/zulu-openjdk:21 as server-build - -WORKDIR /usr/src/app/server-build -COPY ./server/.mvn .mvn -COPY ./server/mvnw ./server/pom.xml ./ -RUN ./mvnw quarkus:go-offline -# The previous thing still doesn't download 100% everything -RUN ./mvnw -Dmaven.test.skip=true -Dskip.unit=true package --fail-never -COPY ./server/. . -RUN ./mvnw -Dmaven.test.skip=true -Dskip.unit=true clean package - -FROM azul/zulu-openjdk-alpine:21-jre-headless - -RUN apk update && apk add fuse && rm -rf /var/cache/apk/* - -WORKDIR /usr/src/app -COPY --from=server-build /usr/src/app/server-build/target/quarkus-app/. . -RUN mkdir -p webui -COPY --from=webui-build /usr/src/app/webui-build/dist/. ./webui - -ENV dhfs_webui_root=/usr/src/app/webui - -COPY ./dockerentry.sh . - -RUN ["chmod", "+x", "./dockerentry.sh"] - -CMD [ "./dockerentry.sh" ] \ No newline at end of file diff --git a/Dockerfile.ci b/Dockerfile.ci deleted file mode 100644 index 98764f20..00000000 --- a/Dockerfile.ci +++ /dev/null @@ -1,22 +0,0 @@ -FROM azul/zulu-openjdk:21-jre-headless - -RUN apt update && apt install -y libfuse2 && apt-get clean - -WORKDIR /usr/src/app - -COPY ./dhfs-package-downloaded/lib . -COPY ./dhfs-package-downloaded/*.jar . -COPY ./dhfs-package-downloaded/app . -COPY ./dhfs-package-downloaded/quarkus . - -WORKDIR /usr/src/app/webui -COPY ./webui-dist-downloaded/. . - -ENV dhfs_webui_root=/usr/src/app/webui - -WORKDIR /usr/src/app -COPY ./dockerentry.sh . - -RUN ["chmod", "+x", "./dockerentry.sh"] - -CMD [ "./dockerentry.sh" ] \ No newline at end of file diff --git a/README.md b/README.md index 55caef32..6da35259 100644 --- a/README.md +++ b/README.md @@ -14,21 +14,29 @@ Syncthing and allowing you to stream your files like Google Drive File Stream This is a simple wrapper around the jar/web ui distribution that allows you to run/stop the DHFS server in the background, and update itself (hopefully!) +There will be 3 folders: + +- `app` contains the application +- `data` contains the filesystem data storage +- `fuse` is the default filesystem mount point (not on Windows) + ## How to use it? ### General prerequisites -Java should be available as `java` in path, and Java 21+ is required. +Java should be available as `java` in `PATH`, and Java 21+ is required. FUSE 2 userspace library also should be available: -- On Ubuntu `libfuse2` package can be installed. +- On Ubuntu `libfuse2` package can be installed, or a analogous package for other distributions. - On Windows, [WinFsp](https://winfsp.dev/) should be installed. - On macOS, [macFUSE](https://macfuse.github.io/). -In the run-wrapper, 3 scripts are available. +### How to run it? + +In the run-wrapper `app` folder, 3 scripts are available. - `run` script starts the filesystem - `stop` script stops it @@ -36,6 +44,8 @@ In the run-wrapper, 3 scripts are available. On Windows, Powershell alternatives should be used. For them to work, it might be required to allow execution of unsigned scripts using `set-executionpolicy unrestricted`. +### Additional options + Additional options for the filesystem can be specified in the `extra-opts` file in the same directory with the run scripts. One line in the `extra-opts` file corresponds to one option passed to the JVM when starting the filesystem. @@ -48,4 +58,8 @@ Some extra possible configuration options are: On Windows, the entire space for the filesystem should also be preallocated, the `-Ddhfs.objects.persistence.lmdb.size=` option controls the size (the value is in bytes), on Windows the default is 100 GB. -Then, a web interface will be available at `losthost:8080`, that can be used to connect with other peers. +In case of errors, the standard output is redirected to `quarkus.log` in the `app` folder, on Windows the error output is separate. + +### How to connect to other peers? + +Then, a web interface will be available at `losthost:8080`, that can be used to connect with other peers. Peers on local network should be available to be connected automatically. diff --git a/docker-compose.example.yml b/docker-compose.example.yml deleted file mode 100644 index 3ce57c2b..00000000 --- a/docker-compose.example.yml +++ /dev/null @@ -1,25 +0,0 @@ -version: "3.2" - -services: - dhfs1: - # image: ghcr.io/usatiuk/dhfs:main - build: . - privileged: true - devices: - - /dev/fuse - command: "./dockerentry.sh -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5010 -Ddhfs.objects.autosync.download-all=true" - ports: - - 8080:8080 - - 8081:8443 - - 5005:5005 - dhfs2: - # image: ghcr.io/usatiuk/dhfs:main - build: . - privileged: true - devices: - - /dev/fuse - command: "./dockerentry.sh -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5010 -Ddhfs.objects.autosync.download-all=true" - ports: - - 8090:8080 - - 8091:8443 - - 5010:5010 diff --git a/dockerentry.sh b/dockerentry.sh deleted file mode 100644 index 319f9471..00000000 --- a/dockerentry.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -set -e || true -set -u || true -set -o pipefail || true -set -x || true - -exec java \ - -Xmx512M \ - --add-exports java.base/sun.nio.ch=ALL-UNNAMED \ - --add-exports java.base/jdk.internal.access=ALL-UNNAMED \ - -Ddhfs.objects.persistence.files.root=/dhfs_root/p \ - -Ddhfs.objects.root=/dhfs_root/d \ - -Ddhfs.fuse.root=/dhfs_root_fuse \ - -Dquarkus.http.host=0.0.0.0 \ - -Ddhfs.objects.ref_verification=false \ - -Dquarkus.log.category.\"com.usatiuk.dhfs\".level=$DHFS_LOGLEVEL \ - "$@" \ - -jar quarkus-run.jar diff --git a/launcher/.gitignore b/launcher/.gitignore deleted file mode 100644 index 2863a0bd..00000000 --- a/launcher/.gitignore +++ /dev/null @@ -1,80 +0,0 @@ -# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider -# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 - -# User-specific stuff -.idea/**/workspace.xml -.idea/**/tasks.xml -.idea/**/usage.statistics.xml -.idea/**/dictionaries -.idea/**/shelf - -# AWS User-specific -.idea/**/aws.xml - -# Generated files -.idea/**/contentModel.xml - -# Sensitive or high-churn files -.idea/**/dataSources/ -.idea/**/dataSources.ids -.idea/**/dataSources.local.xml -.idea/**/sqlDataSources.xml -.idea/**/dynamic.xml -.idea/**/uiDesigner.xml -.idea/**/dbnavigator.xml - -# Gradle -.idea/**/gradle.xml -.idea/**/libraries - -# Gradle and Maven with auto-import -# When using Gradle or Maven with auto-import, you should exclude module files, -# since they will be recreated, and may cause churn. Uncomment if using -# auto-import. -# .idea/artifacts -# .idea/compiler.xml -# .idea/jarRepositories.xml -# .idea/modules.xml -# .idea/*.iml -# .idea/modules -# *.iml -# *.ipr - -# CMake -cmake-build-*/ -build/ - -# Mongo Explorer plugin -.idea/**/mongoSettings.xml - -# File-based project format -*.iws - -# IntelliJ -out/ - -# mpeltonen/sbt-idea plugin -.idea_modules/ - -# JIRA plugin -atlassian-ide-plugin.xml - -# Cursive Clojure plugin -.idea/replstate.xml - -# SonarLint plugin -.idea/sonarlint/ - -# Crashlytics plugin (for Android Studio and IntelliJ) -com_crashlytics_export_strings.xml -crashlytics.properties -crashlytics-build.properties -fabric.properties - -# Editor-based Rest Client -.idea/httpRequests - -# Android studio 3.1+ serialized cache file -.idea/caches/build_file_checksums.ser - -Testing diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt deleted file mode 100644 index ffa1261d..00000000 --- a/launcher/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -cmake_minimum_required(VERSION 3.10) -project(launcher) - -if (SANITIZE STREQUAL "YES") - message(WARNING "Enabling sanitizers!") - add_compile_options(-Wall -Wextra -pedantic -Wshadow -Wformat=2 -Wfloat-equal -D_GLIBCXX_DEBUG -Wconversion -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2) - add_compile_options(-fsanitize=address -fsanitize=undefined -fno-sanitize-recover) - add_link_options(-fsanitize=address -fsanitize=undefined -fno-sanitize-recover) -endif () - -if (CMAKE_BUILD_TYPE STREQUAL "Release") - add_compile_options(-flto) - add_link_options(-flto) -endif () - -if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug") - add_compile_options(-O3) - add_link_options(-O3) -endif () - -find_package(wxWidgets REQUIRED COMPONENTS net core base) -if (wxWidgets_USE_FILE) # not defined in CONFIG mode - include(${wxWidgets_USE_FILE}) -endif () - -add_subdirectory(src) \ No newline at end of file diff --git a/launcher/src/CMakeLists.txt b/launcher/src/CMakeLists.txt deleted file mode 100644 index 292298b4..00000000 --- a/launcher/src/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - -add_executable(launcher - LauncherApp.cpp -) -target_link_libraries(launcher ${wxWidgets_LIBRARIES}) diff --git a/launcher/src/LauncherApp.cpp b/launcher/src/LauncherApp.cpp deleted file mode 100644 index fd7a9d11..00000000 --- a/launcher/src/LauncherApp.cpp +++ /dev/null @@ -1,58 +0,0 @@ -// -// Created by Stepan Usatiuk on 11.07.2024. -// - -// For compilers that don't support precompilation, include "wx/wx.h" -#include "wx/wxprec.h" - -#ifndef WX_PRECOMP -# include "wx/wx.h" -#endif - -#include "wx/notebook.h" - -#include "LauncherApp.h" - -#include "wx/taskbar.h" - -IMPLEMENT_APP(LauncherApp) - -// This is executed upon startup, like 'main()' in non-wxWidgets programs. -bool LauncherApp::OnInit() { - wxFrame* frame = new MainFrame(_T("DHFS Launcher"), wxDefaultPosition); - frame->CreateStatusBar(); - frame->SetStatusText(_T("Hello World")); - frame->Show(true); - SetTopWindow(frame); - - wxTaskBarIcon* tb = new wxTaskBarIcon(); - auto img = new wxImage(32, 32, false); - img->Clear(128); - tb->SetIcon(*(new wxBitmapBundle(*(new wxBitmap(*img)))), "e"); - - return true; -} - -BEGIN_EVENT_TABLE(MainFrame, wxFrame) - EVT_BUTTON(BUTTON_Hello, MainFrame::OnExit) // Tell the OS to run MainFrame::OnExit when -END_EVENT_TABLE() // The button is pressed - -MainFrame::MainFrame(const wxString& title, const wxPoint& pos) - : wxFrame((wxFrame*) NULL, -1, title, pos) { - Notebook = new wxNotebook(this, NOTEBOOK_Main); - - Panel = new wxPanel(Notebook); - Panel2 = new wxPanel(Notebook); - Notebook->AddPage(Panel, "Hello"); - Notebook->AddPage(Panel2, "Hello2"); - - Panel->SetBackgroundColour(wxColour(0xFF0000)); - - HelloWorld = new wxButton(Panel, BUTTON_Hello, _T("Hello World"), - // shows a button on this window - wxDefaultPosition, wxDefaultSize, 0); // with the text "hello World" -} - -void MainFrame::OnExit(wxCommandEvent& event) { - Close(TRUE); -} diff --git a/launcher/src/LauncherApp.h b/launcher/src/LauncherApp.h deleted file mode 100644 index 7d019b89..00000000 --- a/launcher/src/LauncherApp.h +++ /dev/null @@ -1,38 +0,0 @@ -// -// Created by Stepan Usatiuk on 11.07.2024. -// - -#ifndef HELLOWORLDAPP_H -#define HELLOWORLDAPP_H - -// The HelloWorldApp class. This class shows a window -// containing a statusbar with the text "Hello World" -class LauncherApp : public wxApp { -public: - virtual bool OnInit(); -}; - -class MainFrame : public wxFrame // MainFrame is the class for our window, -{ - // It contains the window and all objects in it -public: - MainFrame(const wxString& title, const wxPoint& pos); - - wxButton* HelloWorld; - wxNotebook* Notebook; - wxPanel *Panel; - wxPanel *Panel2; - - void OnExit(wxCommandEvent& event); - - DECLARE_EVENT_TABLE() -}; - -enum { - BUTTON_Hello = wxID_HIGHEST + 1, // declares an id which will be used to call our button - NOTEBOOK_Main = wxID_HIGHEST + 2 // declares an id which will be used to call our button -}; - -DECLARE_APP(LauncherApp) - -#endif //HELLOWORLDAPP_H diff --git a/run-wrapper/update b/run-wrapper/update index 9f9325c5..094d0d82 100755 --- a/run-wrapper/update +++ b/run-wrapper/update @@ -14,7 +14,6 @@ if [ -f "$PIDFILE" ]; then fi fi -# 💀 LATEST=$(curl "https://api.github.com/repos/usatiuk/dhfs/actions/runs?branch=main&status=completed&per_page=1" | tr -d "[:space:]" | sed -n "s/.*\[{\"id\":\([0-9]*\).*/\1/p") echo Latest: $LATEST