mirror of
https://github.com/tgdrive/teldrive.git
synced 2025-02-24 15:05:41 +08:00
ci: Update Dockerfile and release workflow
This commit is contained in:
parent
4efc7c2591
commit
0ba9d1a5c3
3 changed files with 52 additions and 47 deletions
2
.github/workflows/release.yml
vendored
2
.github/workflows/release.yml
vendored
|
@ -38,7 +38,7 @@ jobs:
|
||||||
|
|
||||||
- name: Set env
|
- name: Set env
|
||||||
run: |
|
run: |
|
||||||
echo "GORELEASER_PREVIOUS_TAG=$(git tag --sort=committerdate | grep -E '[0-9]+\.[0-9]+\.[0-9]+$' | tail -2 | head -1)" >> $GITHUB_ENV
|
echo "GORELEASER_PREVIOUS_TAG=$(git tag --sort=v:refname | grep -E '[0-9]+\.[0-9]+\.[0-9]+$' | tail -2 | head -1)" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Run GoReleaser
|
- name: Run GoReleaser
|
||||||
uses: goreleaser/goreleaser-action@v5
|
uses: goreleaser/goreleaser-action@v5
|
||||||
|
|
95
README.md
95
README.md
|
@ -33,13 +33,11 @@ services:
|
||||||
container_name: teldrive
|
container_name: teldrive
|
||||||
volumes:
|
volumes:
|
||||||
- ./teldrive.db:/teldrive.db:rw
|
- ./teldrive.db:/teldrive.db:rw
|
||||||
- ./logs:/logs:rw
|
- ./config.toml:/config.toml
|
||||||
env_file: teldrive.env
|
|
||||||
ports:
|
ports:
|
||||||
- 8080:8080
|
- 8080:8080
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
***People Who want to use local Postgres instance***
|
***People Who want to use local Postgres instance***
|
||||||
```docker
|
```docker
|
||||||
version: "3.8"
|
version: "3.8"
|
||||||
|
@ -51,8 +49,7 @@ services:
|
||||||
container_name: teldrive
|
container_name: teldrive
|
||||||
volumes:
|
volumes:
|
||||||
- ./teldrive.db:/teldrive.db:rw
|
- ./teldrive.db:/teldrive.db:rw
|
||||||
- ./logs:/logs:rw
|
- ./config.toml:/config.toml
|
||||||
env_file: teldrive.env
|
|
||||||
ports:
|
ports:
|
||||||
- 8080:8080
|
- 8080:8080
|
||||||
depends_on:
|
depends_on:
|
||||||
|
@ -66,20 +63,31 @@ services:
|
||||||
- POSTGRES_USER=teldrive
|
- POSTGRES_USER=teldrive
|
||||||
- POSTGRES_PASSWORD=secret
|
- POSTGRES_PASSWORD=secret
|
||||||
volumes:
|
volumes:
|
||||||
- teldrive_db:/var/lib/postgresql/data
|
- ./postgres_data:/var/lib/postgresql/data
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD", "pg_isready", "-U", "teldrive"]
|
test: ["CMD", "pg_isready", "-U", "teldrive"]
|
||||||
interval: 10s
|
interval: 10s
|
||||||
start_period: 30s
|
start_period: 30s
|
||||||
|
|
||||||
volumes:
|
|
||||||
teldrive_db:
|
|
||||||
```
|
```
|
||||||
|
|
||||||
**Follow Below Steps**
|
**Follow Below Steps**
|
||||||
|
|
||||||
- Create the `teldrive.env` file with your variables and start your container.See how to fill env file below.
|
- Create the `config.toml` file with your values and start your container. See how to fill file below.
|
||||||
|
|
||||||
|
```toml
|
||||||
|
#config.toml
|
||||||
|
[db]
|
||||||
|
data-source = "postgres://<db username>:<db password>@<db host>/<db name>"
|
||||||
|
|
||||||
|
[jwt]
|
||||||
|
secret = "abcd"
|
||||||
|
|
||||||
|
[tg]
|
||||||
|
app-id =
|
||||||
|
app-hash = "fwfwfwf"
|
||||||
|
```
|
||||||
|
***Only these values are mandatory however you can change or
|
||||||
|
tweak your config see more in advanced configurations below***.
|
||||||
```sh
|
```sh
|
||||||
touch teldrive.db
|
touch teldrive.db
|
||||||
docker compose up -d
|
docker compose up -d
|
||||||
|
@ -92,24 +100,13 @@ docker compose up -d
|
||||||
|
|
||||||
- Download the release binary of Teldrive from the releases section.
|
- Download the release binary of Teldrive from the releases section.
|
||||||
|
|
||||||
- Add same env file as above.
|
- Add same config file as above.
|
||||||
- Now, run the Teldrive executable binary directly.
|
- Now, run the Teldrive executable binary directly.
|
||||||
|
- You can also set up without config file.
|
||||||
## Setting up things
|
|
||||||
|
|
||||||
If you're locally or remotely hosting, create a file named `teldrive.env` in the root directory and add all the mandatory variables there.
|
|
||||||
An example of `teldrive.env` file:
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
APP_ID=1234
|
teldrive run --tg-app-id="" --tg-app-hash="" --jwt-secret="" --db-data-source=""
|
||||||
APP_HASH=abc
|
|
||||||
JWT_SECRET=abc
|
|
||||||
DATABASE_URL=postgres://<db username>:<db password>@<db host>/<db name>
|
|
||||||
```
|
|
||||||
When used with local postgres instance above:
|
|
||||||
```
|
|
||||||
DATABASE_URL=postgres://POSTGRES_USER:POSTGRES_PASSWORD@db/teldrive
|
|
||||||
```
|
```
|
||||||
|
|
||||||
**Generate JWT**
|
**Generate JWT**
|
||||||
```bash
|
```bash
|
||||||
$ openssl rand -hex 32
|
$ openssl rand -hex 32
|
||||||
|
@ -125,26 +122,36 @@ You can generate secret from [here](https://generate-secret.vercel.app/32).
|
||||||
- Teldrive supports image thumbnail resizing on the fly. To enable this, you have to deploy a separate image resize service from [here](https://github.com/divyam234/image-resize).
|
- Teldrive supports image thumbnail resizing on the fly. To enable this, you have to deploy a separate image resize service from [here](https://github.com/divyam234/image-resize).
|
||||||
- After deploying this service, add its URL in Teldrive UI settings in the **Resize Host** field.
|
- After deploying this service, add its URL in Teldrive UI settings in the **Resize Host** field.
|
||||||
|
|
||||||
### Env Variables
|
### Advanced Configuration
|
||||||
|
|
||||||
| Variable | Required | Description |
|
**cli options**
|
||||||
| --------------- | -------- | ----------------------------------------------------------------------------------------- |
|
|
||||||
| `APP_ID` | Yes | API ID for your Telegram account, which can be obtained from my.telegram.org. |
|
|
||||||
| `APP_HASH` | Yes | API HASH for your Telegram account, which can be obtained from my.telegram.org. |
|
|
||||||
| `JWT_SECRET` | Yes | Used for signing JWT tokens. |
|
|
||||||
| `DATABASE_URL` | Yes | Connection String obtained from Postgres DB (you can use Neon db as a free alternative for Postgres). |
|
|
||||||
|
|
||||||
| Variable | Default Value | Required | Description |
|
```sh
|
||||||
|--------------------|---------------|----------|-------------------------------------------------------------------------------------------|
|
teldrive run --help
|
||||||
| `HTTPS` | false | NO | Needed for cross domain setup. |
|
```
|
||||||
| `PORT` | 8080 | NO | Change default listen port. |
|
| Flag Name | Description | Required | Default Value |
|
||||||
| `ALLOWED_USERS` | | NO | Allow certain Telegram usernames, including yours, to access the app. |
|
|-------------------------------------|---------------------------------------------------|----------|-------------------------------------------------------|
|
||||||
| `COOKIE_SAME_SITE` | true | NO | Needed for cross domain setup. |
|
| --jwt-secret | JWT secret key | Yes | "" |
|
||||||
| `BG_BOTS_LIMIT` | 5 | NO | Start at most BG_BOTS_LIMIT no of bots in the background to prevent connection recreation on every request (Default 5). |
|
| --db-data-source | Database connection string | Yes | "" |
|
||||||
| `UPLOAD_RETENTION` | 15 | NO | No of days to keep incomplete uploads parts in the channel; afterwards, these parts are deleted. |
|
| --tg-app-id | API ID for your Telegram account, which can be obtained from my.telegram.org. | Yes | 0 |
|
||||||
| `ENCRYPTION_KEY` | | NO | Password for Encrypting files. |
|
| --tg-app-hash | API HASH for your Telegram account, which can be obtained from my.telegram.org. | Yes | "" |
|
||||||
| `DEV` | false | NO | DEV mode to enable debug logging. |
|
| --jwt-allowed-users | Allow certain Telegram usernames, including yours, to access the app. |No | "" |
|
||||||
| `LOG_SQL` | false | NO | Log SQL queries. |
|
| --tg-uploads-encryption-key | Encryption key for encrypting files. | No | "" |
|
||||||
|
| --config, -c | Config file. | No | $HOME/.teldrive/config.toml |
|
||||||
|
| --server-port, -p | Server port | No | 8080 |
|
||||||
|
| --log-level | Logging level | No | -1 (Debug) |
|
||||||
|
| --tg-rate-limit | Enable rate limiting | No | true |
|
||||||
|
| --tg-rate-burst | Limiting burst | No | 5 |
|
||||||
|
| --tg-rate | Limiting rate | No | 100 |
|
||||||
|
| --tg-bg-bots-limit | Start at most this no of bots in the background to prevent connection recreation on every request.Increase this if you are streaming or downloading large no of files simultaneously. | No | 5
|
||||||
|
| --tg-uploads-threads | Concurrent Uploads threads for uploading file | No | 16 |
|
||||||
|
| --tg-uploads-retention | Uploads retention duration.Duration to keep failed uploaded chunks in db for resuming uploads. | No | 360h (30 days) |
|
||||||
|
|
||||||
|
|
||||||
|
**You Can also set config values through env varibles.**
|
||||||
|
- For example ```tg-session-file``` will become ```TELDRIVE_TG_SESSION_FILE``` same for all possible flags.
|
||||||
|
|
||||||
|
- See ```config.sample.toml``` in repo if you want to setup advanced configurations through toml file.
|
||||||
|
|
||||||
> [!WARNING]
|
> [!WARNING]
|
||||||
> Keep your Password safe once generated teldrive uses same encryption as of rclone internally
|
> Keep your Password safe once generated teldrive uses same encryption as of rclone internally
|
||||||
|
@ -179,8 +186,6 @@ encrypt_files = false # Enable this to encrypt files make sure ENCRYPTION_KEY en
|
||||||
|
|
||||||
- **Data Hoarding:** Avoid excessive data hoarding, as it not only violates Telegram's terms but also leads to unnecessary wastage of storage space.
|
- **Data Hoarding:** Avoid excessive data hoarding, as it not only violates Telegram's terms but also leads to unnecessary wastage of storage space.
|
||||||
|
|
||||||
- **No Netflix Clones:** Refrain from using this service to create your own Netflix-like platform. Saving large amounts of movies or content for personal media servers is discouraged, as it goes against the intended use of Telegram.
|
|
||||||
|
|
||||||
### Additional Recommendations:
|
### Additional Recommendations:
|
||||||
|
|
||||||
- **Responsible Storage:** Be mindful of the content you store on Telegram. Utilize storage efficiently and only keep data that serves a purpose.
|
- **Responsible Storage:** Be mindful of the content you store on Telegram. Utilize storage efficiently and only keep data that serves a purpose.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
FROM scratch
|
FROM scratch
|
||||||
COPY teldrive /teldrive
|
COPY teldrive /teldrive
|
||||||
EXPOSE 8080
|
EXPOSE 8080
|
||||||
ENTRYPOINT ["/teldrive"]
|
ENTRYPOINT ["/teldrive","run"]
|
Loading…
Reference in a new issue