Giter Club home page Giter Club logo

porla's Introduction


Porla

Porla is a powerful BitTorrent client with high performance and low memory usage. It is designed for headless operations on servers and seedboxes and can easily manage tens of thousands of torrents.

The focus of Porla is to provide a BitTorrent client that is fast, correct and extensible.


Features

  • Based on libtorrent with support for both BitTorrent v1 and v2.
  • Lua API for writing plugins and workflows.
  • Supports multiple, distinct sessions with different settings.
  • Embedded query language to find torrents. Fast.
  • HTTP API with JWT auth.
  • Modern web UI.

Plugins and workflows

The Lua API can be used to automate and integrate Porla with all types of applications and services, such as Discord and ntfy.sh.

Multiple sessions

You can easily set up multiple sessions to separate your public torrents from your private torrents, for example. Each session binds to its own network device and port pair, and can have custom rate limits, queueing rules, etc.

The Porla query language (PQL)

To make it easy to navigate and filter a large amount of torrents Porla has a simple, embedded query language named PQL.

With PQL you can easily find torrents matching specific criterias.

Getting started

Download the latest release and put it somewhere safe. Then, run it. By default, Porla bind the web UI to localhost:1337. On first use you will be prompted to set up a user account.

porla

To show all options available, suffix with --help.

porla --help

For example, you can run porla with an in-memory SQLite database by passing --db=:memory:.

porla --db=:memory:

Configuration

You can configure Porla in three ways - environment variables, command line arguments, and a TOML config file.

Command line arguments have the highest priority, then the config file, and lastly the environment variables. The app will, however, run without any applied configuration and use sensible defaults instead.

Environment variables and command line args

  • PORLA_CONFIG_FILE or --config-file - path to a TOML config file with additional configuration.
  • PORLA_DB or --db - path a file (which does not need to exist) that porla will use to store its state.
  • PORLA_HTTP_AUTH_DISABLED_YES_REALLY - set to true to disable HTTP JWT authentication (not recommended).
  • PORLA_HTTP_BASE_PATH or --http-base-path - set to a path where the HTTP parts of Porla will be served. Defaults to /.
  • PORLA_HTTP_HOST or --http-host - set to an IP address which to bind the HTTP server. Defaults to 127.0.0.1.
  • PORLA_HTTP_METRICS_ENABLED or --http-metrics-enabled - set to true/false to enable or disable the metrics endpoint. Defaults to true.
  • PORLA_HTTP_PORT or --http-port - set to the port to use for the HTTP server. Defaults to 1337.
  • PORLA_LOG_LEVEL or --log-level - the minimum log level to use. Valid values are trace, debug, info, warning, error, fatal. Defaults to info.
  • PORLA_SESSION_SETTINGS_BASE or --session-settings-base - the libtorrent settings base to use for session settings. Valid values are default, min_memory_usage, high_performance_seed. Defaults to default.
  • PORLA_STATE_DIR or --state-dir - a path to a directory where Porla will store its state.
  • PORLA_TIMER_DHT_STATS or --timer-dht-stats - the interval in milliseconds to push DHT stats. Defaults to 5000.
  • PORLA_TIMER_SESSION_STATS or --timer-session-stats - the interval in milliseconds to push session stats. Defaults to 5000.
  • PORLA_TIMER_TORRENT_UPDATES or --timer-torrent-updates - the interval in milliseconds to push torrent state updates. Defaults to 1000.
  • PORLA_WORKFLOW_DIR or --workflow-dir - the path to where Porla will load user workflows from.

Refer to the official documentation for information on how to set up the TOML configuration.

Development

Various bits and pieces of information regarding development.

Building

We try to make sure Porla is easy to get running directly from the Git repository. Dependencies are managed with vcpkg.

git clone --recursive https://github.com/porla/porla
cd porla
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -G Ninja
cmake --build build

You can also remove -G Ninja if you don't have Ninja available.

Updating the pre-built Dockerfile build environment

To reduce build times, we use a pre-built Docker layer with all the vcpkg dependencies already built. This needs to be updated whenever we update the vcpkg submodule or radically change the project structure.

Requires push access to the Porla container registry.

docker build -t porla-build-env -f Dockerfile.build-env .
docker tag porla-build-env ghcr.io/porla/build-env:<timestamp>
docker push ghcr.io/porla/build-env:<timestamp>

Generating ANTLR4 grammar source files

This is only needed when PorlaQueryLang.g4 is modified.

wget https://www.antlr.org/download/antlr-4.11.1-complete.jar
pushd src/query
java -jar ../../antlr-4.11.1-complete.jar -Dlanguage=Cpp -visitor -no-listener -o _aux PorlaQueryLang.g4
popd

porla's People

Contributors

dependabot[bot] avatar l1meju1ce avatar nuxencs avatar samip5 avatar smaugfm avatar userdocs avatar vktr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

porla's Issues

Maximum completed seeding and maximum active seeding.

I find torrent queuing to be a major problem with the popular clients today. Their wording and settings often don't make sense for the average user. This feature request would be for torrent queuing that supports a difference between the number of ACTIVELY (greater than X / kB/s) and completed torrents.

I.E.

1000 torrents completed, I allow in settings a max of 5 torrents to be actively seeding. While any new requests for connections are denied until the client is under 5 active again.

It would be painful to seed 500 torrents at 5kB/s instead of 5 at 500kB/s

Improve logging

Logging in Porla should be improved. The log should be improved upon in places where users interact with it the most, to help users understand why things fail.

`GLIBC_2.28' not found

Error: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by /content/node_modules/@porla/libtorrent/prebuilds/linux-x64/node-napi.node)

how to run it in docker?

I use this image node:10

  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by /app/node_modules/@porla/libtorrent/prebuilds/linux-x64/node-napi.node)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:807:18)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/app/node_modules/@porla/libtorrent/index.js:5:18)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)

index.js

const dashboard = require('@porla-contrib/dashboard');
 
const app = porla({
    plugins: [ dashboard({ port: 7090 }) ]
});
app.on('torrent.finished', ({ torrent }) => [
    sendMessage(`Torrent ${torrent.name} finished.`)
]);

Can't access the WebUI when running in Docker

I can't seem to connect to the WebUI when running porla (Porla v0.34.0) in Docker. EIther on Linux or on Windows with Docker Desktop. Both machines are amd64.

The website exists for sure, I just can't seem to connect to it with localhost:1337

image
image
image
image

Add Authentication solution to webui

The API has token auth available via unsecured webui. There are a few ways to approach this issue in the short and long terms

Short term - offload authentication to a SSO application like Authelia or using Basic Auth

Long term - Consider bets option to integrate auth into the webui for self contained deployment suing internal auth

webui.zip missing

Hi,

I'm trying to build a docker image for the linux/arm64 and linux/arm/v7 platorms but I run into problems of having a missing webui.zip. Where can I find that or am I doing something vastly wrong?

I'm cloning the project with: git clone --recursive https://github.com/porla/porla

Then running: docker buildx build --platform linux/arm/v7,linux/arm64 .

Then I get this:

[+] Building 1.6s (17/23)
 => [internal] load .dockerignore                                                                                                                                                          0.0s
 => => transferring context: 201B                                                                                                                                                          0.0s
 => [internal] load build definition from Dockerfile                                                                                                                                       0.0s
 => => transferring dockerfile: 829B                                                                                                                                                       0.0s
 => [linux/arm64 internal] load metadata for docker.io/library/alpine:3.17.0                                                                                                               0.5s
 => [linux/arm64 internal] load metadata for ghcr.io/porla/build-env:202302132234                                                                                                          0.4s
 => [linux/arm/v7 internal] load metadata for docker.io/library/alpine:3.17.0                                                                                                              0.5s
 => [linux/arm/v7 internal] load metadata for ghcr.io/porla/build-env:202302132234                                                                                                         0.5s
 => CACHED [linux/arm/v7 runtime 1/3] FROM docker.io/library/alpine:3.17.0@sha256:8914eb54f968791faf6a8638949e480fef81e697984fba772b3976835194c6d4                                         0.0s
 => => resolve docker.io/library/alpine:3.17.0@sha256:8914eb54f968791faf6a8638949e480fef81e697984fba772b3976835194c6d4                                                                     0.0s
 => [internal] load build context                                                                                                                                                          1.0s
 => => transferring context: 753.02kB                                                                                                                                                      1.0s
 => [linux/arm/v7 build-env 1/6] FROM ghcr.io/porla/build-env:202302132234@sha256:c76bfb7e03875113e775bde90b1c49bc8792e76c62318704e4bb4e01850a50dd                                         1.1s
 => => resolve ghcr.io/porla/build-env:202302132234@sha256:c76bfb7e03875113e775bde90b1c49bc8792e76c62318704e4bb4e01850a50dd                                                                0.0s
 => => sha256:7330a236e898f463b87f423c780f230dfc88121765338954dbdf959f56f77e76 6.29MB / 823.33MB                                                                                           1.0s
 => CACHED [linux/arm64 runtime 1/3] FROM docker.io/library/alpine:3.17.0@sha256:8914eb54f968791faf6a8638949e480fef81e697984fba772b3976835194c6d4                                          0.0s
 => => resolve docker.io/library/alpine:3.17.0@sha256:8914eb54f968791faf6a8638949e480fef81e697984fba772b3976835194c6d4                                                                     0.0s
 => [linux/arm64 build-env 1/6] FROM ghcr.io/porla/build-env:202302132234@sha256:c76bfb7e03875113e775bde90b1c49bc8792e76c62318704e4bb4e01850a50dd                                          0.0s
 => => resolve ghcr.io/porla/build-env:202302132234@sha256:c76bfb7e03875113e775bde90b1c49bc8792e76c62318704e4bb4e01850a50dd                                                                0.0s
 => CANCELED [linux/arm/v7 build-env 2/6] WORKDIR /src                                                                                                                                     0.0s
 => CACHED [linux/arm/v7 build-env 3/6] COPY . .                                                                                                                                           0.0s
 => ERROR [linux/arm/v7 build-env 4/6] COPY ./html/webui.zip /src/build/webui.zip                                                                                                          0.0s
 => CACHED [linux/arm64 build-env 2/6] WORKDIR /src                                                                                                                                        0.0s
 => CACHED [linux/arm64 build-env 3/6] COPY . .                                                                                                                                            0.0s
 => ERROR [linux/arm64 build-env 4/6] COPY ./html/webui.zip /src/build/webui.zip                                                                                                           0.0s
------
 > [linux/arm/v7 build-env 4/6] COPY ./html/webui.zip /src/build/webui.zip:
------
------
 > [linux/arm64 build-env 4/6] COPY ./html/webui.zip /src/build/webui.zip:
------
WARNING: No output specified with docker-container driver. Build result will only remain in the build cache. To push result image into registry use --push or to load image into docker use --load
Dockerfile:6
--------------------
   4 |
   5 |     COPY . .
   6 | >>> COPY ./html/webui.zip /src/build/webui.zip
   7 |
   8 |     RUN mkdir -p /src/build
--------------------
ERROR: failed to solve: failed to compute cache key: failed to calculate checksum of ref tymqcidi6cueyqssom0rta7n5::gsr0vd3dgh52rvd3duq89segf: "/html/webui.zip": not found

Add a `torrents.mutate` method to run bulk mutations

This method should work on the same SQL query as the torrents.query method, but you will also specify a mutation (or action) to perform on each torrent in the result set.

For example,

{
  "params": {
    "query": "select info_hash_v1,info_hash_v2 from torrents where name like 'ubuntu%'",
    "mutation": "move",
    "mutation_params": {
      "path": "/dl/linux/ubuntu-isos"
    }
  }
}

This would move all torrents with a name that starts with ubuntu to the path /dl/linux/ubuntu-isos.

Add base URL configuration

It will be required to be able to configure the base URL setting at some point to provide deployment behind reverse proxies and SSO configurations.

Considerations:

baseurl = /porla

Setting this dynamically could add unnecessary complexity to the code so we can consider other methods to provide a bootstrapped or pre configured option to the end user via workflows.

Make quotactl logging better

Right now it logs errno 3, which I think means that quota is not set up on the device. Make this better and only log real errors.

RSS feeds

Finally came across your project, exactly what I've been looking for.
My setup requires me to use RSS feeds to automate a number of "subscriptions".

Is this something that you would consider in-scope and would support, or should I write an external tool to handle my use case?
Thanks.

Add actions

Porla should support some kind of dynamic actions - user-specified things that run on certain events. Adding Duktape would provide a JS engine we can use for simple actions like

function init(porla) {
  porla.on("torrents:finished", function (torrent) {
    torrent.pause();
  });
}

This can then be configured in porla.toml,

[actions.pause-finished]
src = "path/to.js"

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.