Skip to content

Commit

Permalink
Update v1.4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Apoorv Vyavahare committed Oct 2, 2021
1 parent 6cdadcb commit 699db11
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@
| DISPLAY | Display Server Port |
| PORT | NoVNC HTTP Port |
| NGROK_AUTH_TOKEN | Ngrok Token |
| NO_SLEEP | Prevent Heroku app from sleeping, disabled by default |
| APP_NAME | Name of Heroku app |

## **Installation :**
* Heroku Users :
Expand Down
10 changes: 10 additions & 0 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@
"description": "VNC Server Resolution in WxH, 720p is preferrable.",
"value" : "1280x720",
"required" : true
},
"NO_SLEEP" : {
"description": "Prevent app from sleeping, 1=on, 0=off",
"value" : "0",
"required" : true
},
"APP_NAME" : {
"description": "Name of the app, same as mentioned above.",
"value" : "",
"required" : true
}
}
}
5 changes: 5 additions & 0 deletions assets/configs/5-selfping.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[program:self-ping]
command=python3 /app/.vubuntu/assets/scripts/self-ping.py
stderr_logfile=/var/log/selfping.err.log
stdout_logfile=/var/log/selfping.out.log
priority=995
19 changes: 19 additions & 0 deletions assets/scripts/self-ping.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env python3
import os
from time import sleep
if __name__ == "__main__":
if os.getenv("NO_SLEEP") == "1":
if "APP_NAME" not in os.environ:
print("APP_NAME unset, terminating...")
exit()
app_name = os.getenv("APP_NAME")
while True:
try:
os.system(f"curl https://{app_name}.herokuapp.com")
except:
print("Ping failed, retrying...")
try:
os.system(f"curl -s https://{app_name}.herokuapp.com")
except:
print("Cannot ping app, terminating...")
sleep(25*60)

0 comments on commit 699db11

Please sign in to comment.