Skip to content

Commit

Permalink
Supported Docker & Updated Docs
Browse files Browse the repository at this point in the history
  • Loading branch information
soranoo committed Dec 24, 2023
1 parent 9706a17 commit 9c359f4
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 29 deletions.
40 changes: 21 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ Give me a ⭐ if you like it.
### Portal ↠ [Installation](docs/gettingstarted.md#installing-python-package) · [Usage](docs/gettingstarted.md#setting-up-tradingview-alert) · [Cloud Versions](docs/cloud-versions/cloud-versions.md) · [Videos](https://www.youtube.com/playlist?list=PLOHaKcov3Nkt0LIK1joPYgFnZY24zf_Wo)

## :newspaper: NEWS
###### <<< - 🎄 [Dec 24, 2023] 🎁 - >>>
Added Docker Version ([Read Docs](docs/gettingstarted.md#2-ngrok-version))

###### <<< - [Apr 07, 2023]- >>>
Added [tutorial videos](https://www.youtube.com/playlist?list=PLOHaKcov3Nkt0LIK1joPYgFnZY24zf_Wo)

###### <<< - 🎄 [Dec 24, 2022] 🎁 - >>>
[ngrok](https://ngrok.com/) version is now available! [[Read More](#👾-getting-started)]

Config file has been updated. Don't forget to update your existing config file.


Expand All @@ -32,28 +32,30 @@ Listen to the email inbox and transfer the TradingView alert email into the webh


## ⚓ Requirements
* Python 3.8.1 or latest (*Developed in Python 3.8.1)
* Python 3.8.1 or latest (*Developed in Python 3.8.1 & 3.10.11 & 3.11.6)
* A TradingView account
* See the installation guide for more details.

## 👾 Getting Started
- To install locally, check out the [Getting Started guide](docs/gettingstarted.md).
- To install locally or on Docker, check out the [Getting Started guide](docs/gettingstarted.md).
- To install on the cloud, check out the [Cloud Versions](docs/cloud-versions/cloud-versions.md).

##### Comparison - Local vs Cloud
| | Local (ngrok) | Local (traditional) | Cloud |
| --- | --- | --- |--- |
| **Runtime** | When your computer is on | When your computer is on | 24/7 |
| **Cost** | Free | Free | Free / Paid |
| **Setup** | 💀💀💀 | 💀💀 | 💀 |
| **Limitation** | None? | None? | Depends on the service provider |
| **Speed** | ⭐⭐⭐⭐ | ⭐⭐ | ⭐⭐⭐⭐⭐ |
| **Stability** | ⭐⭐⭐⭐⭐ || ⭐⭐⭐⭐⭐ |
| **Scalability** | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐ |
| **Recommendation** | ⭐⭐⭐⭐ | 🚫 | ⭐⭐⭐⭐⭐ |
| **Tutorial Video** | [Youtube](https://youtu.be/_ZN_rbH1OuM) | 🚫 | [Youtube](https://youtu.be/kTEcJhz0M98) |
| **Setup Docs** | [DOCS](docs/gettingstarted.md#2-ngrok-version) | [DOCS](docs/gettingstarted.md#3-traditional-version) | [DOCS](docs/cloud-versions/cloud-versions.md) |

##### Comparison - Local vs Docker vs Cloud
| | Local (traditional) | Local (ngrok) | Docker (ngrok) | Cloud |
| --- | --- | --- |--- | --- |
| **Uptime** | Depends on running the environment | Depends on running the environment | Depends on running the environment | 24/7 |
| **Cost** | Free | Free | Free | Free / Paid |
| **Setup** | 💀💀 | 💀💀💀 | 💀💀💀 | 💀 |
| **Limitation** | None? | None? | None? | Depends on the service provider |
| **Speed** | ⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ |
| **Stability** || ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ |
| **Scalability** | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐ |
| **Portability** | ⭐⭐ | ⭐⭐ | ⭐⭐⭐⭐⭐ | N/A |
| **Recommendation** | 🚫 | ⭐⭐⭐ | ⭐⭐⭐⭐⭐ | ⭐⭐⭐⭐⭐ |
| **Tutorial Video** | 🚫 | [Youtube](https://youtu.be/_ZN_rbH1OuM) | 🚫 | [Youtube](https://youtu.be/kTEcJhz0M98) |
| **Setup Docs** | [DOCS](docs/gettingstarted.md#3-traditional-version) | [DOCS](docs/gettingstarted.md#2-ngrok-version) | [DOCS](docs/gettingstarted.md#2-ngrok-version) | [DOCS](docs/cloud-versions/cloud-versions.md) |

> The ngrok Docker version setup is similar to the ngrok local version so I am not going to make a tutorial video for it.
## 📬 Notice
#### Local (traditional)
Expand Down
13 changes: 13 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: '3'
services:
TradingView-Free-Webhook-Alerts:
build:
context: .
dockerfile: ./Dockerfile
image: tradingview-free-webhook-alerts
container_name: tradingview-free-webhook-alerts
command: ["python3", "main.py"]
stdin_open: true
tty: true
volumes:
- .:/app
16 changes: 16 additions & 0 deletions dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM python:3.10.13-slim-bookworm

# Set the working directory to /app
WORKDIR /app

# Copy all local files to the container at /app
COPY . /app

# Upgrade pip
RUN pip install --upgrade pip

# Install dependencies defined in requirements.txt
RUN pip install -r requirements.txt

# Specify the command to run on container start
CMD ["python3", "main.py"]
6 changes: 4 additions & 2 deletions docs/cloud-versions/pipedream/pipedream.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
![img](imgs/setup_step_img_06.png)
9. Copy the code [[Click ME](/cloud-versions/pipedream.py)] and paste it into pipedream's code editor.

> ⚠️ You may have to copy and paste the code by splitting it into small parts if you can't paste the whole code at once. Please make sure all indent are correct.
> [!WARNING]\
> You may have to copy and paste the code by splitting it into small parts if you can't paste the whole code at once. Please make sure all indent are correct.
10. Input your configuration. [[Click ME](#configuration)]

Expand Down Expand Up @@ -67,7 +68,8 @@ webhook_urls = [
# ...
]
```
> 🐳Tips: It is a good idea to test your signal or the program using a webhook test service such as [webhook.site](https://webhook.site/) instead of using your production webhook.
> [!NOTE]\
> It is a good idea to test your signal or the program using a webhook test service such as [webhook.site](https://webhook.site/) instead of using your production webhook.
2. `discord_webhook_url` - (Optional) Discord webhook URL. Mainly for logging purposes. Leave it blank if you don't want to use it.

<a name="special-thanks"></a>
Expand Down
39 changes: 34 additions & 5 deletions docs/gettingstarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@

## ⚙️ Installation
- [Installing Python package](#installing-python-package)
- [ngrok Version](#ngrok-version) (recommended)
- [ngrok Version (Local / Docker)](#ngrok-version) (recommended)
- [Extra Requirement](#ngrok-version-extra-requirement)
- [Setup](ngrok-version-setup)
- [Configuration](#ngrok-version-configuration)
- [Find API KEY and ngrok URL](#ngrok-version-find-api-key-and-ngrok-url)
- [Branch - Local Version](#branch---local-version)
- [Branch - Docker Version](#branch---docker-version)
- [Setting up pipedream](#ngrok-version-setting-up-pipedream)
- [Traditional Version](#traditional-version)
- [Extra Requirement](#traditional-version-extra-requirement)
Expand All @@ -26,7 +28,7 @@
To install the Python package dependencies you have to type `pip install -r requirements.txt` into the command prompt which already cd into the project directory.

<a name="ngrok-version"></a>
## 2. ngrok Version
## 2. ngrok Version (Local / Docker)

### ▶️ Tutorial Video
- [Youtube](https://youtu.be/_ZN_rbH1OuM)
Expand All @@ -35,6 +37,7 @@ To install the Python package dependencies you have to type `pip install -r requ
### 2.1 Extra Requirement
* A [ngrok](https://ngrok.com/) account.
* A [pipedream](https://pipedream.com/) account or any other workflow
* [Docker Desktop](https://www.docker.com/products/docker-desktop/) (optional) - If you want to use the Docker version.
automation service.

<a name="ngrok-version-setup"></a>
Expand All @@ -50,14 +53,31 @@ automation service.
![img](imgs/ngrok_version_setup_01.png)
6. Fill in `webhook_urls` with your webhook service URLs.

> 🐳Tips: It is a good idea to test your signal or the program using a webhook test service such as [webhook.site](https://webhook.site/) instead of using your production webhook.
> [!NOTE]\
> It is a good idea to test your signal or the program using a webhook test service such as [webhook.site](https://webhook.site/) instead of using your production webhook.
7. Save the config file.

<a name="ngrok-version-find-api-key-and-ngrok-url"></a>
#### Find API KEY and ngrok URL

##### Branch - Local Version
8. Open the command prompt and cd into the project directory.
9. Type `pip install -r requirements.txt` to install the Python package dependencies.
10. Type `python main.py` to start the program.

##### Branch - Docker Version
8. Open the command prompt and cd into the project directory.
9. Type `docker-compose build` to build the docker image.
10. Type `docker-compose up` to start the program. (You can close the command prompt after finishing next step.)

> [!NOTE]\
> To view the program logs, simply click the name of the `tradingview-free-webhook-alerts` container. (You have to do this to get the API KEY and ngrok URL.)
> [!NOTE]\
> You have to run the `docker-compose build & docker-compose up` command if you updated the `config.toml`.
##### Both

11. Copy the "API KEY" and "ngrok URL" from the command prompt and paste them somewhere for later use.
![img](imgs/ngrok_version_setup_02.png)
12. Keep the program running in the background.
Expand Down Expand Up @@ -142,7 +162,8 @@ You must finish the following steps before using the program.

You can adjust other settings on your own.

> 🐳Tips: It is a good idea to test your signal or the program using a webhook test service such as [webhook.site](https://webhook.site/) instead of using your production webhook.
> [!NOTE]\
> It is a good idea to test your signal or the program using a webhook test service such as [webhook.site](https://webhook.site/) instead of using your production webhook.
<a name="setting-up-email-configuration"></a>
### 3.3 Setting up email configuration
Expand Down Expand Up @@ -177,6 +198,14 @@ You are good to go!
<a name="program-deployment"></a>
## 5. Program Deployment

#### Local (ngrok / traditional)
1. Open the command prompt and cd into the project directory.
2. Run `python main.py` in the command prompt.
> ⚠️ If you are using ngrok version, you will get a new API KEY and ngrok URL every time you start the program. You need to update the webhook service with the new API KEY and ngrok URL.

#### Docker (ngrok)
1. Open the Docker Desktop
2. Click to the "Containers" tab.
3. Click the "Run" button. (Inside the "Actions" column)

> [!WARNING]\
> If you are using ngrok version (Local / Docker), you will get a new API KEY and ngrok URL every time you start the program. You need to update the webhook service with the new API KEY and ngrok URL.
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
aiohttp==3.8.5
aiohttp==3.9.0
aiosignal==1.3.1
async-timeout==4.0.2
attrs==22.2.0
Expand Down Expand Up @@ -29,7 +29,7 @@ rich==11.1.0
six==1.16.0
soupsieve==2.3.1
toml==0.10.2
urllib3==1.26.8
urllib3==1.26.18
waitress==2.1.2
Werkzeug==2.3.3
Werkzeug==3.0.1
yarl==1.8.2

0 comments on commit 9c359f4

Please sign in to comment.