Skip to content

Commit 8385907

Browse files
committed
Added heroku support
1 parent 952a661 commit 8385907

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed

README.md

+50
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,56 @@ sudo docker build . -t mirror-bot
102102
sudo docker run mirror-bot
103103
```
104104

105+
## Deploying on Heroku
106+
- Run the script to generate token file(token.pickle) for Google Drive:
107+
```
108+
python3 generate_drive_token.py
109+
```
110+
- Install [Heroku cli](https://devcenter.heroku.com/articles/heroku-cli)
111+
- Login into your heroku account with command:
112+
```
113+
heroku login
114+
```
115+
- Create a new heroku app:
116+
```
117+
heroku create appname
118+
```
119+
- Select This App in your Heroku-cli:
120+
```
121+
heroku git:remote -a appname
122+
```
123+
- Change Dyno Stack to a Docker Container:
124+
```
125+
heroku stack:set container
126+
```
127+
- Add Private Credentials and Config Stuff:
128+
```
129+
git add -f credentials.json token.pickle config.env heroku.yml
130+
```
131+
- Commit new changes:
132+
```
133+
git commit -m "Added Creds."
134+
```
135+
- Push Code to Heroku:
136+
```
137+
git push heroku master --force
138+
```
139+
- Restart Worker by these commands:
140+
```
141+
heroku ps:scale worker=0
142+
```
143+
```
144+
heroku ps:scale worker=1
145+
```
146+
Heroku-Note: Doing authorizations ( /authorize command ) through telegram wont be permanent as heroku uses ephemeral filesystem. They will be reset on each dyno boot. As a workaround you can:
147+
- Make a file authorized_chats.txt and write the user names and chat_id of you want to authorize, each separated by new line
148+
- Then force add authorized_chats.txt to git and push it to heroku
149+
```
150+
git add authorized_chats.txt -f
151+
git commit -asm "Added hardcoded authorized_chats.txt"
152+
git push heroku heroku:master
153+
```
154+
105155
# Using service accounts for uploading to avoid user rate limit
106156
For Service Account to work, you must set USE_SERVICE_ACCOUNTS="True" in config file or environment variables
107157
Many thanks to [AutoRClone](https://github.com/xyou365/AutoRclone) for the scripts

heroku.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
build:
2+
docker:
3+
worker: Dockerfile
4+
run:
5+
worker: bash start.sh

0 commit comments

Comments
 (0)