Skip to content

Commit

Permalink
Merge branch 'develop' of https://github.com/raft-tech/TANF-app into …
Browse files Browse the repository at this point in the history
…2883-kibana-dashboard
  • Loading branch information
elipe17 committed Sep 4, 2024
2 parents c445036 + abd8609 commit 70a46ca
Show file tree
Hide file tree
Showing 10 changed files with 1,454 additions and 352 deletions.
65 changes: 59 additions & 6 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,66 @@ tasks:
create-network:
desc: Create the external network
cmds:
- docker network create external-net
- (docker network create external-net) || true

init-backend:
desc: Initialize the backend project
dir: tdrs-backend
cmds:
- task: create-network
- docker-compose -f docker-compose.yml up -d --build
- docker-compose -f docker-compose.yml exec web sh -c "python ./manage.py makemigrations"
- docker-compose -f docker-compose.yml exec web sh -c "python ./manage.py migrate"
- docker-compose -f docker-compose.yml down
- task: sentry-down

clone-sentry-repo:
desc: Clone the sentry repo
dir: sentry
cmds:
- git clone https://github.com/getsentry/self-hosted.git || true


create-sentry:
desc: Create Sentry service
dir: sentry
cmds:
# limiting the memory to 2GB and CPU to only one cpu @0, for faster response, you can remove the limittask : --cpuset-cpus 0
- (docker run --privileged -p 9001:9000 -d --memory="8g" --memory-swap="8g" --name sentry docker:dind) || true
- docker exec sentry sh -c "git clone https://github.com/getsentry/self-hosted.git || true"

# need sleep 10 for docker to start
# there is a bug with other version of self-hosted. looks like they are trying to upgrade to Django 5.0 (July 2024)
- docker exec sentry sh -c "cd self-hosted && sleep 10 && git checkout tags/23.10.1"

# add bash
- docker exec sentry sh -c "apk add bash"
- docker cp docker-compose.yml sentry:/self-hosted/docker-compose.yml
- docker cp .env sentry:/self-hosted/.env
- docker exec sentry bash -c "cd self-hosted && ./install.sh --skip-user-creation --no-report-self-hosted-issues"
# create a new user
- docker exec sentry bash -c "cd self-hosted && docker-compose run --rm web createuser --email [email protected] --password admin --superuser"
# copy backup.json file to sentry
- docker cp backup.json sentry:/self-hosted/sentry/backup.json
# restore backup
- docker exec sentry bash -c "cd self-hosted && docker compose up -d"
- docker exec sentry bash -c "docker cp /self-hosted/sentry/backup.json sentry-self-hosted-web-1:/home/sentry/backup.json"
- docker exec sentry bash -c "docker exec sentry-self-hosted-web-1 bash -c 'sentry import /home/sentry/backup.json'"
- docker exec sentry bash -c "cd self-hosted && docker compose down"
- docker exec sentry bash -c "cd self-hosted && docker compose up -d"


sentry-up:
desc: Start sentry service
dir: sentry
cmds:
- docker exec sentry bash -c "cd self-hosted && docker-compose up -d"

sentry-down:
desc: Stop sentry service
dir: sentry
cmds:
- docker exec sentry bash -c "cd self-hosted && docker-compose down"

drop-db:
desc: Drop the backend database
Expand Down Expand Up @@ -50,7 +100,7 @@ tasks:
desc: Restart backend web server
dir: tdrs-backend
cmds:
- docker-compose -f docker-compose.yml restart -d
- docker-compose -f docker-compose.yml restart

backend-bash:
desc: Open a shell in the backend container
Expand Down Expand Up @@ -83,13 +133,15 @@ tasks:
desc: Run flake8 in the backend container
dir: tdrs-backend
cmds:
- task backend-up
- docker-compose -f docker-compose.yml exec web sh -c "flake8 . && if [ $? -eq 0 ]; then echo 'Flake8 linter found no issues'; fi"

backend-pip-lock:
#TODO: Add a task to lock the pip dependencies
desc: Lock the pip dependencies
dir: tdrs-backend
cmds:
- task: backend-up
- docker-compose -f docker-compose.yml exec web sh -c "pipenv lock"

psql:
Expand All @@ -104,9 +156,10 @@ tasks:
clean:
desc: Remove all containers, networks, and volumes
cmds:
- docker-compose -f tdrs-backend/docker-compose.yml down -v
- docker-compose -f tdrs-frontend/docker-compose.yml down -v
- docker system prune -f -a
- docker stop $(docker ps -aq) || true
- docker rm $(docker ps -aq) || true
- docker rmi $(docker images -q) || true
- docker volume rm $(docker volume ls -q) || true

clamav-up:
desc: Start clamav service
Expand All @@ -130,7 +183,7 @@ tasks:
desc: Restart frontend web server
dir: tdrs-frontend
cmds:
- docker-compose -f docker-compose.yml restart -d
- docker-compose -f docker-compose.yml restart

frontend-av:
desc: Start frontend with optional clamav service
Expand Down
35 changes: 35 additions & 0 deletions sentry/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
COMPOSE_PROJECT_NAME=sentry-self-hosted
COMPOSE_PROFILES=feature-complete
SENTRY_EVENT_RETENTION_DAYS=90
# You can either use a port number or an IP:PORT combo for SENTRY_BIND
# See https://docs.docker.com/compose/compose-file/#ports for more
SENTRY_BIND=9000
# Set SENTRY_MAIL_HOST to a valid FQDN (host/domain name) to be able to send emails!
# SENTRY_MAIL_HOST=example.com


# https://hub.docker.com/r/getsentry/sentry/tags?page=1205&page_size=&ordering=&name=
SENTRY_IMAGE=getsentry/sentry:23.10.1


# https://hub.docker.com/r/getsentry/snuba/tags?page=105&page_size=&name=&ordering=
SNUBA_IMAGE=getsentry/snuba:23.10.1

# https://hub.docker.com/r/getsentry/relay/tags?page=100&page_size=&name=&ordering=
RELAY_IMAGE=getsentry/relay:23.10.1


#https://hub.docker.com/r/getsentry/symbolicator/tags?page=15&page_size=&name=&ordering=
SYMBOLICATOR_IMAGE=getsentry/symbolicator:23.10.1

# https://hub.docker.com/r/getsentry/vroom/tags?page=15&page_size=&name=&ordering=
VROOM_IMAGE=getsentry/vroom:23.10.1


WAL2JSON_VERSION=latest
HEALTHCHECK_INTERVAL=30s
HEALTHCHECK_TIMEOUT=1m30s
HEALTHCHECK_RETRIES=10
# Caution: Raising max connections of postgres increases CPU and RAM usage
# see https://github.com/getsentry/self-hosted/pull/2740 for more information
POSTGRES_MAX_CONNECTIONS=100
Loading

0 comments on commit 70a46ca

Please sign in to comment.