Skip to content

Commit

Permalink
Configure remote access via environment variable (#25)
Browse files Browse the repository at this point in the history
Co-authored-by: Ibrahim Ercan <[email protected]>
  • Loading branch information
iercan and Ibrahim Ercan authored Aug 30, 2024
1 parent 9b8e577 commit a91b9d7
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 8 deletions.
11 changes: 8 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@ RUN apt-get update \
&& bash ./install_dependencies.sh \
&& popd || exit

RUN apt install -y curl supervisor jq

Check failure on line 33 in Dockerfile

View workflow job for this annotation

GitHub Actions / linter

DL3027 warning: Do not use apt as it is meant to be a end-user tool, use apt-get or apt-cache instead

Check failure on line 33 in Dockerfile

View workflow job for this annotation

GitHub Actions / linter

DL3059 info: Multiple consecutive `RUN` instructions. Consider consolidation.

Check failure on line 33 in Dockerfile

View workflow job for this annotation

GitHub Actions / linter

DL3027 warning: Do not use apt as it is meant to be a end-user tool, use apt-get or apt-cache instead

Check failure on line 33 in Dockerfile

View workflow job for this annotation

GitHub Actions / linter

DL3059 info: Multiple consecutive `RUN` instructions. Consider consolidation.
COPY supervisor.conf /etc/supervisor/conf.d/
COPY api-configuration.sh /
ENV ALLOW_REMOTE_ACCESS="no"

EXPOSE 80/tcp
ENTRYPOINT ["/usr/bin/supervisord"]
CMD ["-n", "-c", "/etc/supervisor/supervisord.conf"]

EXPOSE 6878/tcp

ENTRYPOINT ["/opt/acestream/start-engine"]
CMD ["--client-console", "--http-port", "80"]
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Note: ARM-based CPUs are not currently supported, see issues [#5] and [#13].
Ensure you have [Docker](https://www.docker.com) installed and running. You can then pull down and run the container as shown below.

```console
docker run -t -p 80:80 ghcr.io/martinbjeldbak/acestream-http-proxy
docker run -t -p 6878:6878 martinbjeldbak/acestream-http-proxy
```

You are then able to access AceStreams by pointing your favorite media player
Expand All @@ -28,19 +28,19 @@ streaming protocol.

For HLS:
```console
http://127.0.0.1/ace/manifest.m3u8?id=dd1e67078381739d14beca697356ab76d49d1a2
http://127.0.0.1:6878/ace/manifest.m3u8?id=dd1e67078381739d14beca697356ab76d49d1a2
```

For MPEG-TS:

```console
http://127.0.0.1/ace/getstream?id=dd1e67078381739d14beca697356ab76d49d1a2
http://127.0.0.1:6878/ace/getstream?id=dd1e67078381739d14beca697356ab76d49d1a2
```

where `dd1e67078381739d14beca697356ab76d49d1a2d` is the ID of the AceStream channel.

This image can also be deployed to a server, where it can proxy AceStream
content over HTTP.
content over HTTP. To able to reach it from remote you need to set ALLOW_REMOTE_ACCESS=yes as environment variable

## Contributing

Expand Down
13 changes: 13 additions & 0 deletions api-configuration.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
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
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ services:
app:
build: .
ports:
- '6878:80'
- '6878:6878'
environment:
- ALLOW_REMOTE_ACCESS=no
22 changes: 22 additions & 0 deletions supervisor.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
[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

0 comments on commit a91b9d7

Please sign in to comment.