Compare commits
10 Commits
d89bd69ee5
...
main
Author | SHA1 | Date | |
---|---|---|---|
5878b88a38 | |||
054cbd3e93 | |||
344fcef7d6 | |||
1a2bb566c1 | |||
8b73888082 | |||
32a9b1745d | |||
0b011a28fd | |||
1ac4eb822c | |||
1ac06a288a | |||
c4ffcee3a3 |
65
.drone.yml
65
.drone.yml
@ -5,19 +5,33 @@ steps:
|
|||||||
- name: docker
|
- name: docker
|
||||||
image: plugins/docker
|
image: plugins/docker
|
||||||
settings:
|
settings:
|
||||||
registry: git.jbranan.com
|
registry: git.jonb.io
|
||||||
dry_run: false
|
dry_run: false
|
||||||
username: jblu
|
username: jblu
|
||||||
password:
|
password:
|
||||||
from_secret: gittea_drone
|
from_secret: gittea_drone
|
||||||
repo: git.jbranan.com/jblu/phc
|
repo: git.jonb.io/jblu/phc
|
||||||
tags:
|
tags:
|
||||||
- latest
|
- latest
|
||||||
when:
|
when:
|
||||||
branch:
|
branch:
|
||||||
- main
|
- main
|
||||||
- name: test
|
- name: docker-dev
|
||||||
image: git.jbranan.com/jblu/phc:latest
|
image: plugins/docker
|
||||||
|
settings:
|
||||||
|
registry: git.jonb.io
|
||||||
|
dry_run: false
|
||||||
|
username: jblu
|
||||||
|
password:
|
||||||
|
from_secret: gittea_drone
|
||||||
|
repo: git.jonb.io/jblu/phc
|
||||||
|
tags:
|
||||||
|
- dev
|
||||||
|
when:
|
||||||
|
branch:
|
||||||
|
- dev*
|
||||||
|
- name: test-main
|
||||||
|
image: git.jonb.io/jblu/phc:latest
|
||||||
environment:
|
environment:
|
||||||
PHC_PLEX_SECRET_TOKEN:
|
PHC_PLEX_SECRET_TOKEN:
|
||||||
from_secret: PHC_PLEX_SECRET_TOKEN
|
from_secret: PHC_PLEX_SECRET_TOKEN
|
||||||
@ -25,17 +39,40 @@ steps:
|
|||||||
from_secret: PHC_HEALTHCHECK_URL
|
from_secret: PHC_HEALTHCHECK_URL
|
||||||
PHC_HEALTHCHECK_ID:
|
PHC_HEALTHCHECK_ID:
|
||||||
from_secret: PHC_HEALTHCHECK_ID
|
from_secret: PHC_HEALTHCHECK_ID
|
||||||
PHC_PLEX_HOST:
|
PHC_PLEX_URL:
|
||||||
from_secret: PHC_PLEX_HOST
|
from_secret: PHC_PLEX_URL
|
||||||
PHC_PLEX_PROTOCOL:
|
CRON:
|
||||||
from_secret: PHC_PLEX_PROTOCOL
|
from_secret: CRON
|
||||||
PHC_PLEX_PORT:
|
|
||||||
from_secret: PHC_PLEX_PORT
|
|
||||||
commands:
|
commands:
|
||||||
- echo $PHC_PLEX_SECRET_TOKEN
|
- echo $PHC_PLEX_SECRET_TOKEN
|
||||||
- echo $PHC_HEALTHCHECK_URL
|
- echo $PHC_HEALTHCHECK_URL
|
||||||
- echo $PHC_HEALTHCHECK_ID
|
- echo $PHC_HEALTHCHECK_ID
|
||||||
- echo $PHC_PLEX_HOST
|
- echo $PHC_PLEX_URL
|
||||||
- echo $PHC_PLEX_PROTOCOL
|
- echo $CRON
|
||||||
- echo $PHC_PLEX_PORT
|
- /bin/sh /opt/phc.sh
|
||||||
- /bin/sh /opt/phc.sh
|
when:
|
||||||
|
branch:
|
||||||
|
- main
|
||||||
|
- name: test-dev
|
||||||
|
image: git.jonb.io/jblu/phc:dev
|
||||||
|
environment:
|
||||||
|
PHC_PLEX_SECRET_TOKEN:
|
||||||
|
from_secret: PHC_PLEX_SECRET_TOKEN
|
||||||
|
PHC_HEALTHCHECK_URL:
|
||||||
|
from_secret: PHC_HEALTHCHECK_URL
|
||||||
|
PHC_HEALTHCHECK_ID:
|
||||||
|
from_secret: PHC_HEALTHCHECK_ID
|
||||||
|
PHC_PLEX_URL:
|
||||||
|
from_secret: PHC_PLEX_URL
|
||||||
|
CRON:
|
||||||
|
from_secret: CRON
|
||||||
|
commands:
|
||||||
|
- echo $PHC_PLEX_SECRET_TOKEN
|
||||||
|
- echo $PHC_HEALTHCHECK_URL
|
||||||
|
- echo $PHC_HEALTHCHECK_ID
|
||||||
|
- echo $PHC_PLEX_URL
|
||||||
|
- echo $CRON
|
||||||
|
- /bin/sh /opt/phc.sh
|
||||||
|
when:
|
||||||
|
branch:
|
||||||
|
- dev*
|
@ -1,9 +1,7 @@
|
|||||||
from alpine:latest
|
FROM alpine:latest
|
||||||
RUN apk add --no-cache curl
|
RUN apk add --no-cache curl supercronic
|
||||||
COPY crontab opt
|
|
||||||
COPY entrypoint.sh opt
|
COPY entrypoint.sh opt
|
||||||
COPY phc.sh opt
|
COPY phc.sh opt
|
||||||
RUN crontab /opt/crontab
|
|
||||||
RUN chmod +x /opt/entrypoint.sh
|
RUN chmod +x /opt/entrypoint.sh
|
||||||
RUN chmod +x /opt/phc.sh
|
RUN chmod +x /opt/phc.sh
|
||||||
CMD ["/opt/entrypoint.sh"]
|
CMD ["/opt/entrypoint.sh"]
|
@ -1,5 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
printenv | grep -v "no_proxy" >> /etc/environment
|
CRON_CONFIG_FILE="/opt/crontab"
|
||||||
|
|
||||||
crond -f
|
echo "${CRON} sh /opt/phc.sh" > $CRON_CONFIG_FILE
|
||||||
|
|
||||||
|
exec supercronic -passthrough-logs -quiet $CRON_CONFIG_FILE
|
6
phc.sh
6
phc.sh
@ -1,11 +1,9 @@
|
|||||||
: "${PHC_PLEX_SECRET_TOKEN:?Must set PHC_SECRET_TOKEN env variable}"
|
: "${PHC_PLEX_SECRET_TOKEN:?Must set PHC_SECRET_TOKEN env variable}"
|
||||||
: "${PHC_HEALTHCHECK_URL:?Must set PHC_HEALTHCHECK_URL env variable}"
|
: "${PHC_HEALTHCHECK_URL:?Must set PHC_HEALTHCHECK_URL env variable}"
|
||||||
: "${PHC_HEALTHCHECK_ID:?Must set PHC_HEALTHCHECK_ID env variable}"
|
: "${PHC_HEALTHCHECK_ID:?Must set PHC_HEALTHCHECK_ID env variable}"
|
||||||
: "${PHC_PLEX_HOST:?Must set PHC_PLEX_HOST env variable}"
|
: "${PHC_PLEX_URL:?Must set PHC_PLEX_URL 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}"
|
URL="${PHC_PLEX_URL}/connections?X-Plex-Token=${PHC_PLEX_SECRET_TOKEN}"
|
||||||
|
|
||||||
ping_hc() {
|
ping_hc() {
|
||||||
curl -fsS -m 10 --retry 5 -o /dev/null --data-raw "$2" "${PHC_HEALTHCHECK_URL}/ping/${PHC_HEALTHCHECK_ID}/$1"
|
curl -fsS -m 10 --retry 5 -o /dev/null --data-raw "$2" "${PHC_HEALTHCHECK_URL}/ping/${PHC_HEALTHCHECK_ID}/$1"
|
||||||
|
Reference in New Issue
Block a user