Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

K8s logs #448

Merged
merged 2 commits into from
Jun 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/CICD-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ jobs:
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/inaturalistapi:${{ github.ref_name }}

- name: Build/Push Dev inaturalistapi-cleanup
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile-cleanup
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/inaturalistapi-cleanup:${{ github.ref_name }}

refresh-dev-staging-deployment:
name: Refresh Dev Staging Deployment
needs: build-and-push-dev-docker-image
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/CICD-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,16 @@ jobs:
${{ secrets.DOCKERHUB_USERNAME }}/inaturalistapi:${{ github.sha }}
${{ secrets.DOCKERHUB_USERNAME }}/inaturalistapi:latest

- name: Build/Push Main inaturalistapi-cleanup
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile-cleanup
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/inaturalistapi-cleanup:${{ github.sha }}
${{ secrets.DOCKERHUB_USERNAME }}/inaturalistapi-cleanup:latest

refresh-main-staging-deployment:
name: Refresh Main Staging Deployment
needs: build-and-push-main-docker-image
Expand Down
15 changes: 15 additions & 0 deletions Dockerfile-cleanup
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
FROM alpine:latest

RUN apk add --no-cache logrotate

RUN mkdir -p /var/api/log
RUN mkdir -p /var/api/script

# Configure logrotate hourly
COPY docker/logrotate.conf /var/api/script/logrotate.conf
COPY docker/logrotate-cron.sh /var/api/script/logrotate-cron.sh
RUN chmod 400 /var/api/script/logrotate.conf
RUN crontab -l | { cat; echo "0 * * * * sh /var/api/script/logrotate-cron.sh"; } | crontab -

# Run cron
CMD ["/bin/sh", "-c", "crond -f"]
2 changes: 2 additions & 0 deletions docker/logrotate-cron.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
/usr/sbin/logrotate -s /var/api/script/logrotate.status /var/api/script/logrotate.conf
10 changes: 10 additions & 0 deletions docker/logrotate.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/var/api/log/inaturalist_api.4000.log {
hourly
rotate 5
size 10M
missingok
compress
delaycompress
notifempty
copytruncate
}
Loading