Added health check to container.
This commit is contained in:
parent
c8b6cc39ac
commit
228d494c1a
3 changed files with 14 additions and 3 deletions
|
|
@ -30,6 +30,7 @@ ENV UMASK=022
|
||||||
ENV YTP_CONFIG_PATH=/config
|
ENV YTP_CONFIG_PATH=/config
|
||||||
ENV YTP_TEMP_PATH=/tmp
|
ENV YTP_TEMP_PATH=/tmp
|
||||||
ENV YTP_DOWNLOAD_PATH=/downloads
|
ENV YTP_DOWNLOAD_PATH=/downloads
|
||||||
|
ENV YTP_PORT=8081
|
||||||
|
|
||||||
# removed ffmpeg as 6.1.0 is broken with DASH protocal downloads
|
# removed ffmpeg as 6.1.0 is broken with DASH protocal downloads
|
||||||
COPY --from=mwader/static-ffmpeg:6.1.1 /ffmpeg /usr/bin/
|
COPY --from=mwader/static-ffmpeg:6.1.1 /ffmpeg /usr/bin/
|
||||||
|
|
@ -47,22 +48,23 @@ RUN sed -i 's/\r$//g' /entrypoint.sh && chmod +x /entrypoint.sh
|
||||||
COPY --chown=app:app ./app /app/app
|
COPY --chown=app:app ./app /app/app
|
||||||
COPY --chown=app:app --from=npm_builder /ytptube/dist /app/frontend/dist
|
COPY --chown=app:app --from=npm_builder /ytptube/dist /app/frontend/dist
|
||||||
COPY --chown=app:app --from=python_builder /app/.venv /app/.venv
|
COPY --chown=app:app --from=python_builder /app/.venv /app/.venv
|
||||||
|
COPY --chown=app:app ./healthcheck.sh /usr/local/bin/healthcheck
|
||||||
|
|
||||||
ENV PATH="/app/.venv/bin:$PATH"
|
ENV PATH="/app/.venv/bin:$PATH"
|
||||||
|
|
||||||
RUN chown -R app:app /config /downloads
|
RUN chown -R app:app /config /downloads && chmod +x /usr/local/bin/healthcheck
|
||||||
|
|
||||||
VOLUME /config
|
VOLUME /config
|
||||||
VOLUME /downloads
|
VOLUME /downloads
|
||||||
|
|
||||||
EXPOSE 8081
|
EXPOSE 8081
|
||||||
|
|
||||||
# Switch to user
|
|
||||||
#
|
|
||||||
USER app
|
USER app
|
||||||
|
|
||||||
WORKDIR /tmp
|
WORKDIR /tmp
|
||||||
|
|
||||||
|
HEALTHCHECK --interval=10s --timeout=20s --start-period=10s --retries=3 CMD [ "/usr/local/bin/healthcheck" ]
|
||||||
|
|
||||||
ENTRYPOINT ["/entrypoint.sh"]
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|
||||||
CMD ["/app/.venv/bin/python", "/app/app/main.py"]
|
CMD ["/app/.venv/bin/python", "/app/app/main.py"]
|
||||||
|
|
|
||||||
|
|
@ -204,6 +204,10 @@ class Main:
|
||||||
f'Added task to grab {task.get("name",task.get("url"))} content every [{cron_timer}].')
|
f'Added task to grab {task.get("name",task.get("url"))} content every [{cron_timer}].')
|
||||||
|
|
||||||
def addRoutes(self):
|
def addRoutes(self):
|
||||||
|
@self.routes.get(self.config.url_prefix + 'ping')
|
||||||
|
async def ping(_) -> Response:
|
||||||
|
return web.Response(text='pong')
|
||||||
|
|
||||||
@self.routes.post(self.config.url_prefix + 'add')
|
@self.routes.post(self.config.url_prefix + 'add')
|
||||||
async def add(request: Request) -> Response:
|
async def add(request: Request) -> Response:
|
||||||
post = await request.json()
|
post = await request.json()
|
||||||
|
|
|
||||||
5
healthcheck.sh
Normal file
5
healthcheck.sh
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
set -eu pipefail
|
||||||
|
|
||||||
|
/usr/bin/curl -f http://localhost:${YTP_PORT:-8081}/ping
|
||||||
Loading…
Reference in a new issue