diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 5171e9d..0000000 --- a/.drone.yml +++ /dev/null @@ -1,86 +0,0 @@ -# -# Drone pipeline to build Docker image. -# - -kind: pipeline -type: docker -name: default - -steps: - -- name: build-only - image: plugins/docker - settings: - repo: ${DRONE_REPO_NAMESPACE}/${DRONE_REPO_NAME##docker-} - build_args: - - DOCKER_IMAGE_VERSION=drone-ci - dry_run: true - when: - ref: - exclude: - - refs/tags/v* - -- name: set-docker-tags - image: alpine - commands: - # Always tag the Docker image with the Git tag (i.e. vX.Y.Z). - - printf "${DRONE_TAG}" >> .tags - # Tag the Docker image with with 'latest' only if not a prerelease. - - printf "${DRONE_TAG}" | grep -q '-' || printf ",latest" >> .tags - when: - ref: - - refs/tags/v* - -- name: build-and-push - image: plugins/docker - settings: - repo: ${DRONE_REPO_NAMESPACE}/${DRONE_REPO_NAME##docker-} - username: - from_secret: dockerhub_username - password: - from_secret: dockerhub_password - build_args: - - DOCKER_IMAGE_VERSION=${DRONE_TAG:1} - when: - ref: - - refs/tags/v* - -- name: push-dockerhub-readme - image: jlesage/drone-push-readme - settings: - repo: ${DRONE_REPO_NAMESPACE}/${DRONE_REPO_NAME##docker-} - username: - from_secret: dockerhub_username - password: - from_secret: dockerhub_password - readme: DOCKERHUB.md - when: - ref: - - refs/tags/v* - -- name: microbadger - image: plugins/webhook - settings: - urls: - from_secret: microbadger_webhook - failure: ignore - when: - ref: - - refs/tags/v* - -- name: notification - image: plugins/pushover - settings: - message: "{{ repo.owner }}/{{ repo.name }}#{{ truncate build.commit 8 }} ({{ build.branch }}) by {{ build.author }} - {{ build.message }}" - token: - from_secret: pushover_token - user: - from_secret: pushover_user - failure: ignore - when: - event: - exclude: - - pull_request - status: - - success - - failure diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 90277b8..653ccc4 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -9,4 +9,4 @@ community_bridge: # Replace with a single Community Bridge project-name e.g., cl liberapay: # Replace with a single Liberapay username issuehunt: # Replace with a single IssueHunt username otechie: # Replace with a single Otechie username -custom: https://paypal.me/JocelynLeSage/0usd +custom: ["https://paypal.me/JocelynLeSage", "https://www.tesla.com/referral/jocelyn4590"] diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml new file mode 100644 index 0000000..980fcd5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -0,0 +1,93 @@ +name: Bug report +description: File a bug report. +title: "[Bug] Provide a short description of the bug here" +labels: ["bug"] +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill out this bug report! + - type: textarea + attributes: + label: Current Behavior + description: A concise description of what you're experiencing. + validations: + required: true + - type: textarea + attributes: + label: Expected Behavior + description: A concise description of what you expected to happen. + validations: + required: false + - type: textarea + attributes: + label: Steps To Reproduce + description: Steps to reproduce the behavior. + validations: + required: false + - type: textarea + attributes: + label: Environment + description: | + Provide details about the host running the container. + Examples: + - Operating system (e.g. Ubuntu, Windows, TrueNAS, openmediavault, unRAID, etc). + - Version of the operating system. + - CPU architecture (x86-64, arm, arm64, etc). + - Model of the device, if applicable (e.g. Raspberry Pi 4B, Synology DS418, QNAP TS-364, etc). + - The Docker version (output of `docker version`). + - Anything else specific to your environment. Examples: + - Network share (NFS, CIFS) mapped to the container. + - Docker running in LXC container. + - etc. + - If applicable, how the UI provided by the container is access: + - Browser (Chrome, Firefox, Edge, etc). + - Version of the browser. + - OS of the browser. + - Is the container accessed through a reverse proxy. + - etc. + value: | + - OS: + - OS version: + - CPU: + - Docker version: + - Device model: + - Browser/OS: + validations: + required: false + - type: textarea + attributes: + label: Container creation + description: | + How did you create the container ? + Examples: + - The `docker run` command used. + - The compose file used. + - Screenshots of the management tool UI (e.g. Portainer, unRAID, etc) showing container settings. + validations: + required: true + - type: textarea + attributes: + label: Container log + description: Please copy/paste the output of `docker logs `. + render: text + validations: + required: true + - type: textarea + attributes: + label: Container inspect + description: | + If the container is running, please provide the output of `docker inspect `. + **Attention**: If you defined passwords, secrets or any sensitive information via environment variables, make sure to remove them from the output. + render: text + validations: + required: false + - type: textarea + attributes: + label: Anything else? + description: | + Anything that will give more context about the issue you are encountering. + + Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in. + validations: + required: false diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml new file mode 100644 index 0000000..15f254c --- /dev/null +++ b/.github/ISSUE_TEMPLATE/config.yml @@ -0,0 +1,8 @@ +blank_issues_enabled: false +contact_links: + - name: Ask a question, discuss + url: https://github.com/jlesage/docker-jdownloader-2/discussions + about: Get help using this Docker container. + - name: Documentation + url: https://github.com/jlesage/docker-jdownloader-2#readme + about: Documentation about this Docker container. diff --git a/.github/ISSUE_TEMPLATE/feature-request.yml b/.github/ISSUE_TEMPLATE/feature-request.yml new file mode 100644 index 0000000..527b3f0 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-request.yml @@ -0,0 +1,16 @@ +name: Feature request +description: Suggest an idea for this project. +title: "[Feature request] Provide a short description of the feature here" +labels: ["enhancement"] +body: + - type: markdown + attributes: + value: | + Thank you for suggesting an idea to make this project better. + - type: textarea + attributes: + label: Idea + description: | + Please describe the desired behavior, pitch your idea, or suggest improvements. + validations: + required: true diff --git a/.github/workflows/build-image.yml b/.github/workflows/build-image.yml new file mode 100644 index 0000000..6765be7 --- /dev/null +++ b/.github/workflows/build-image.yml @@ -0,0 +1,159 @@ +name: Docker image CI/CD + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +env: + DOCKER_IMAGE_NAME: jlesage/jdownloader-2 + PLATFORMS: linux/amd64,linux/386,linux/arm64/v8 + +on: + push: + branches: '*' + tags: + - v[0-9][0-9].[0-9][0-9].[0-9]+ + - v[0-9][0-9].[0-9][0-9].[0-9]+-pre.[0-9]+ + pull_request: + +jobs: + build: + name: Build image + runs-on: ubuntu-20.04 + + steps: + - name: Free disk space + run: | + # Free disk space. + echo "::group::Before" + df -h / + echo "::endgroup::" + echo "::group::Removing unneeded softwares and files..." + for DIR in /usr/local/lib/android /usr/share/dotnet /opt/ghc + do + if [ -d "$DIR" ]; then + echo "Removing $DIR..." + sudo rm -r "$DIR" + fi + done + echo "::endgroup::" + echo "::group::After" + df -h / + echo "::endgroup::" + + - name: Prepare + id: prep + run: | + # Determine the Docker container version. + VERSION=unknown + if [[ $GITHUB_REF =~ refs/tags/* ]]; then + # Git tag pushed: use tag as the version. + VERSION=${GITHUB_REF#refs/tags/} + elif [[ $GITHUB_REF =~ refs/heads/* ]]; then + # Git commit pushed: use the commit SHA as the version. + VERSION=${GITHUB_SHA::8} + elif [[ $GITHUB_REF =~ refs/pull/* ]]; then + # Pull request: use PR number as the version. + VERSION=pr-${{ github.event.number }} + else + echo "::error::Unexpected GITHUB_REF: $GITHUB_REF" + exit 1 + fi + # Determine the version to put in container label. + LABEL_VERSION=${VERSION} + if [[ $GITHUB_REF =~ refs/tags/* ]]; then + # Do not include the starting 'v' of the version. + LABEL_VERSION=${VERSION:1} + fi + # Determine the Docker container tags. + TAGS="${{ env.DOCKER_IMAGE_NAME }}:${VERSION}" + if [[ $GITHUB_REF =~ refs/tags/* ]]; then + TAGS="$TAGS,${{ env.DOCKER_IMAGE_NAME }}:latest" + fi + # Determine the release type. + if [[ $GITHUB_REF =~ refs/tags/* ]]; then + IS_RELEASE=yes + if [[ $GITHUB_REF =~ -pre\.[0-9]+ ]]; then + RELEASE_TYPE="pre" + else + RELEASE_TYPE="standard" + fi + else + IS_RELEASE=no + RELEASE_TYPE="n/a" + fi + # Print results. + echo "::group::Results" + echo "Github reference: $GITHUB_REF" + echo "Release: $IS_RELEASE" + echo "Release type: $RELEASE_TYPE" + echo "Docker container version: $VERSION" + echo "Docker container version label: $LABEL_VERSION" + echo "Docker container tag(s): $TAGS" + echo "::endgroup::" + # Export outputs. + echo "is_release=${IS_RELEASE}" >> $GITHUB_OUTPUT + echo "release_type=${RELEASE_TYPE}" >> $GITHUB_OUTPUT + echo "version=${VERSION}" >> $GITHUB_OUTPUT + echo "label_version=${LABEL_VERSION}" >> $GITHUB_OUTPUT + echo "tags=${TAGS}" >> $GITHUB_OUTPUT + #echo "build_date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT + + - name: Setup QEMU + uses: docker/setup-qemu-action@v2 + with: + platforms: arm,arm64,ppc64le,mips64,s390x + + - name: Setup Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Login to DockerHub + if: ${{ steps.prep.outputs.is_release == 'yes' }} + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + + - name: Build and push + uses: docker/build-push-action@v4 + with: + push: ${{ steps.prep.outputs.is_release == 'yes' }} + provenance: false + platforms: ${{ env.PLATFORMS }} + tags: ${{ steps.prep.outputs.tags }} + build-args: | + DOCKER_IMAGE_VERSION=${{ steps.prep.outputs.label_version }} + cache-from: type=gha,scope=${{ env.DOCKER_IMAGE_NAME }} + cache-to: type=gha,mode=max,scope=${{ env.DOCKER_IMAGE_NAME }} + + - name: Inspect + if: ${{ steps.prep.outputs.is_release == 'yes' }} + run: | + docker buildx imagetools inspect ${{ env.DOCKER_IMAGE_NAME }}:${{ steps.prep.outputs.version }} + + - name: Checkout + uses: actions/checkout@v3 + if: ${{ steps.prep.outputs.release_type == 'standard' }} + + - name: Dockerhub description + if: ${{ steps.prep.outputs.release_type == 'standard' }} + uses: peter-evans/dockerhub-description@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + repository: ${{ env.DOCKER_IMAGE_NAME }} + readme-filepath: DOCKERHUB.md + + notification: + name: Notification + needs: [ build ] + runs-on: ubuntu-20.04 + if: ${{ always() && github.event_name != 'pull_request' }} + + steps: + - name: Pushover notification + uses: desiderati/github-action-pushover@v1 + with: + job-status: ${{ needs.build.result }} + pushover-api-token: ${{ secrets.PUSHOVER_API_TOKEN }} + pushover-user-key: ${{ secrets.PUSHOVER_USER_KEY }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 197c633..0000000 --- a/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -# -# Travis CI recipe to build docker image. -# - -sudo: required - -language: generic - -services: - - docker - -script: - - echo "Starting build of Docker image..." - - docker build --no-cache --pull -t $TRAVIS_REPO_SLUG:$TRAVIS_JOB_ID . diff --git a/DOCKERHUB.md b/DOCKERHUB.md index 5c3db22..a2b664d 100644 --- a/DOCKERHUB.md +++ b/DOCKERHUB.md @@ -1,13 +1,20 @@ # Docker container for JDownloader 2 -[![Docker Image Size](https://img.shields.io/microbadger/image-size/jlesage/jdownloader-2)](http://microbadger.com/#/images/jlesage/jdownloader-2) [![Build Status](https://drone.le-sage.com/api/badges/jlesage/docker-jdownloader-2/status.svg)](https://drone.le-sage.com/jlesage/docker-jdownloader-2) [![GitHub Release](https://img.shields.io/github/release/jlesage/docker-jdownloader-2.svg)](https://github.com/jlesage/docker-jdownloader-2/releases/latest) [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://paypal.me/JocelynLeSage/0usd) +[![Release](https://img.shields.io/github/release/jlesage/docker-jdownloader-2.svg?logo=github&style=for-the-badge)](https://github.com/jlesage/docker-jdownloader-2/releases/latest) +[![Docker Image Size](https://img.shields.io/docker/image-size/jlesage/jdownloader-2/latest?logo=docker&style=for-the-badge)](https://hub.docker.com/r/jlesage/jdownloader-2/tags) +[![Docker Pulls](https://img.shields.io/docker/pulls/jlesage/jdownloader-2?label=Pulls&logo=docker&style=for-the-badge)](https://hub.docker.com/r/jlesage/jdownloader-2) +[![Docker Stars](https://img.shields.io/docker/stars/jlesage/jdownloader-2?label=Stars&logo=docker&style=for-the-badge)](https://hub.docker.com/r/jlesage/jdownloader-2) +[![Build Status](https://img.shields.io/github/actions/workflow/status/jlesage/docker-jdownloader-2/build-image.yml?logo=github&branch=master&style=for-the-badge)](https://github.com/jlesage/docker-jdownloader-2/actions/workflows/build-image.yml) +[![Source](https://img.shields.io/badge/Source-GitHub-blue?logo=github&style=for-the-badge)](https://github.com/jlesage/docker-jdownloader-2) +[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg?style=for-the-badge)](https://paypal.me/JocelynLeSage) -This is a Docker container for [JDownloader 2](http://jdownloader.org/). +This is a Docker container for [JDownloader 2](http://jdownloader.org). -The GUI of the application is accessed through a modern web browser (no installation or configuration needed on the client side) or via any VNC client. +The GUI of the application is accessed through a modern web browser (no +installation or configuration needed on the client side) or via any VNC client. --- -[![JDownloader 2 logo](https://images.weserv.nl/?url=raw.githubusercontent.com/jlesage/docker-templates/master/jlesage/images/jdownloader-2-icon.png&w=200)](http://jdownloader.org/)[![JDownloader 2](https://dummyimage.com/400x110/ffffff/575757&text=JDownloader+2)](http://jdownloader.org/) +[![JDownloader 2 logo](https://images.weserv.nl/?url=raw.githubusercontent.com/jlesage/docker-templates/master/jlesage/images/jdownloader-2-icon.png&w=110)](http://jdownloader.org)[![JDownloader 2](https://images.placeholders.dev/?width=416&height=110&fontFamily=monospace&fontWeight=400&fontSize=52&text=JDownloader%202&bgColor=rgba(0,0,0,0.0)&textColor=rgba(121,121,121,1))](http://jdownloader.org) JDownloader 2 is a free, open-source download management tool with a huge community of developers that makes downloading as easy and fast as it should be. @@ -23,18 +30,18 @@ your valuable time every day! and parameters should be adjusted to your need. Launch the JDownloader 2 docker container with the following command: -``` +```shell docker run -d \ --name=jdownloader-2 \ -p 5800:5800 \ -v /docker/appdata/jdownloader-2:/config:rw \ - -v $HOME/Downloads:/output:rw \ + -v /home/user/Downloads:/output:rw \ jlesage/jdownloader-2 ``` Where: - - `/docker/appdata/jdownloader-2`: This is where the application stores its configuration, log and any files needing persistency. - - `$HOME/Downloads`: This is where downloaded files are stored. + - `/docker/appdata/jdownloader-2`: This is where the application stores its configuration, states, log and any files needing persistency. + - `/home/user/Downloads`: This is where downloaded files are stored. Browse to `http://your-host-ip:5800` to access the JDownloader 2 GUI. diff --git a/Dockerfile b/Dockerfile index 5170b80..90bfd55 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,46 +3,53 @@ # # https://github.com/jlesage/docker-jdownloader-2 # - -# Pull base image. -FROM jlesage/baseimage-gui:alpine-3.12-v3.5.7 +# NOTES: +# - We are using JRE version 8 because recent versions are much bigger. +# - JRE for ARM 32-bits on Alpine is very hard to get: +# - The version in Alpine repo is very, very slow. +# - The glibc version doesn't work well on Alpine with a compatibility +# layer (gcompat or libc6-compat). The `__xstat` symbol is missing and +# implementing a wrapper is not straight-forward because the `struct stat` +# is not constant across architectures (32/64 bits) and glibc/musl. +# # Docker image version is provided via build arg. -ARG DOCKER_IMAGE_VERSION=unknown +ARG DOCKER_IMAGE_VERSION= # Define software download URLs. ARG JDOWNLOADER_URL=http://installer.jdownloader.org/JDownloader.jar -# Define working directory. -WORKDIR /tmp - -# Download JDownloader 2. +# Download JDownloader2 +FROM --platform=$BUILDPLATFORM alpine:3.16 AS jd2 +ARG JDOWNLOADER_URL RUN \ - add-pkg --virtual build-dependencies \ - curl \ - && \ + apk --no-cache add curl && \ mkdir -p /defaults && \ - # Download. - curl -# -L -o /defaults/JDownloader.jar ${JDOWNLOADER_URL} && \ - # Cleanup. - del-pkg build-dependencies && \ - rm -rf /tmp/* /tmp/.[!.]* + curl -# -L -o /defaults/JDownloader.jar ${JDOWNLOADER_URL} + +# Pull base image. +FROM jlesage/baseimage-gui:alpine-3.16-v4.4.2 + +ARG DOCKER_IMAGE_VERSION + +# Define working directory. +WORKDIR /tmp # Install dependencies. RUN \ add-pkg \ + java-common \ openjdk8-jre \ - libstdc++ \ + # Needed by the init script. + jq \ + # We need a font. ttf-dejavu \ # For ffmpeg and ffprobe tools. ffmpeg \ # For rtmpdump tool. - rtmpdump - -# Maximize only the main/initial window. -RUN \ - sed-patch 's///' \ - /etc/xdg/openbox/rc.xml + rtmpdump \ + # Need for the sponge tool. + moreutils # Generate and install favicons. RUN \ @@ -51,13 +58,15 @@ RUN \ # Add files. COPY rootfs/ / +COPY --from=jd2 /defaults/JDownloader.jar /defaults/JDownloader.jar -# Set environment variables. -ENV APP_NAME="JDownloader 2" \ - S6_KILL_GRACETIME=8000 +# Set internal environment variables. +RUN \ + set-cont-env APP_NAME "JDownloader 2" && \ + set-cont-env DOCKER_IMAGE_VERSION "$DOCKER_IMAGE_VERSION" && \ + true # Define mountable directories. -VOLUME ["/config"] VOLUME ["/output"] # Expose ports. @@ -76,6 +85,6 @@ LABEL autoheal=true LABEL \ org.label-schema.name="jdownloader-2" \ org.label-schema.description="Docker container for JDownloader 2" \ - org.label-schema.version="$DOCKER_IMAGE_VERSION" \ + org.label-schema.version="${DOCKER_IMAGE_VERSION:-unknown}" \ org.label-schema.vcs-url="https://github.com/jlesage/docker-jdownloader-2" \ org.label-schema.schema-version="1.0" diff --git a/README.md b/README.md index 859872f..1ec34ce 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,19 @@ # Docker container for JDownloader 2 -[![Docker Image Size](https://img.shields.io/docker/image-size/jlesage/jdownloader-2/latest)](https://hub.docker.com/r/jlesage/jdownloader-2/tags) [![Build Status](https://drone.le-sage.com/api/badges/jlesage/docker-jdownloader-2/status.svg)](https://drone.le-sage.com/jlesage/docker-jdownloader-2) [![GitHub Release](https://img.shields.io/github/release/jlesage/docker-jdownloader-2.svg)](https://github.com/jlesage/docker-jdownloader-2/releases/latest) [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://paypal.me/JocelynLeSage/0usd) +[![Release](https://img.shields.io/github/release/jlesage/docker-jdownloader-2.svg?logo=github&style=for-the-badge)](https://github.com/jlesage/docker-jdownloader-2/releases/latest) +[![Docker Image Size](https://img.shields.io/docker/image-size/jlesage/jdownloader-2/latest?logo=docker&style=for-the-badge)](https://hub.docker.com/r/jlesage/jdownloader-2/tags) +[![Docker Pulls](https://img.shields.io/docker/pulls/jlesage/jdownloader-2?label=Pulls&logo=docker&style=for-the-badge)](https://hub.docker.com/r/jlesage/jdownloader-2) +[![Docker Stars](https://img.shields.io/docker/stars/jlesage/jdownloader-2?label=Stars&logo=docker&style=for-the-badge)](https://hub.docker.com/r/jlesage/jdownloader-2) +[![Build Status](https://img.shields.io/github/actions/workflow/status/jlesage/docker-jdownloader-2/build-image.yml?logo=github&branch=master&style=for-the-badge)](https://github.com/jlesage/docker-jdownloader-2/actions/workflows/build-image.yml) +[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg?style=for-the-badge)](https://paypal.me/JocelynLeSage) -This is a Docker container for [JDownloader 2](http://jdownloader.org/). +This project implements a Docker container for [JDownloader 2](http://jdownloader.org). -The GUI of the application is accessed through a modern web browser (no installation or configuration needed on the client side) or via any VNC client. +The GUI of the application is accessed through a modern web browser (no +installation or configuration needed on the client side) or via any VNC client. --- -[![JDownloader 2 logo](https://images.weserv.nl/?url=raw.githubusercontent.com/jlesage/docker-templates/master/jlesage/images/jdownloader-2-icon.png&w=200)](http://jdownloader.org/)[![JDownloader 2](https://dummyimage.com/400x110/ffffff/575757&text=JDownloader+2)](http://jdownloader.org/) +[![JDownloader 2 logo](https://images.weserv.nl/?url=raw.githubusercontent.com/jlesage/docker-templates/master/jlesage/images/jdownloader-2-icon.png&w=110)](http://jdownloader.org)[![JDownloader 2](https://images.placeholders.dev/?width=416&height=110&fontFamily=monospace&fontWeight=400&fontSize=52&text=JDownloader%202&bgColor=rgba(0,0,0,0.0)&textColor=rgba(121,121,121,1))](http://jdownloader.org) JDownloader 2 is a free, open-source download management tool with a huge community of developers that makes downloading as easy and fast as it should be. @@ -19,32 +25,32 @@ your valuable time every day! ## Table of Content - * [Docker container for JDownloader 2](#docker-container-for-jdownloader-2) - * [Table of Content](#table-of-content) - * [Quick Start](#quick-start) - * [Usage](#usage) - * [Environment Variables](#environment-variables) - * [Data Volumes](#data-volumes) - * [Ports](#ports) - * [Changing Parameters of a Running Container](#changing-parameters-of-a-running-container) - * [Docker Compose File](#docker-compose-file) - * [Docker Image Update](#docker-image-update) - * [Synology](#synology) - * [unRAID](#unraid) - * [User/Group IDs](#usergroup-ids) - * [Accessing the GUI](#accessing-the-gui) - * [Security](#security) - * [SSVNC](#ssvnc) - * [Certificates](#certificates) - * [VNC Password](#vnc-password) - * [Reverse Proxy](#reverse-proxy) - * [Routing Based on Hostname](#routing-based-on-hostname) - * [Routing Based on URL Path](#routing-based-on-url-path) - * [Shell Access](#shell-access) - * [MyJDownloader](#myjdownloader) - * [Direct Connection](#direct-connection) - * [Click'n'Load](#clicknload) - * [Support or Contact](#support-or-contact) + * [Quick Start](#quick-start) + * [Usage](#usage) + * [Environment Variables](#environment-variables) + * [Deployment Considerations](#deployment-considerations) + * [Data Volumes](#data-volumes) + * [Ports](#ports) + * [Changing Parameters of a Running Container](#changing-parameters-of-a-running-container) + * [Docker Compose File](#docker-compose-file) + * [Docker Image Versioning](#docker-image-versioning) + * [Docker Image Update](#docker-image-update) + * [Synology](#synology) + * [unRAID](#unraid) + * [User/Group IDs](#usergroup-ids) + * [Accessing the GUI](#accessing-the-gui) + * [Security](#security) + * [SSVNC](#ssvnc) + * [Certificates](#certificates) + * [VNC Password](#vnc-password) + * [Reverse Proxy](#reverse-proxy) + * [Routing Based on Hostname](#routing-based-on-hostname) + * [Routing Based on URL Path](#routing-based-on-url-path) + * [Shell Access](#shell-access) + * [MyJDownloader](#myjdownloader) + * [Direct Connection](#direct-connection) + * [Click'n'Load](#clicknload) + * [Support or Contact](#support-or-contact) ## Quick Start @@ -52,24 +58,24 @@ your valuable time every day! and parameters should be adjusted to your need. Launch the JDownloader 2 docker container with the following command: -``` +```shell docker run -d \ --name=jdownloader-2 \ -p 5800:5800 \ -v /docker/appdata/jdownloader-2:/config:rw \ - -v $HOME/Downloads:/output:rw \ + -v /home/user/Downloads:/output:rw \ jlesage/jdownloader-2 ``` Where: - - `/docker/appdata/jdownloader-2`: This is where the application stores its configuration, log and any files needing persistency. - - `$HOME/Downloads`: This is where downloaded files are stored. + - `/docker/appdata/jdownloader-2`: This is where the application stores its configuration, states, log and any files needing persistency. + - `/home/user/Downloads`: This is where downloaded files are stored. Browse to `http://your-host-ip:5800` to access the JDownloader 2 GUI. ## Usage -``` +```shell docker run [-d] \ --name=jdownloader-2 \ [-e =]... \ @@ -77,6 +83,7 @@ docker run [-d] \ [-p :]... \ jlesage/jdownloader-2 ``` + | Parameter | Description | |-----------|-------------| | -d | Run the container in the background. If not set, the container runs in the foreground. | @@ -94,19 +101,66 @@ of this parameter has the format `=`. |----------------|----------------------------------------------|---------| |`USER_ID`| ID of the user the application runs as. See [User/Group IDs](#usergroup-ids) to better understand when this should be set. | `1000` | |`GROUP_ID`| ID of the group the application runs as. See [User/Group IDs](#usergroup-ids) to better understand when this should be set. | `1000` | -|`SUP_GROUP_IDS`| Comma-separated list of supplementary group IDs of the application. | (unset) | -|`UMASK`| Mask that controls how file permissions are set for newly created files. The value of the mask is in octal notation. By default, this variable is not set and the default umask of `022` is used, meaning that newly created files are readable by everyone, but only writable by the owner. See the following online umask calculator: http://wintelguy.com/umask-calc.pl | (unset) | -|`TZ`| [TimeZone] of the container. Timezone can also be set by mapping `/etc/localtime` between the host and the container. | `Etc/UTC` | -|`KEEP_APP_RUNNING`| When set to `1`, the application will be automatically restarted if it crashes or if a user quits it. | `0` | -|`APP_NICENESS`| Priority at which the application should run. A niceness value of -20 is the highest priority and 19 is the lowest priority. By default, niceness is not set, meaning that the default niceness of 0 is used. **NOTE**: A negative niceness (priority increase) requires additional permissions. In this case, the container should be run with the docker option `--cap-add=SYS_NICE`. | (unset) | -|`CLEAN_TMP_DIR`| When set to `1`, all files in the `/tmp` directory are deleted during the container startup. | `1` | -|`DISPLAY_WIDTH`| Width (in pixels) of the application's window. | `1280` | -|`DISPLAY_HEIGHT`| Height (in pixels) of the application's window. | `768` | +|`SUP_GROUP_IDS`| Comma-separated list of supplementary group IDs of the application. | (no value) | +|`UMASK`| Mask that controls how file permissions are set for newly created files. The value of the mask is in octal notation. By default, the default umask value is `0022`, meaning that newly created files are readable by everyone, but only writable by the owner. See the online umask calculator at http://wintelguy.com/umask-calc.pl. | `0022` | +|`LANG`| Set the [locale](https://en.wikipedia.org/wiki/Locale_(computer_software)), which defines the application's language, **if supported**. Format of the locale is `language[_territory][.codeset]`, where language is an [ISO 639 language code](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes), territory is an [ISO 3166 country code](https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) and codeset is a character set, like `UTF-8`. For example, Australian English using the UTF-8 encoding is `en_AU.UTF-8`. | `en_US.UTF-8` | +|`TZ`| [TimeZone](http://en.wikipedia.org/wiki/List_of_tz_database_time_zones) used by the container. Timezone can also be set by mapping `/etc/localtime` between the host and the container. | `Etc/UTC` | +|`KEEP_APP_RUNNING`| When set to `1`, the application will be automatically restarted when it crashes or terminates. | `0` | +|`APP_NICENESS`| Priority at which the application should run. A niceness value of -20 is the highest priority and 19 is the lowest priority. The default niceness value is 0. **NOTE**: A negative niceness (priority increase) requires additional permissions. In this case, the container should be run with the docker option `--cap-add=SYS_NICE`. | `0` | +|`INSTALL_PACKAGES`| Space-separated list of packages to install during the startup of the container. Packages are installed from the repository of the Linux distribution this container is based on. **ATTENTION**: Container functionality can be affected when installing a package that overrides existing container files (e.g. binaries). | (no value) | +|`CONTAINER_DEBUG`| Set to `1` to enable debug logging. | `0` | +|`DISPLAY_WIDTH`| Width (in pixels) of the application's window. | `1920` | +|`DISPLAY_HEIGHT`| Height (in pixels) of the application's window. | `1080` | +|`DARK_MODE`| When set to `1`, dark mode is enabled for the application. | `0` | |`SECURE_CONNECTION`| When set to `1`, an encrypted connection is used to access the application's GUI (either via a web browser or VNC client). See the [Security](#security) section for more details. | `0` | -|`VNC_PASSWORD`| Password needed to connect to the application's GUI. See the [VNC Password](#vnc-password) section for more details. | (unset) | -|`X11VNC_EXTRA_OPTS`| Extra options to pass to the x11vnc server running in the Docker container. **WARNING**: For advanced users. Do not use unless you know what you are doing. | (unset) | +|`SECURE_CONNECTION_VNC_METHOD`| Method used to perform the secure VNC connection. Possible values are `SSL` or `TLS`. See the [Security](#security) section for more details. | `SSL` | +|`SECURE_CONNECTION_CERTS_CHECK_INTERVAL`| Interval, in seconds, at which the system verifies if web or VNC certificates have changed. When a change is detected, the affected services are automatically restarted. A value of `0` disables the check. | `60` | +|`WEB_LISTENING_PORT`| Port used by the web server to serve the UI of the application. This port is used internally by the container and it is usually not required to be changed. By default, a container is created with the default bridge network, meaning that, to be accessible, each internal container port must be mapped to an external port (using the `-p` or `--publish` argument). However, if the container is created with another network type, changing the port used by the container might be useful to prevent conflict with other services/containers. **NOTE**: a value of `-1` disables listening, meaning that the application's UI won't be accessible over HTTP/HTTPs. | `5800` | +|`VNC_LISTENING_PORT`| Port used by the VNC server to serve the UI of the application. This port is used internally by the container and it is usually not required to be changed. By default, a container is created with the default bridge network, meaning that, to be accessible, each internal container port must be mapped to an external port (using the `-p` or `--publish` argument). However, if the container is created with another network type, changing the port used by the container might be useful to prevent conflict with other services/containers. **NOTE**: a value of `-1` disables listening, meaning that the application's UI won't be accessible over VNC. | `5900` | +|`VNC_PASSWORD`| Password needed to connect to the application's GUI. See the [VNC Password](#vnc-password) section for more details. | (no value) | |`ENABLE_CJK_FONT`| When set to `1`, open-source computer font `WenQuanYi Zen Hei` is installed. This font contains a large range of Chinese/Japanese/Korean characters. | `0` | -|`INSTALL_EXTRA_PKGS`| Space-separated list of Alpine Linux packages to install. See https://pkgs.alpinelinux.org/packages?name=&branch=v3.9&arch=x86_64 for the list of available Alpine Linux packages. | (unset) | +|`MYJDOWNLOADER_EMAIL`| Email address of the MyJDownloader account to use. Note that this can also be configured via the JDownloader GUI. | (no value) | +|`MYJDOWNLOADER_PASSWORD`| Password of the MyJDownloader account to use. Note that this can also be configured via the JDownloader GUI. | (no value) | +|`MYJDOWNLOADER_DEVICE_NAME`| The name of this JDownloader instance. Note that this can also be configured via the JDownloader GUI. | (no value) | +|`JDOWNLOADER_HEADLESS`| When set to `1`, JDownloader is running in headless mode, meaning that no GUI is available. In this mode, MyJDownloader should be used to remote control JDownloader. | `0` | + +#### Deployment Considerations + +Many tools used to manage Docker containers extract environment variables +defined by the Docker image and use them to create/deploy the container. For +example, this is done by: + - The Docker application on Synology NAS + - The Container Station on QNAP NAS + - Portainer + - etc. + +While this can be useful for the user to adjust the value of environment +variables to fit its needs, it can also be confusing and dangerous to keep all +of them. + +A good practice is to set/keep only the variables that are needed for the +container to behave as desired in a specific setup. If the value of variable is +kept to its default value, it means that it can be removed. Keep in mind that +all variables are optional, meaning that none of them is required for the +container to start. + +Removing environment variables that are not needed provides some advantages: + + - Prevents keeping variables that are no longer used by the container. Over + time, with image updates, some variables might be removed. + - Allows the Docker image to change/fix a default value. Again, with image + updates, the default value of a variable might be changed to fix an issue, + or to better support a new feature. + - Prevents changes to a variable that might affect the correct function of + the container. Some undocumented variables, like `PATH` or `ENV`, are + required to be exposed, but are not meant to be changed by users. However, + container management tools still show these variables to users. + - There is a bug with the Container Station on QNAP and the Docker application + on Synology, where an environment variable without value might not be + allowed. This behavior is wrong: it's absolutely fine to have a variable + without value. In fact, this container does have variables without value by + default. Thus, removing unneeded variables is a good way to prevent + deployment issue on these devices. ### Data Volumes @@ -116,21 +170,27 @@ format: `:[:PERMISSIONS]`. | Container path | Permissions | Description | |-----------------|-------------|-------------| -|`/config`| rw | This is where the application stores its configuration, log and any files needing persistency. | +|`/config`| rw | This is where the application stores its configuration, states, log and any files needing persistency. | |`/output`| rw | This is where downloaded files are stored. | ### Ports -Here is the list of ports used by the container. They can be mapped to the host -via the `-p` parameter (one per port mapping). Each mapping is defined in the -following format: `:`. The port number inside the -container cannot be changed, but you are free to use any port on the host side. +Here is the list of ports used by the container. -| Port | Mapping to host | Description | -|------|-----------------|-------------| -| 5800 | Mandatory | Port used to access the application's GUI via the web interface. | -| 5900 | Optional | Port used to access the application's GUI via the VNC protocol. Optional if no VNC client is used. | -| 3129 | Optional | Port used by *MyJDownloader* mobile applications and browser extensions to establish a direct connect to the JDownloader Docker container instance. Port needs to be exposed only if *MyJDownloader* is enabled and configured in *Direct Connection* mode. **NOTE**: Since this port is being reported to the *MyJDownloader* online service, the port mapped on the host side **must** be the same (i.e. 3129). | +When using the default bridge network, ports can be mapped to the host via the +`-p` parameter (one per port mapping). Each mapping is defined with the +following format: `:`. The port number used inside +the container might not be changeable, but you are free to use any port on the +host side. + +See the [Docker Container Networking](https://docs.docker.com/config/containers/container-networking) +documentation for more details. + +| Port | Protocol | Mapping to host | Description | +|------|----------|-----------------|-------------| +| 5800 | TCP | Optional | Port to access the application's GUI via the web interface. Mapping to the host is optional if access through the web interface is not wanted. For a container not using the default bridge network, the port can be changed with the `WEB_LISTENING_PORT` environment variable. | +| 5900 | TCP | Optional | Port to access the application's GUI via the VNC protocol. Mapping to the host is optional if access through the VNC protocol is not wanted. For a container not using the default bridge network, the port can be changed with the `VNC_LISTENING_PORT` environment variable. | +| 3129 | TCP | Optional | Port used by *MyJDownloader* mobile applications and browser extensions to establish a direct connect to the JDownloader Docker container instance. Port needs to be exposed only if *MyJDownloader* is enabled and configured in *Direct Connection* mode. **NOTE**: Since this port is being reported to the *MyJDownloader* online service, the port mapped on the host side **must** be the same (i.e. 3129). | ### Changing Parameters of a Running Container @@ -174,9 +234,22 @@ services: - "5800:5800" volumes: - "/docker/appdata/jdownloader-2:/config:rw" - - "$HOME/Downloads:/output:rw" + - "/home/user/Downloads:/output:rw" ``` +## Docker Image Versioning + +Each release of a Docker image is versioned. Prior to october 2022, the +[semantic versioning](https://semver.org) was used as the versioning scheme. + +Since then, versioning scheme changed to +[calendar versioning](https://calver.org). The format used is `YY.MM.SEQUENCE`, +where: + - `YY` is the zero-padded year (relative to year 2000). + - `MM` is the zero-padded month. + - `SEQUENCE` is the incremental release number within the month (first release + is 1, second is 2, etc). + ## Docker Image Update Because features are added, issues are fixed, or simply because a new version @@ -268,11 +341,13 @@ Assuming that container's ports are mapped to the same host's ports, the graphical interface of the application can be accessed via: * A web browser: + ``` http://:5800 ``` * Any VNC client: + ``` :5900 ``` @@ -453,12 +528,12 @@ server { To get shell access to the running container, execute the following command: -``` +```shell docker exec -ti CONTAINER sh ``` Where `CONTAINER` is the ID or the name of the container used during its -creation (e.g. `crashplan-pro`). +creation. ## MyJDownloader @@ -502,8 +577,6 @@ JDownloader via the *MyJDownloader* service. [Click'n'Load]: http://jdownloader.org/knowledge/wiki/glossary/cnl2 [MyJDownloader browser extension]: https://my.jdownloader.org/apps/ -[TimeZone]: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones - ## Support or Contact Having troubles with the container or have questions? Please diff --git a/appdefs.xml b/appdefs.xml deleted file mode 100644 index aa1b218..0000000 --- a/appdefs.xml +++ /dev/null @@ -1,336 +0,0 @@ - - - - 7 - x11 - JDownloader 2 - {{ defs.app.friendly_name|lower|replace(' ', '-') }} - - -JDownloader 2 is a free, open-source download management tool with a huge -community of developers that makes downloading as easy and fast as it should be. -Users can start, stop or pause downloads, set bandwith limitations, auto-extract -archives and much more. It's an easy-to-extend framework that can save hours of -your valuable time every day! - - http://jdownloader.org/ - - - https://forums.unraid.net/topic/58552-support-jdownloader-2/ - Downloaders: - - - 100MB - /storage - - - -
- MyJDownloader - -[MyJDownloader](https://my.jdownloader.org) is an online service providing -remote access to your JDownloader with Web Interface, Android App, iPhone App, -Windows Phone App and Browser Extensions. It allows to check download status, -add links and solve captchas from everywhere. - -To activate, open the JDownloader UI and click the *My.JDownloader* tab. - -
-
- Direct Connection - -When using MyJDownloader from a device on the same local network as the -JDownloader Docker container instance, *Direct Connection* mode can be enabled -to reduce the latency and increase the bandwidth. With this mode, instead of -going through the cloud, the communication is done through a direct connection -between the device and JDownloader. - -The default container's network being in *bridge* mode, the *Direct Connection* -mode is not automatically detected/activated and the following steps are required: - - * Make sure the container's port `3129` is mapped to the host port `3129`. - This is done by adding the parameter `-p 3129:3129` to the `docker run` - command. - * Open the JDownloader UI. - * Go to *Settings*->*Advanced Settings*. - * Search for `MyJDownloaderSettings`. - * Set `Custom Device IPs` to the IP address of the host running the container, - between double quotes (e.g. `"192.168.1.1"`). - * Change the `Direct Connection Mode` to `Allow lan/wan connections with - manual port forwarding`. - * Restart JDownloader (*File*->*Restart*). - -
-
- Click'n'Load - -The easiest way to use the [Click'n'Load] feature is by installing the -[MyJDownloader browser extension]. With this method, the browser extension -handles POST requests to `http://127.0.0.1:9666` and forward the links to -JDownloader via the *MyJDownloader* service. - -[Click'n'Load]: http://jdownloader.org/knowledge/wiki/glossary/cnl2 -[MyJDownloader browser extension]: https://my.jdownloader.org/apps/ - -
-
- - - - 1.7.1 - 2021-04-13 - Now using baseimage version 3.5.7, which brings the following change: - Updated installed packages to get latest security fixes. - - - 1.7.0 - 2021-03-12 - Removed usage of glibc: 7ZipJBindings now works under Alpine Linux and proper support as been added to JDownloader. - Updated baseimage to version 3.5.6, which brings the following changes: - Updated installed packages to get latest security fixes. - Make sure the tzdata is installed. - Upgraded glibc to version 2.31 on Alpine Linux images with glibc integrated. - Adjusted the log monitor target for recent versions of YAD. - Now using baseimage based on Alpine 3.12. - - - 1.6.0 - 2020-04-25 - Added the ability to install extra packages to the container image. - - - 1.5.2 - 2019-04-27 - Now using Java JRE from Amazon instead of Oracle. - Now using baseimage v3.5.2, which brings the following changes: - Updated installed packages to get latest security fixes. - Fixed issue where the container could have a zombie process. - Fixed issue where the password would not be submitted when pressing the enter key in the password modal. - Use relative path for favicon ressources to be more friendly with reverse proxy senarios. - - - 1.5.1 - 2018-09-25 - Fixed issue where opening/processing captcha would crash JDownloader. - - - 1.5.0 - 2018-09-21 - Now using baseimage v3.5.1, which brings the following changes (since last used version): - Image based on Alpine Linux 3.8. - Upgraded s6-overlay to version 1.21.4.0. - Wait for a limited time when terminating a service. - Set and create the XDG_RUNTIME_DIR directory. - Updated installed packages to get latest security fixes. - Upgraded Java JRE to version 8u181. - Install `ffmpeg`, `ffprobe` and `rtmpdump` to allow JDownloader to use them. - Fixed an issue where JDownloader would not work on a filesystem without execution permission. - - - 1.4.3 - 2018-03-02 - Now using baseimage v3.3.4, which brings the following changes (since last used version): - Make sure the log monitor is started after the X server. - Fixed an issue where the log monitor `yad` target would use XDG folders of the application. - Fixed issue where log monitor states were not cleared during container startup. - - - 1.4.2 - 2018-02-03 - Now using baseimage v3.3.2, which brings the following changes: - Restored timezone support in Alpine Linux images with glibc. - Fixed issue in `add-pkg` helper where a package could be incorrectly detected as installed. - - - 1.4.1 - 2018-01-30 - Now using baseimage v3.3.1, which brings the following changes: - Adjusted the way some ressources are accessed to better support reverse proxy to the container. - - - 1.4.0 - 2018-01-22 - Now using baseimage v3.3.0, which brings the following changes (since last used version): - For Alpine Linux images with glibc, automatically update dynamic linker's cache after new libraries are installed. - Fixed the LANG environment variable not being set properly. - Added the ability to automatically install a CJK (Chinese/Japanese/Korean) font. - - - 1.3.5 - 2018-01-11 - Fixed issue where libraries were not found. - - - 1.3.4 - 2018-01-11 - Now using baseimage v3.2.2, which brings the following changes (since last used version): - Upgraded S6 overlay to version 1.21.2.2. - Upgraded glibc to version 2.26 (Alpine Linux glibc images). - Adjusted the way ownership of /config is taken to better support cases where the folder is mapped to a network share. - Small adjustment to the way ownership of files are taken. - - - 1.3.3 - 2017-12-12 - Now using baseimage v3.1.4, which brings the following changes: - Set 2 worker processes for nginx. - - - 1.3.2 - 2017-11-20 - Now using baseimage v3.1.3, which brings the following changes: - Upgraded S6 overlay to version 1.21.2.1. - - - 1.3.1 - 2017-11-07 - Now using baseimage v3.1.2, which brings the following changes (from last used version): - Fixed an issue where a self-disabled service could be restarted. - Upgraded S6 overlay to version 1.21.2.0. - Use a more efficient way to monitor status files. - Fixed and issue where container would not start when log directory is missing. - - - 1.3.0 - 2017-10-29 - Now using baseimage v3.1.0, which brings the following changes: - Upgraded S6 overlay to version 1.21.1.1. - Enhanced integration of service dependencies functionality. - Added a simple log monitor. - Fixed race condition where container's exit code would not be the expected one. - Fixed issue where application's GUI fails to displayed when accessing it through the web interface via standard ports 80/443. - - - 1.2.0 - 2017-10-10 - Now using baseimage v3.0.2, which brings the following changes: - Better support for service dependencies. - Added support for secure access to the application's GUI. - - - 1.1.8 - 2017-09-08 - Now using baseimage v2.0.8, which brings the following changes (from last used version): - Fixed timezone support on alpine-glibc images. - Fixed duplicated entries in /etc/passwd and /etc/group that were created after a restart of the container. - - - 1.1.7 - 2017-09-01 - Fixed issue where the first-run indication had the wrong ownership. - Fixedissue where increase of the time before forcefully killing processes was not respected. - - - 1.1.6 - 2017-08-14 - Now using baseimage v2.0.6, which brings the following changes: - Upgraded S6 overlay to version 1.20.0.0. - - - 1.1.5 - 2017-07-31 - Properly remove the first run indication. - - - 1.1.4 - 2017-07-31 - Now using baseimage v2.0.5, which brings the following changes (from last used version): - Clear the environment of the container during startup. - Clear the /tmp folder during startup. - Cleanly terminate the X server when container is restarted/stopped. - Improved robustness of X server starting process. - Removed unneeded files from the image. - - - 1.1.3 - 2017-07-27 - Now using baseimage v2.0.3, which brings the following changes: - Improved robustness of the X server starting process. - - - 1.1.2 - 2017-07-23 - Now using baseimage v2.0.2, which brings the following changes: - Proper VNC port is exposed. - - - 1.1.1 - 2017-07-18 - Now using baseimage v2.0.1, which brings the following changes: - Internal enhancements. - Clean temporary files left by npm. - - - 1.1.0 - 2017-07-17 - Now using baseimage v2.0.0, which brings the following changes: - Various internal enhancements. - Fixed the way a service waits for another one. - - - 1.0.1 - 2017-07-07 - Fixed the auto archive extractor. - Allow more time to JDownloader to gracefully shutdown. - Improved handling/monitoring of JDownloader process. - - - 1.0.0 - 2017-07-05 - Initial release. - - -
- - - - - INSTALL_EXTRA_PKGS - Space-separated list of Alpine Linux packages to install. See https://pkgs.alpinelinux.org/packages?name=&branch=v3.9&arch=x86_64 for the list of available Alpine Linux packages. - - - Install Packages - Space-separated list of Alpine Linux packages to install. See [i]https://pkgs.alpinelinux.org[/i] for the list of available Alpine Linux packages. - advanced - false - false - - - - - - - /output - $HOME/Downloads - This is where downloaded files are stored. - rw - true - - Output Directory - This is the default output folder for downloaded files.[br]Container path: /output - always-hide - true - false - - - - - - - 3129 - tcp - Port used by *MyJDownloader* mobile applications and browser extensions to establish a direct connect to the JDownloader Docker container instance. Port needs to be exposed only if *MyJDownloader* is enabled and configured in *Direct Connection* mode. **NOTE**: Since this port is being reported to the *MyJDownloader* online service, the port mapped on the host side **must** be the same (i.e. 3129). - false - - - - - - - -
diff --git a/appdefs.yml b/appdefs.yml new file mode 100644 index 0000000..946791f --- /dev/null +++ b/appdefs.yml @@ -0,0 +1,402 @@ +--- + +# +# Definitions for JDownloader 2 docker container. +# +# This file is used as data source to generate README.md and unRAID template files +# from Jinja2 templates. +# + +app: + id: 7 + name: jdownloader-2 + friendly_name: JDownloader 2 + gui_type: x11 + project: + description: |- + JDownloader 2 is a free, open-source download management tool with a huge + community of developers that makes downloading as easy and fast as it should be. + Users can start, stop or pause downloads, set bandwith limitations, auto-extract + archives and much more. It's an easy-to-extend framework that can save hours of + your valuable time every day! + url: http://jdownloader.org + unraid: + support_url: https://forums.unraid.net/topic/58552-support-jdownloader-2/ + category: "Downloaders:" + documentation: + sections: + - title: MyJDownloader + level: 2 + content: |- + [MyJDownloader](https://my.jdownloader.org) is an online service providing + remote access to your JDownloader with Web Interface, Android App, iPhone App, + Windows Phone App and Browser Extensions. It allows to check download status, + add links and solve captchas from everywhere. + + To activate, open the JDownloader UI and click the *My.JDownloader* tab. + - title: Direct Connection + level: 3 + content: |- + When using MyJDownloader from a device on the same local network as the + JDownloader Docker container instance, *Direct Connection* mode can be enabled + to reduce the latency and increase the bandwidth. With this mode, instead of + going through the cloud, the communication is done through a direct connection + between the device and JDownloader. + + The default container's network being in *bridge* mode, the *Direct Connection* + mode is not automatically detected/activated and the following steps are required: + + * Make sure the container's port `3129` is mapped to the host port `3129`. + This is done by adding the parameter `-p 3129:3129` to the `docker run` + command. + * Open the JDownloader UI. + * Go to *Settings*->*Advanced Settings*. + * Search for `MyJDownloaderSettings`. + * Set `Custom Device IPs` to the IP address of the host running the container, + between double quotes (e.g. `"192.168.1.1"`). + * Change the `Direct Connection Mode` to `Allow lan/wan connections with + manual port forwarding`. + * Restart JDownloader (*File*->*Restart*). + - title: Click'n'Load + level: 2 + content: |- + The easiest way to use the [Click'n'Load] feature is by installing the + [MyJDownloader browser extension]. With this method, the browser extension + handles POST requests to `http://127.0.0.1:9666` and forward the links to + JDownloader via the *MyJDownloader* service. + + [Click'n'Load]: http://jdownloader.org/knowledge/wiki/glossary/cnl2 + [MyJDownloader browser extension]: https://my.jdownloader.org/apps/ + changelog: + - version: 23.06.1 + date: 2023-06-08 + changes: + - 'Updated baseimage to version 4.4.2, which brings the following changes:' + - '2:Rebuilt against latest distro images to get security fixes.' + - '2:Updated X server to version 1.20.14.' + - version: 23.04.1 + date: 2023-04-29 + changes: + - 'Updated baseimage to version 4.4.1, which brings the following changes:' + - '2:Updated TigerVNC to version 1.13.1.' + - version: 23.03.1 + date: 2023-03-05 + changes: + - 'Updated baseimage to version 4.4.0, which brings the following changes:' + - '2:Updated components providing access to application''s UI over web.' + - '2:Improved web UI usage with touch devices.' + - '2:Fixed issue with initialization of Linux users and groups when the `GROUP_ID` is also part of `SUP_GROUP_IDS`.' + - '2:Limit the maximum number of opened files on system having a very large, unlimited value. This prevents unnecessary waste of CPU resources and time for applications trying to close all possible file descriptors.' + - version: 23.02.2 + date: 2023-02-08 + changes: + - 'Updated baseimage to version 4.3.4, which brings the following changes:' + - '2:Fixed error message from openbox about missing Fontconfig cache directory.' + - 'Do not use the OCI Docker image format yet to keep better compatibility (e.g with older docker clients).' + - version: 23.02.1 + date: 2023-02-04 + changes: + - 'Updated baseimage to version 4.3.3, which brings robustness related enhancements.' + - version: 23.01.2 + date: 2023-01-07 + changes: + - 'Restored previous behavior and take ownership of `/output` only, without its content.' + - version: 23.01.1 + date: 2023-01-04 + changes: + - 'Update of the baseimage to version 4.3.1 brings the following changes:' + - '2:Control menu can be moved to the right side of the screen.' + - '2:Automatic focus of the clipboard text box when opening the control menu.' + - '2:Automatic close of the control menu when clicking into the application.' + - '2:Rotation of the internal web server log files.' + - version: 22.12.2 + date: 2022-12-11 + changes: + - 'Implemented workaround for issue seen with Synology devices where container would not start after an image update. The problem is caused by Synology explicitly setting all environment variables and keeping values from the old version.' + - version: 22.12.1 + date: 2022-12-01 + changes: + - 'Fixed issue where taking ownership of `/output` could fail during startup.' + - version: 22.11.2 + date: 2022-11-30 + changes: + - 'Allow more time to JDownloader to restart itself.' + - 'Fixed issue where permissions of `/tmp` were incorrect on some systems.' + - 'Updated baseimage to version `4.2.0`, which brings multiple internal enhancements.' + - version: 22.11.1 + date: 2022-11-18 + changes: + - 'Added the ability to set MyJDownloader credentials via environment variables.' + - 'Added the ability to run JDownloader in headless mode.' + - 'Versioning scheme of the Docker image changed to `YY.MM.SEQUENCE`.' + - 'Update of the baseimage to version 4.1.5 brings the following new features:' + - '2:Multi-arch image support.' + - '2:Support for dark mode.' + - '2:Support for remote window resize.' + - '2:Updated the web UI with a new, simplified and less intrusive look.' + - version: 1.7.2 + date: 2022-08-18 + changes: + - 'Use better way to test if output folder is writable.' + - 'Now using baseimage version 3.5.8, based on Alpine Linux 3.15, which brings the following changes:' + - '2:Updated installed packages to get latest security fixes.' + - version: 1.7.1 + date: 2021-04-13 + changes: + - 'Now using baseimage version 3.5.7, which brings the following change:' + - '2:Updated installed packages to get latest security fixes.' + - version: 1.7.0 + date: 2021-03-12 + changes: + - 'Removed usage of glibc: 7ZipJBindings now works under Alpine Linux and proper support as been added to JDownloader.' + - 'Updated baseimage to version 3.5.6, which brings the following changes:' + - '2:Updated installed packages to get latest security fixes.' + - '2:Make sure the tzdata is installed.' + - '2:Upgraded glibc to version 2.31 on Alpine Linux images with glibc integrated.' + - '2:Adjusted the log monitor target for recent versions of YAD.' + - 'Now using baseimage based on Alpine 3.12.' + - version: 1.6.0 + date: 2020-04-25 + changes: + - 'Added the ability to install extra packages to the container image.' + - version: 1.5.2 + date: 2019-04-27 + changes: + - 'Now using Java JRE from Amazon instead of Oracle.' + - 'Now using baseimage v3.5.2, which brings the following changes:' + - '2:Updated installed packages to get latest security fixes.' + - '2:Fixed issue where the container could have a zombie process.' + - '2:Fixed issue where the password would not be submitted when pressing the enter key in the password modal.' + - '2:Use relative path for favicon ressources to be more friendly with reverse proxy senarios.' + - version: 1.5.1 + date: 2018-09-25 + changes: + - 'Fixed issue where opening/processing captcha would crash JDownloader.' + - version: 1.5.0 + date: 2018-09-21 + changes: + - 'Now using baseimage v3.5.1, which brings the following changes (since last used version):' + - '2:Image based on Alpine Linux 3.8.' + - '2:Upgraded s6-overlay to version 1.21.4.0.' + - '2:Wait for a limited time when terminating a service.' + - '2:Set and create the XDG_RUNTIME_DIR directory.' + - '2:Updated installed packages to get latest security fixes.' + - 'Upgraded Java JRE to version 8u181.' + - 'Install `ffmpeg`, `ffprobe` and `rtmpdump` to allow JDownloader to use them.' + - 'Fixed an issue where JDownloader would not work on a filesystem without execution permission.' + - version: 1.4.3 + date: 2018-03-02 + changes: + - 'Now using baseimage v3.3.4, which brings the following changes (since last used version):' + - '2:Make sure the log monitor is started after the X server.' + - '2:Fixed an issue where the log monitor `yad` target would use XDG folders of the application.' + - '2:Fixed issue where log monitor states were not cleared during container startup.' + - version: 1.4.2 + date: 2018-02-03 + changes: + - 'Now using baseimage v3.3.2, which brings the following changes:' + - '2:Restored timezone support in Alpine Linux images with glibc.' + - '2:Fixed issue in `add-pkg` helper where a package could be incorrectly detected as installed.' + - version: 1.4.1 + date: 2018-01-30 + changes: + - 'Now using baseimage v3.3.1, which brings the following changes:' + - '2:Adjusted the way some ressources are accessed to better support reverse proxy to the container.' + - version: 1.4.0 + date: 2018-01-22 + changes: + - 'Now using baseimage v3.3.0, which brings the following changes (since last used version):' + - '2:For Alpine Linux images with glibc, automatically update dynamic linker''s cache after new libraries are installed.' + - '2:Fixed the LANG environment variable not being set properly.' + - '2:Added the ability to automatically install a CJK (Chinese/Japanese/Korean) font.' + - version: 1.3.5 + date: 2018-01-11 + changes: + - 'Fixed issue where libraries were not found.' + - version: 1.3.4 + date: 2018-01-11 + changes: + - 'Now using baseimage v3.2.2, which brings the following changes (since last used version):' + - '2:Upgraded S6 overlay to version 1.21.2.2.' + - '2:Upgraded glibc to version 2.26 (Alpine Linux glibc images).' + - '2:Adjusted the way ownership of /config is taken to better support cases where the folder is mapped to a network share.' + - 'Small adjustment to the way ownership of files are taken.' + - version: 1.3.3 + date: 2017-12-12 + changes: + - 'Now using baseimage v3.1.4, which brings the following changes:' + - '2:Set 2 worker processes for nginx.' + - version: 1.3.2 + date: 2017-11-20 + changes: + - 'Now using baseimage v3.1.3, which brings the following changes:' + - '2:Upgraded S6 overlay to version 1.21.2.1.' + - version: 1.3.1 + date: 2017-11-07 + changes: + - 'Now using baseimage v3.1.2, which brings the following changes (from last used version):' + - '2:Fixed an issue where a self-disabled service could be restarted.' + - '2:Upgraded S6 overlay to version 1.21.2.0.' + - '2:Use a more efficient way to monitor status files.' + - 'Fixed and issue where container would not start when log directory is missing.' + - version: 1.3.0 + date: 2017-10-29 + changes: + - 'Now using baseimage v3.1.0, which brings the following changes:' + - '2:Upgraded S6 overlay to version 1.21.1.1.' + - '2:Enhanced integration of service dependencies functionality.' + - '2:Added a simple log monitor.' + - '2:Fixed race condition where container''s exit code would not be the expected one.' + - '2:Fixed issue where application''s GUI fails to displayed when accessing it through the web interface via standard ports 80/443.' + - version: 1.2.0 + date: 2017-10-10 + changes: + - 'Now using baseimage v3.0.2, which brings the following changes:' + - '2:Better support for service dependencies.' + - '2:Added support for secure access to the application''s GUI.' + - version: 1.1.8 + date: 2017-09-08 + changes: + - 'Now using baseimage v2.0.8, which brings the following changes (from last used version):' + - '2:Fixed timezone support on alpine-glibc images.' + - '2:Fixed duplicated entries in /etc/passwd and /etc/group that were created after a restart of the container.' + - version: 1.1.7 + date: 2017-09-01 + changes: + - 'Fixed issue where the first-run indication had the wrong ownership.' + - 'Fixedissue where increase of the time before forcefully killing processes was not respected.' + - version: 1.1.6 + date: 2017-08-14 + changes: + - 'Now using baseimage v2.0.6, which brings the following changes:' + - '2:Upgraded S6 overlay to version 1.20.0.0.' + - version: 1.1.5 + date: 2017-07-31 + changes: + - 'Properly remove the first run indication.' + - version: 1.1.4 + date: 2017-07-31 + changes: + - 'Now using baseimage v2.0.5, which brings the following changes (from last used version):' + - '2:Clear the environment of the container during startup.' + - '2:Clear the /tmp folder during startup.' + - '2:Cleanly terminate the X server when container is restarted/stopped.' + - '2:Improved robustness of X server starting process.' + - '2:Removed unneeded files from the image.' + - version: 1.1.3 + date: 2017-07-27 + changes: + - 'Now using baseimage v2.0.3, which brings the following changes:' + - '2:Improved robustness of the X server starting process.' + - version: 1.1.2 + date: 2017-07-23 + changes: + - 'Now using baseimage v2.0.2, which brings the following changes:' + - '2:Proper VNC port is exposed.' + - version: 1.1.1 + date: 2017-07-18 + changes: + - 'Now using baseimage v2.0.1, which brings the following changes:' + - '2:Internal enhancements.' + - '2:Clean temporary files left by npm.' + - version: 1.1.0 + date: 2017-07-17 + changes: + - 'Now using baseimage v2.0.0, which brings the following changes:' + - '2:Various internal enhancements.' + - '2:Fixed the way a service waits for another one.' + - version: 1.0.1 + date: 2017-07-07 + changes: + - 'Fixed the auto archive extractor.' + - 'Allow more time to JDownloader to gracefully shutdown.' + - 'Improved handling/monitoring of JDownloader process.' + - version: 1.0.0 + date: 2017-07-05 + changes: + - 'Initial release.' + +container: + unsupported_volume: + - /storage + + # Environment variables. + environment_variables: + - name: MYJDOWNLOADER_EMAIL + description: >- + Email address of the MyJDownloader account to use. Note that this can + also be configured via the JDownloader GUI. + type: public + unraid_template: + title: MyJDownloader Email + display: advanced + required: false + mask: false + - name: MYJDOWNLOADER_PASSWORD + description: >- + Password of the MyJDownloader account to use. Note that this can + also be configured via the JDownloader GUI. + type: public + unraid_template: + title: MyJDownloader Password + display: advanced + required: false + mask: false + - name: MYJDOWNLOADER_DEVICE_NAME + description: >- + The name of this JDownloader instance. Note that this can + also be configured via the JDownloader GUI. + type: public + unraid_template: + title: MyJDownloader Device Name + display: advanced + required: false + mask: false + - name: JDOWNLOADER_HEADLESS + description: >- + When set to `1`, JDownloader is running in headless mode, meaning that + no GUI is available. In this mode, MyJDownloader should be used to + remote control JDownloader. + type: public + default: 0 + unraid_template: + title: Headless Mode + description: >- + When set to "1", JDownloader is running in headless mode, meaning that + no GUI is available. In this mode, MyJDownloader should be used to + remote control JDownloader. + display: advanced + required: false + mask: false + + # Volumes + volumes: + - container_path: /output + host_path_example: /home/user/Downloads + description: >- + This is where downloaded files are stored. + permissions: rw + include_in_quick_start: true + unraid_template: + title: Output Directory + description: >- + This is the default output folder for downloaded files. + display: advanced-hide + required: true + mask: false + + # Network ports + ports: + - number: 3129 + protocol: tcp + description: >- + Port used by *MyJDownloader* mobile applications and browser extensions to + establish a direct connect to the JDownloader Docker container instance. + Port needs to be exposed only if *MyJDownloader* is enabled and configured in + *Direct Connection* mode. **NOTE**: Since this port is being reported to the + *MyJDownloader* online service, the port mapped on the host side **must** be + the same (i.e. 3129). + mandatory: false + + # Devices + devices: [] diff --git a/rootfs/defaults/cfg/laf/FlatDarculaLaf.json b/rootfs/defaults/cfg/laf/FlatDarculaLaf.json new file mode 100644 index 0000000..ccf4833 --- /dev/null +++ b/rootfs/defaults/cfg/laf/FlatDarculaLaf.json @@ -0,0 +1,22 @@ +{ + "colorforconfigpaneldescriptiontext" : "#fff8f8f2", + "configlabelenabledtextcolor" : "#fff8f8f2", + "colorfortableselectedrowsforeground" : "#fff8f8f2", + "colorfortablepackagerowforeground" : "#fff8f8f2", + "colorforconfigheadertextcolor" : "#fff8f8f2", + "colorfortablemouseoverrowbackground" : "#ff44475a", + "colorfortablepackagerowbackground" : "#ff2d2e3a", + "colorfortableselectedrowsbackground" : "#ff44475a", + "colorforerrorforeground" : "#ffff5555", + "colorforlinkgrabberdupehighlighter" : "#33ff5555", + "colorfortablemouseoverrowforeground" : "#fff8f8f2", + "colorfortablefilteredview" : "#ff50fa7b", + "colorfortooltipforeground" : "#fff8f8f2", + "colorfortableaccounterrorrowbackground" : "#7fff5555", + "colorforpanelbackground" : "#ff282a36", + "colorfortablealternaterowforeground" : "#fff8f8f2", + "colorforspeedmeterlimitertop" : "#ccff5555", + "colorfortablealternaterowbackground" : "#ff282a36", + "colorfortablesortedcolumnview" : "#ffffb68c", + "colorforpanelheaderbackground" : "#ff282a36" +} \ No newline at end of file diff --git a/rootfs/defaults/cfg/org.jdownloader.api.myjdownloader.MyJDownloaderSettings.json b/rootfs/defaults/cfg/org.jdownloader.api.myjdownloader.MyJDownloaderSettings.json new file mode 100644 index 0000000..89e5ded --- /dev/null +++ b/rootfs/defaults/cfg/org.jdownloader.api.myjdownloader.MyJDownloaderSettings.json @@ -0,0 +1,6 @@ +{ + "autoconnectenabledv2" : true, + "email" : "", + "password" : "", + "devicename" : "JDownloader@Docker" +} diff --git a/rootfs/defaults/cfg/org.jdownloader.gui.jdtrayicon.TrayExtension.json b/rootfs/defaults/cfg/org.jdownloader.gui.jdtrayicon.TrayExtension.json index 647086a..7d6e1a5 100644 --- a/rootfs/defaults/cfg/org.jdownloader.gui.jdtrayicon.TrayExtension.json +++ b/rootfs/defaults/cfg/org.jdownloader.gui.jdtrayicon.TrayExtension.json @@ -1,10 +1,4 @@ { "freshinstall" : false, - "onminimizeaction" : "TO_TASKBAR", - "tooltipenabled" : true, - "oncloseaction" : "ASK", - "tooglewindowstatuswithsingleclickenabled" : false, - "enabled" : false, - "startminimizedenabled" : false, - "trayonlyvisibleifwindowishiddenenabled" : false + "enabled" : false } diff --git a/rootfs/defaults/cfg/org.jdownloader.gui.notify.gui.BubbleNotifyConfig.json b/rootfs/defaults/cfg/org.jdownloader.gui.notify.gui.BubbleNotifyConfig.json index e1eb545..65cf66e 100644 --- a/rootfs/defaults/cfg/org.jdownloader.gui.notify.gui.BubbleNotifyConfig.json +++ b/rootfs/defaults/cfg/org.jdownloader.gui.notify.gui.BubbleNotifyConfig.json @@ -1,17 +1,3 @@ { - "bubblenotifyenabledstate" : "NEVER", - "bubblenotifyonnewlinkgrabberlinksenabled" : true, - "defaulttimeout" : 15000, - "screenid" : "\\Display9999", - "bubblenotifyonnewlinkgrabberlinkson" : "LINK", - "bubblenotifyonupdateavailableenabled" : true, - "bubblenotifyenabledduringsilentmode" : false, - "fadeanimationduration" : 900, - "bubblenotifystartpausestopenabled" : true, - "bubblenotifyonreconnectstartenabled" : true, - "animationstartpositionanchor" : "SYSTEM_DEFAULT", - "animationendpositionanchor" : "SYSTEM_DEFAULT", - "bubblenotifystartstopdownloadsenabled" : false, - "finalpositionanchor" : "SYSTEM_DEFAULT", - "bubblenotifyoncaptchainbackgroundenabled" : true -} \ No newline at end of file + "bubblenotifyenabledstate" : "NEVER" +} diff --git a/rootfs/defaults/cfg/org.jdownloader.gui.views.linkgrabber.addlinksdialog.LinkgrabberSettings.json b/rootfs/defaults/cfg/org.jdownloader.gui.views.linkgrabber.addlinksdialog.LinkgrabberSettings.json index 4cd23cc..ea6a9dd 100644 --- a/rootfs/defaults/cfg/org.jdownloader.gui.views.linkgrabber.addlinksdialog.LinkgrabberSettings.json +++ b/rootfs/defaults/cfg/org.jdownloader.gui.views.linkgrabber.addlinksdialog.LinkgrabberSettings.json @@ -1,10 +1,3 @@ { - "autoextractionenabled" : true, - "variantscolumnalwaysvisible" : false, - "linkgrabberautostartenabled" : true, - "variouspackageenabled" : true, - "latestdownloaddestinationfolder" : "/output", - "linkgrabberaddattop" : false, - "linkgrabberautoconfirmenabled" : false, - "autoconfirmdelay" : 15000 -} \ No newline at end of file + "latestdownloaddestinationfolder" : "/output" +} diff --git a/rootfs/defaults/cfg/org.jdownloader.settings.GeneralSettings.json b/rootfs/defaults/cfg/org.jdownloader.settings.GeneralSettings.json index dd0d9f4..07d3ad0 100644 --- a/rootfs/defaults/cfg/org.jdownloader.settings.GeneralSettings.json +++ b/rootfs/defaults/cfg/org.jdownloader.settings.GeneralSettings.json @@ -1,31 +1,3 @@ { - "maxsimultanedownloadsperhost" : 1, - "delaywritemode" : "AUTO", - "iffileexistsaction" : "ASK_FOR_EACH_FILE", - "dupemanagerenabled" : true, - "forcemirrordetectioncaseinsensitive" : true, - "autoopencontainerafterdownload" : true, - "autostartdownloadoption" : "ONLY_IF_EXIT_WITH_RUNNING_DOWNLOADS", - "maxsimultanedownloads" : 3, - "pausespeed" : 10240, - "defaultdownloadfolder" : "/output", - "downloadspeedlimitrememberedenabled" : true, - "closedwithrunningdownloads" : false, - "autostartcountdownseconds" : 10, - "maxdownloadsperhostenabled" : false, - "maxchunksperfile" : 1, - "sambaprefetchenabled" : true, - "showcountdownonautostartdownloads" : true, - "savelinkgrabberlistenabled" : true, - "onskipduetoalreadyexistsaction" : "SKIP_FILE", - "myjdownloadercaptchasolverenabled" : false, - "hashretryenabled" : false, - "convertrelativepathsjdroot" : true, - "keepxoldlists" : 5, - "downloaddestinationhistorylength" : 25, - "useavailableaccounts" : true, - "cleanupafterdownloadaction" : "NEVER", - "hashcheckenabled" : true, - "downloadspeedlimitenabled" : false, - "downloadspeedlimit" : 51200 -} \ No newline at end of file + "defaultdownloadfolder" : "/output" +} diff --git a/rootfs/defaults/cfg/org.jdownloader.settings.GraphicalUserInterfaceSettings.json b/rootfs/defaults/cfg/org.jdownloader.settings.GraphicalUserInterfaceSettings.json new file mode 100644 index 0000000..c497830 --- /dev/null +++ b/rootfs/defaults/cfg/org.jdownloader.settings.GraphicalUserInterfaceSettings.json @@ -0,0 +1,3 @@ +{ + "lookandfeeltheme": "DEFAULT" +} diff --git a/rootfs/etc/cont-env.d/INSTALL_PACKAGES_INTERNAL b/rootfs/etc/cont-env.d/INSTALL_PACKAGES_INTERNAL new file mode 100755 index 0000000..065eac7 --- /dev/null +++ b/rootfs/etc/cont-env.d/INSTALL_PACKAGES_INTERNAL @@ -0,0 +1,14 @@ +#!/bin/sh + +set -e # Exit immediately if a command exits with a non-zero status. +set -u # Treat unset variables as an error. + +if [ -z "${INSTALL_PACKAGES:-}" ] && [ -n "${INSTALL_EXTRA_PKGS:-}" ] +then + >&2 echo "Usage of INSTALL_EXTRA_PKGS environment variable is deprecated. INSTALL_PACKAGES should be used instead." + echo "$INSTALL_EXTRA_PKGS" +else + exit 100 +fi + +# vim:ft=sh:ts=4:sw=4:et:sts=4 diff --git a/rootfs/etc/cont-init.d/55-jdownloader2.sh b/rootfs/etc/cont-init.d/55-jdownloader2.sh new file mode 100755 index 0000000..370830e --- /dev/null +++ b/rootfs/etc/cont-init.d/55-jdownloader2.sh @@ -0,0 +1,41 @@ +#!/bin/sh + +set -e # Exit immediately if a command exits with a non-zero status. +set -u # Treat unset variables as an error. + +# Make sure mandatory directories exist. +mkdir -p /config/logs + +# Set default configuration on new install. +if [ ! -f /config/JDownloader.jar ]; then + cp /defaults/JDownloader.jar /config/ + cp -r /defaults/cfg /config/ +fi + +# Set MyJDownloader credentials. +if [ -n "${MYJDOWNLOADER_EMAIL:-}" ] && [ -n "${MYJDOWNLOADER_PASSWORD:-}" ] +then + jq -c -M ".email=\"$MYJDOWNLOADER_EMAIL\" | .password = \"$(echo "$MYJDOWNLOADER_PASSWORD" | sed 's/"/\\"/g')\"" /config/cfg/org.jdownloader.api.myjdownloader.MyJDownloaderSettings.json | sponge /config/cfg/org.jdownloader.api.myjdownloader.MyJDownloaderSettings.json +fi + +# Set the MyJDownloader device name. +if [ -n "${MYJDOWNLOADER_DEVICE_NAME:-}" ]; then + jq -c -M ".devicename = \"$(echo "$MYJDOWNLOADER_DEVICE_NAME" | sed 's/"/\\"/g')\"" /config/cfg/org.jdownloader.api.myjdownloader.MyJDownloaderSettings.json | sponge /config/cfg/org.jdownloader.api.myjdownloader.MyJDownloaderSettings.json +fi + +# Handle dark mode change. +if is-bool-val-false "${DARK_MODE:-0}"; then + # Dark mode disabled. Change theme only if it is currently set to our dark mode. + CURRENT_THEME="$(jq -r -c -M '.lookandfeeltheme' /config/cfg/org.jdownloader.settings.GraphicalUserInterfaceSettings.json)" + if [ "$CURRENT_THEME" = "FLATLAF_DRACULA" ]; then + jq -c -M '.lookandfeeltheme = "DEFAULT"' /config/cfg/org.jdownloader.settings.GraphicalUserInterfaceSettings.json | sponge /config/cfg/org.jdownloader.settings.GraphicalUserInterfaceSettings.json + fi +else + # Dark mode enabled. Force theme. + jq -c -M '.lookandfeeltheme = "FLATLAF_DRACULA"' /config/cfg/org.jdownloader.settings.GraphicalUserInterfaceSettings.json | sponge /config/cfg/org.jdownloader.settings.GraphicalUserInterfaceSettings.json +fi + +# Take ownership of the output directory. +take-ownership --not-recursive /output + +# vim:ft=sh:ts=4:sw=4:et:sts=4 diff --git a/rootfs/etc/openbox/main-window-selection.xml b/rootfs/etc/openbox/main-window-selection.xml new file mode 100644 index 0000000..6babcc4 --- /dev/null +++ b/rootfs/etc/openbox/main-window-selection.xml @@ -0,0 +1,2 @@ +normal +JDownloader 2<Title> diff --git a/rootfs/etc/services.d/app/gui.dep b/rootfs/etc/services.d/app/gui.dep new file mode 100755 index 0000000..3a0f371 --- /dev/null +++ b/rootfs/etc/services.d/app/gui.dep @@ -0,0 +1,12 @@ +#!/bin/sh + +set -e # Exit immediately if a command exits with a non-zero status. +set -u # Treat unset variables as an error. + +if is-bool-val-true "${JDOWNLOADER_HEADLESS:-0}"; then + echo "false" +else + echo "true" +fi + +# vim:ft=sh:ts=4:sw=4:et:sts=4 diff --git a/rootfs/startapp.sh b/rootfs/startapp.sh index 11a79c4..e7eaaea 100644 --- a/rootfs/startapp.sh +++ b/rootfs/startapp.sh @@ -1,64 +1,89 @@ -#!/usr/bin/with-contenv sh +#!/bin/sh set -u # Treat unset variables as an error. trap "exit" TERM QUIT INT trap "kill_jd" EXIT -log() { - echo "[jdsupervisor] $*" +# JDownloader logs all environment variables. Make sure to MyJDownloader +# credentials don't leak. +unset MYJDOWNLOADER_EMAIL +unset MYJDOWNLOADER_PASSWORD + +log_debug() { + if is-bool-val-true "${CONTAINER_DEBUG:-0}"; then + echo "$@" + fi } -getpid_jd() { +get_jd_pid() { PID=UNSET - if [ -f /config/JDownloader.pid ]; then - PID="$(cat /config/JDownloader.pid)" - # Make sure the saved PID is still running and is associated to - # JDownloader. - if [ ! -f /proc/$PID/cmdline ] || ! cat /proc/$PID/cmdline | grep -qw "JDownloader.jar"; then - PID=UNSET + if [ -f /config/JD2.lock ]; then + FUSER_STR="$(fuser /config/JD2.lock 2>/dev/null)" + if [ $? -eq 0 ]; then + echo "$FUSER_STR" | awk '{print $1}' + return fi fi - if [ "$PID" = "UNSET" ]; then - PID="$(ps -o pid,args | grep -w "JDownloader.jar" | grep -vw grep | tr -s ' ' | cut -d' ' -f2)" - fi - echo "${PID:-UNSET}" + + echo "UNSET" } is_jd_running() { - [ "$(getpid_jd)" != "UNSET" ] + [ "$(get_jd_pid)" != "UNSET" ] } start_jd() { - /usr/bin/java \ - -Dawt.useSystemAAFontSettings=gasp \ - -Djava.awt.headless=false \ - -jar /config/JDownloader.jar >/config/logs/output.log 2>&1 & + if is-bool-val-true "${JDOWNLOADER_HEADLESS:-0}"; then + /usr/bin/java \ + -XX:-UsePerfData \ + -Djava.awt.headless=true \ + -jar /config/JDownloader.jar >/config/logs/output.log 2>&1 & + else + /usr/bin/java \ + -XX:-UsePerfData \ + -Dawt.useSystemAAFontSettings=gasp \ + -Djava.awt.headless=false \ + -jar /config/JDownloader.jar >/config/logs/output.log 2>&1 & + fi } kill_jd() { - PID="$(getpid_jd)" + PID="$(get_jd_pid)" if [ "$PID" != "UNSET" ]; then - log "Terminating JDownloader2..." + log_debug "terminating JDownloader2..." kill $PID wait $PID + exit $? fi } -if ! is_jd_running; then - log "JDownloader2 not started yet. Proceeding..." - start_jd -fi +# Start JDownloader. +log_debug "starting JDownloader2..." +start_jd -JD_NOT_RUNNING=0 -while [ "$JD_NOT_RUNNING" -lt 5 ] +# Wait until it dies. +wait $! + +TIMEOUT=10 + +while true do if is_jd_running; then - JD_NOT_RUNNING=0 + if [ "$TIMEOUT" -lt 10 ]; then + log_debug "JDownloader2 has restarted." + fi + + # Reset the timeout. + TIMEOUT=10 else - JD_NOT_RUNNING="$(expr $JD_NOT_RUNNING + 1)" + if [ "$TIMEOUT" -eq 10 ]; then + log_debug "JDownloader2 exited, checking if it is restarting..." + elif [ "$TIMEOUT" -eq 0 ]; then + log_debug "JDownloader2 not restarting, exiting..." + break + fi + TIMEOUT="$(expr $TIMEOUT - 1)" fi sleep 1 done - -log "JDownloader2 no longer running. Exiting..."