mirror of
https://github.com/danog/TelegramApiServer.git
synced 2024-11-26 11:54:42 +01:00
Feat: upgrade docker entrypoint logic
This commit is contained in:
parent
87eb160c6f
commit
986aebafe7
@ -28,4 +28,4 @@ RUN apt-get update && apt-get upgrade -y \
|
|||||||
|
|
||||||
EXPOSE 9503
|
EXPOSE 9503
|
||||||
|
|
||||||
ENTRYPOINT docker-compose-wait && nice -n 20 php server.php -e=.env.docker --docker -s=*
|
ENTRYPOINT ["./entrypoint.sh"]
|
16
README.md
16
README.md
@ -30,7 +30,7 @@ Fast, simple, async php telegram api server:
|
|||||||
### Manual:
|
### Manual:
|
||||||
1. Requirements:
|
1. Requirements:
|
||||||
* ssh / cli
|
* ssh / cli
|
||||||
* php 7.4 or php 8
|
* php 8.1+
|
||||||
* composer
|
* composer
|
||||||
* git
|
* git
|
||||||
* Mysql/MariaDB (optional)
|
* Mysql/MariaDB (optional)
|
||||||
@ -50,9 +50,7 @@ Fast, simple, async php telegram api server:
|
|||||||
1. Fill app_id and app_hash in `.env.docker` or `.env`.
|
1. Fill app_id and app_hash in `.env.docker` or `.env`.
|
||||||
1. Start TelegramApiServer in cli:
|
1. Start TelegramApiServer in cli:
|
||||||
* docker:
|
* docker:
|
||||||
1. Start: `docker-compose up`
|
1. Start container interactively: `docker-compose run --rm telegram-api-server`
|
||||||
1. Start new shell and connect to docker container: `bash bin/docker-exec.sh`
|
|
||||||
1. Start another instance with different port inside new shell: `php server.php -p=9500 -s=session --docker -e=.env.docker`
|
|
||||||
* manual:
|
* manual:
|
||||||
1. `php server.php --session=session`
|
1. `php server.php --session=session`
|
||||||
1. Authorize your session:
|
1. Authorize your session:
|
||||||
@ -92,7 +90,7 @@ Fast, simple, async php telegram api server:
|
|||||||
1. Access Telegram API with simple GET/POST requests.
|
1. Access Telegram API with simple GET/POST requests.
|
||||||
|
|
||||||
Regular and application/json POST supported.
|
Regular and application/json POST supported.
|
||||||
Its recommended to use http_build_query, when using GET requests.
|
It's recommended to use http_build_query, when using GET requests.
|
||||||
|
|
||||||
**Rules:**
|
**Rules:**
|
||||||
* All methods from MadelineProto supported: [Methods List](https://docs.madelineproto.xyz/API_docs/methods/)
|
* All methods from MadelineProto supported: [Methods List](https://docs.madelineproto.xyz/API_docs/methods/)
|
||||||
@ -229,6 +227,9 @@ curl --location --request POST '127.0.0.1:9503/api/downloadToResponse' \
|
|||||||
Also see: https://docs.madelineproto.xyz/docs/FILES.html#downloading-files
|
Also see: https://docs.madelineproto.xyz/docs/FILES.html#downloading-files
|
||||||
|
|
||||||
### Multiple sessions support
|
### Multiple sessions support
|
||||||
|
**WARNING: running multiple sessions in one instance is unstable.**
|
||||||
|
Crash/error in one session will crash all of them.
|
||||||
|
Correct way: override docker-compose.yml and add containers with different ports and session names for each session.
|
||||||
|
|
||||||
When running multiple sessions, need to define which session to use for request.
|
When running multiple sessions, need to define which session to use for request.
|
||||||
Each session stored in `sessions/{$session}.madeline`. Nested folders supported.
|
Each session stored in `sessions/{$session}.madeline`. Nested folders supported.
|
||||||
@ -273,7 +274,7 @@ Each session stored in `sessions/{$session}.madeline`. Nested folders supported.
|
|||||||
These settings will be saved into json file and will apply after the restart.
|
These settings will be saved into json file and will apply after the restart.
|
||||||
|
|
||||||
### Session management
|
### Session management
|
||||||
|
|
||||||
**Examples:**
|
**Examples:**
|
||||||
* Session list: `http://127.0.0.1:9503/system/getSessionList`
|
* Session list: `http://127.0.0.1:9503/system/getSessionList`
|
||||||
* Adding session: `http://127.0.0.1:9503/system/addSession?session=users/xtrime`
|
* Adding session: `http://127.0.0.1:9503/system/addSession?session=users/xtrime`
|
||||||
@ -285,7 +286,8 @@ Each session stored in `sessions/{$session}.madeline`. Nested folders supported.
|
|||||||
|
|
||||||
Full list of system methods available in [SystemApiExtensions class](https://github.com/xtrime-ru/TelegramApiServer/blob/master/src/MadelineProtoExtensions/SystemApiExtensions.php)
|
Full list of system methods available in [SystemApiExtensions class](https://github.com/xtrime-ru/TelegramApiServer/blob/master/src/MadelineProtoExtensions/SystemApiExtensions.php)
|
||||||
|
|
||||||
### Authorizing session remotely
|
### Authorizing session remotely
|
||||||
|
WARNING: it is recomended to use interactive mode to authorize sessions!
|
||||||
If there is no authorization in session, or session file is blank, authorization required:
|
If there is no authorization in session, or session file is blank, authorization required:
|
||||||
|
|
||||||
User:
|
User:
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
docker exec -it telegram-api-server /bin/bash
|
|
@ -1,3 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
docker logs telegram-api-server --follow
|
|
@ -21,6 +21,8 @@ services:
|
|||||||
options:
|
options:
|
||||||
max-size: "1024k"
|
max-size: "1024k"
|
||||||
max-file: "2"
|
max-file: "2"
|
||||||
|
command:
|
||||||
|
- "-s=session"
|
||||||
mysql:
|
mysql:
|
||||||
image: mariadb:10.8
|
image: mariadb:10.8
|
||||||
container_name: telegram-api-server-mysql
|
container_name: telegram-api-server-mysql
|
||||||
|
4
entrypoint.sh
Executable file
4
entrypoint.sh
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
docker-compose-wait \
|
||||||
|
&& nice -n 20 php server.php -e=.env.docker --docker "$@"
|
Loading…
Reference in New Issue
Block a user