Skip to content

Commit 6905e15

Browse files
committed
async main
1 parent 38bf245 commit 6905e15

File tree

3 files changed

+40
-10
lines changed

3 files changed

+40
-10
lines changed

.github/workflows/docker.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Build and Push Docker Image
33
on:
44
push:
55
tags:
6-
- 'v*'
6+
- '*'
77

88
env:
99
REGISTRY: ghcr.io
@@ -36,8 +36,7 @@ jobs:
3636
with:
3737
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
3838
tags: |
39-
type=semver,pattern={{version}}
40-
type=semver,pattern={{major}}.{{minor}}
39+
type=ref,event=tag
4140
type=raw,value=latest
4241
4342
- name: Build and push Docker image

README.md

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This project will complete a news site like this one for Chinese people, it will
77
## Technologies used
88

99
- Front end: Gatsby, React, Tailwindcss
10-
- Telegram: Share news to the Telegram channel
10+
- Telegram Channel: User can subscribe to the channel to get the latest news
1111
- Telegram Bot: Monitor the operation of the system
1212
- Back end: Nodejs
1313
- Python: News crawling, content analysis, translation, publishing
@@ -19,11 +19,12 @@ This project will complete a news site like this one for Chinese people, it will
1919
- Cloud service: Cloudflare Pages, Cloudflare Images, Cloudflare Function
2020
- MongoDB: Store news list
2121
- Doppler: Store environment variables and secrets
22-
- OpenAI or Ollama: use GPT 3.5 or QWen2 7b to translate news content
22+
- OpenAI/Ollama: use GPT 3.5 or QWen2 7b to translate news content
2323
- Telegraph: Publish news content
24+
- Docker & Enroot: Run the service
2425
- CI/CD: React Testing Library, jest
2526
- pytest: Test the Python code
26-
- GitHub Actions: CI
27+
- GitHub Actions: CI and CD
2728
- PDM: Python package management
2829

2930
## Installation
@@ -47,6 +48,36 @@ curl -fsSL https://ollama.com/install.sh | sh
4748
ollama pull qwen2:7b-instruct
4849
```
4950

51+
##### Install enroot
52+
53+
```bash
54+
arch=$(dpkg --print-architecture)
55+
curl -fSsL -O https://github.com/NVIDIA/enroot/releases/download/v3.5.0/enroot_3.5.0-1_${arch}.deb
56+
curl -fSsL -O https://github.com/NVIDIA/enroot/releases/download/v3.5.0/enroot+caps_3.5.0-1_${arch}.deb # optional
57+
sudo apt install -y ./*.deb
58+
```
59+
60+
##### Install VOCNews
61+
62+
```bash
63+
rm *.sqsh
64+
enroot import docker://ghcr.io#hdcola/vocnews:latest
65+
enroot create -f --name vocnews hdcola+vocnews+latest.sqsh
66+
```
67+
68+
##### Start VOCNews
69+
70+
```bash
71+
enroot start -e DOPPLER_TOKEN=your_doppler_token -m host_dir:/home/yourname vocnews
72+
```
73+
74+
If you want to enter the container, you can use the following command:
75+
76+
```bash
77+
enroot start vocnews /bin/bash
78+
```
79+
80+
#####
5081

5182

5283
## Special features
@@ -57,7 +88,7 @@ ollama pull qwen2:7b-instruct
5788
- [x] Translate news content into Chinese with OpenAI or Ollama's local LLM
5889
- [x] Convert HTML to Telegraph format and publish to Telegraph
5990
- [x] Publish news to the Telegram channel
60-
- [ ] Fully automated updating and operation
91+
- [x] Fully automated updating and operation
6192
- [ ] Share to social media can be friendly to display content
6293
- [ ] Automatic posting to websites and Telegram channels
6394
- [ ] Telegram Bot allows you to monitor the operation of your system

src/feedrss.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ async def process_entry(entity):
4343
)
4444

4545

46-
def main() -> None:
46+
async def main() -> None:
4747
"""Main execution function to fetch and store RSS feed data."""
4848
try:
4949

@@ -59,7 +59,7 @@ def main() -> None:
5959
for entity in entities:
6060
log.info(f"Processing: {
6161
entity['published']}-{entity['title']} \n {entity['link']} \n {entity['image']}")
62-
asyncio.run(process_entry(entity))
62+
await process_entry(entity)
6363
else:
6464
log.info("No new entries found")
6565

@@ -69,4 +69,4 @@ def main() -> None:
6969

7070

7171
if __name__ == "__main__":
72-
main()
72+
asyncio.run(main())

0 commit comments

Comments
 (0)