From b293a44c6260bd82f0b20038aa1cfa8cb9b7471f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=B0brahim=20Ercan?= Date: Sun, 1 Sep 2024 13:57:20 +0300 Subject: [PATCH] Set remote access via command line option (#26) --- Dockerfile | 11 ++++++----- api-configuration.sh | 13 ------------- docker-compose.yml | 2 ++ run.sh | 7 +++++++ supervisor.conf | 22 ---------------------- 5 files changed, 15 insertions(+), 40 deletions(-) delete mode 100644 api-configuration.sh create mode 100644 run.sh delete mode 100644 supervisor.conf diff --git a/Dockerfile b/Dockerfile index 0bc3412..d0d72b5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,6 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"] RUN apt-get update \ && apt-get install --no-install-recommends -y \ python3.10 ca-certificates wget sudo \ - curl supervisor jq \ && rm -rf /var/lib/apt/lists/* \ # # Download acestream @@ -31,12 +30,14 @@ RUN apt-get update \ && bash ./install_dependencies.sh \ && popd || exit -COPY supervisor.conf /etc/supervisor/conf.d/ -COPY api-configuration.sh / ENV ALLOW_REMOTE_ACCESS="no" +ENV HTTP_PORT=6878 +ENV EXTRA_FLAGS='' -ENTRYPOINT ["/usr/bin/supervisord"] -CMD ["-n", "-c", "/etc/supervisor/supervisord.conf"] +COPY run.sh / + +ENTRYPOINT ["/usr/bin/bash"] +CMD ["/run.sh"] EXPOSE 6878/tcp diff --git a/api-configuration.sh b/api-configuration.sh deleted file mode 100644 index 44c2d7a..0000000 --- a/api-configuration.sh +++ /dev/null @@ -1,13 +0,0 @@ -if [[ $ALLOW_REMOTE_ACCESS == "yes" ]];then - #wait until engine start - sleep 10 - - # Initial request to get the API access token - response=$(curl -s "http://localhost:6878/server/api?api_version=3&method=get_api_access_token") - - # Parse the token from the JSON response - token=$(echo $response | jq -r '.result.token') - - # Use the token in the next request to enable remote access - curl "http://localhost:6878/server/api?api_version=3&method=set_allow_remote_access&token=$token&value=1" -fi diff --git a/docker-compose.yml b/docker-compose.yml index debc2ff..d50cfe9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,3 +6,5 @@ services: - '6878:6878' environment: - ALLOW_REMOTE_ACCESS=no # change to "yes" to allow internet access + # add any extra command line option mentioned in https://docs.acestream.net/developers/engine-command-line-options/ + - EXTRA_FLAGS='' diff --git a/run.sh b/run.sh new file mode 100644 index 0000000..d6abb33 --- /dev/null +++ b/run.sh @@ -0,0 +1,7 @@ +if [[ $ALLOW_REMOTE_ACCESS == "yes" ]];then + EXTRA_FLAGS="$EXTRA_FLAGS --bind-all" +fi + +/opt/acestream/start-engine --client-console --http-port $HTTP_PORT $EXTRA_FLAGS + + diff --git a/supervisor.conf b/supervisor.conf deleted file mode 100644 index 8cc5959..0000000 --- a/supervisor.conf +++ /dev/null @@ -1,22 +0,0 @@ -[program:engine] -directory: / -command: /opt/acestream/start-engine --client-console --http-port 6878 -user: root -priority: 1 -autostart: true -autorestart: true -redirect_stderr=true -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 - -[program:api-configuration] -directory: / -command: /bin/bash api-configuration.sh -user: root -priority: 10 -autorestart = false -startretries = 0 -startsecs = 0 -redirect_stderr=true -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0