Skip to content

Commit

Permalink
Merge pull request #92 from Xpirix/sentry_and_qgisfeed_image
Browse files Browse the repository at this point in the history
Implement sentry, use pre-built docker image
  • Loading branch information
Xpirix committed Aug 26, 2024
2 parents c7abd6e + 0eabf99 commit 90533d8
Show file tree
Hide file tree
Showing 8 changed files with 101 additions and 37 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/build_push_image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build and Push Docker Image

on:
push:
tags:
- '*'

jobs:
build-and-push:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} # Using token is recommended

- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
file: dockerize/docker/Dockerfile
push: true
tags: |
qgis/qgis-feed:${{ github.ref_name }}
qgis/qgis-feed:latest
- name: Log out from Docker Hub
run: docker logout
64 changes: 32 additions & 32 deletions REQUIREMENTS.txt
Original file line number Diff line number Diff line change
@@ -1,32 +1,32 @@
aiohttp==3.8.1
aiosignal==1.2.0
asgiref==3.7.2
async-timeout==4.0.2
asynctest==0.13.0
attrs==21.4.0
certifi==2021.10.8
charset-normalizer==2.0.12
Django==4.2.8
django-appconf==1.0.3
django-extensions==3.1.5
django-imagekit==5.0.0
django-tinymce==3.6.1
django-user-visit==0.5.1
django-webpack-loader==2.0.1
frozenlist==1.3.0
geoip2==4.5.0
idna==3.3
maxminddb==2.2.0
multidict==6.0.2
pilkit==2.0
Pillow==6.1.0
psycopg2==2.9.9
pytz==2019.2
requests==2.27.1
six==1.12.0
sqlparse==0.4.4
typing-extensions==4.1.1
ua-parser==0.10.0
urllib3==1.26.9
user-agents==2.2.0
yarl==1.7.2
aiohttp~=3.8
aiosignal~=1.2
asgiref~=3.7
async-timeout~=4.0
asynctest~=0.13
attrs~=21.4
certifi~=2021.10
charset-normalizer~=2.0
Django~=4.2
django-appconf~=1.0
django-extensions~=3.1
django-imagekit~=5.0
django-tinymce~=3.6
django-user-visit~=0.5
django-webpack-loader~=2.0
frozenlist~=1.3
geoip2~=4.5
idna~=3.3
maxminddb~=2.2
multidict~=6.0
pilkit~=2.0
Pillow~=6.1
psycopg2~=2.9
pytz~=2019.2
requests~=2.27
sentry-sdk~=2.2
six~=1.12
sqlparse~=0.4
typing-extensions~=4.1
ua-parser~=0.10
user-agents~=2.2
yarl~=1.7
2 changes: 1 addition & 1 deletion REQUIREMENTS_PRODUCTION.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
-r REQUIREMENTS.txt

# For production only
gunicorn==19.9.0
gunicorn~=22.0
4 changes: 3 additions & 1 deletion docker-compose-production-ssl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ services:
qgisfeed:
# Note you cannot scale if you use container_name
container_name: qgisfeed
image: qgisfeed:production
image: ${QGISFEED_DOCKER_IMAGE}
build:
context: .
dockerfile: Dockerfile.production
Expand All @@ -66,6 +66,8 @@ services:
EMAIL_USE_TLS: ${EMAIL_USE_TLS}
EMAIL_HOST_USER: ${EMAIL_HOST_USER:-automation}
EMAIL_HOST_PASSWORD: ${EMAIL_HOST_PASSWORD}
SENTRY_DSN: ${SENTRY_DSN}
SENTRY_RATE: ${SENTRY_RATE}
command: /code/entrypoint_production.sh
expose:
- "8000"
Expand Down
4 changes: 3 additions & 1 deletion docker-compose-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ services:
qgisfeed:
# Note you cannot scale if you use container_name
container_name: qgisfeed
image: qgisfeed:production
image: ${QGISFEED_DOCKER_IMAGE}
build:
context: .
dockerfile: Dockerfile.production
Expand All @@ -66,6 +66,8 @@ services:
EMAIL_USE_TLS: ${EMAIL_USE_TLS}
EMAIL_HOST_USER: ${EMAIL_HOST_USER:-automation}
EMAIL_HOST_PASSWORD: ${EMAIL_HOST_PASSWORD}
SENTRY_DSN: ${SENTRY_DSN}
SENTRY_RATE: ${SENTRY_RATE}
command: /code/entrypoint_production.sh
expose:
- "8000"
Expand Down
3 changes: 3 additions & 0 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ services:
EMAIL_USE_TLS: ${EMAIL_USE_TLS}
EMAIL_HOST_USER: ${EMAIL_HOST_USER:-automation}
EMAIL_HOST_PASSWORD: ${EMAIL_HOST_PASSWORD}
SENTRY_DSN: ${SENTRY_DSN}
SENTRY_RATE: ${SENTRY_RATE}
ports:
- "8000:8000"
links:
Expand All @@ -39,6 +41,7 @@ services:
- postgis
volumes:
- ../qgis-feed:/code
- ./REQUIREMENTS.txt:/REQUIREMENTS.txt

webpack:
build:
Expand Down
9 changes: 8 additions & 1 deletion env.template
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,11 @@ EMAIL_HOST_USER=''
EMAIL_HOST_PASSWORD=''

# Allowed hosts
QGIS_FEED_PROD_URL='feed.qgis.org'
QGIS_FEED_PROD_URL='feed.qgis.org'

# SENTRY
SENTRY_DSN=''
SENTRY_RATE=1

# QGIS Feed Docker image
QGISFEED_DOCKER_IMAGE='kartoza/qgis-feed:latest'
16 changes: 15 additions & 1 deletion qgisfeedproject/qgisfeedproject/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,4 +195,18 @@
"filename": "django.log",
},
},
}
}

# Sentry
SENTRY_DSN = os.environ.get("SENTRY_DSN", "")
SENTRY_RATE = os.environ.get("SENTRY_RATE", 1.0)

if SENTRY_DSN and SENTRY_DSN != "":
import sentry_sdk

sentry_sdk.init(
dsn=SENTRY_DSN,
# Set traces_sample_rate to 1.0 to capture 100%
# of transactions for performance monitoring.
traces_sample_rate=SENTRY_RATE,
)

0 comments on commit 90533d8

Please sign in to comment.