This commit is contained in:
parent
6231d42bfd
commit
fc55f479fa
3
.dockerignore
Normal file
3
.dockerignore
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
*.env
|
||||||
|
*.md
|
||||||
|
*drone*
|
18
.drone.yml
Normal file
18
.drone.yml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
kind: pipeline
|
||||||
|
name: default
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: docker
|
||||||
|
image: plugins/docker
|
||||||
|
settings:
|
||||||
|
registry: git.jbranan.com
|
||||||
|
dry_run: false
|
||||||
|
username: jblu
|
||||||
|
password:
|
||||||
|
from_secret: gittea_drone
|
||||||
|
repo: git.jbranan.com/jblu/phc
|
||||||
|
tags:
|
||||||
|
- latest
|
||||||
|
when:
|
||||||
|
branch:
|
||||||
|
- main
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
*.env
|
6
Dockerfile
Normal file
6
Dockerfile
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
from alpine:latest
|
||||||
|
RUN apk add --no-cache curl
|
||||||
|
COPY . opt
|
||||||
|
RUN crontab /opt/crontab
|
||||||
|
RUN chmod +x /opt/entrypoint.sh
|
||||||
|
CMD ["/opt/entrypoint.sh"]
|
1
crontab
Normal file
1
crontab
Normal file
@ -0,0 +1 @@
|
|||||||
|
*/30 * * * * . /etc/environment; bash /opt/phc.sh >> /logfile
|
5
entrypoint.sh
Normal file
5
entrypoint.sh
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
printenv | grep -v "no_proxy" >> /etc/environment
|
||||||
|
|
||||||
|
crond -f
|
15
phc.sh
Normal file
15
phc.sh
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
: "${PHC_PLEX_SECRET_TOKEN:?Must set PHC_SECRET_TOKEN env variable}"
|
||||||
|
: "${PHC_HEALTHCHECK_URL:?Must set PHC_HEALTHCHECK_URL env variable}"
|
||||||
|
: "${PHC_HEALTHCHECK_ID:?Must set PHC_HEALTHCHECK_ID env variable}"
|
||||||
|
: "${PHC_PLEX_HOST:?Must set PHC_PLEX_HOST env variable}"
|
||||||
|
: "${PHC_PLEX_PORT:-32400}"
|
||||||
|
: "${PHC_PLEX_PROTOCOL:-"http"}"
|
||||||
|
|
||||||
|
URL="${PHC_PLEX_PROTOCOL}://${PHC_PLEX_HOST}:${PHC_PLEX_PORT}/connections?X-Plex-Token=${PHC_PLEX_SECRET_TOKEN}"
|
||||||
|
|
||||||
|
ping_hc() {
|
||||||
|
curl -fsS -m 10 --retry 5 -o /dev/null --data-raw "$2" "${PHC_HEALTHCHECK_URL}/ping/${PHC_HEALTHCHECK_ID}/$1"
|
||||||
|
}
|
||||||
|
|
||||||
|
connections=$(set -x; { wget --no-check-certificate -nv -O - "$URL"; } 2>&1)
|
||||||
|
ping_hc "$?" "$connections"
|
Loading…
x
Reference in New Issue
Block a user