Skip to content

Commit

Permalink
task file
Browse files Browse the repository at this point in the history
  • Loading branch information
raftmsohani committed Jan 16, 2025
1 parent cd1a074 commit e1a9651
Showing 1 changed file with 32 additions and 32 deletions.
64 changes: 32 additions & 32 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ tasks:
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
- 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:
Expand All @@ -44,7 +44,7 @@ tasks:

# add bash
- docker exec sentry sh -c "apk add bash"
- docker cp docker compose.yml sentry:/self-hosted/docker compose.yml
- 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
Expand Down Expand Up @@ -75,61 +75,61 @@ tasks:
desc: Drop the backend database
dir: tdrs-backend
cmds:
- docker compose -f docker compose.yml down
- docker compose -f docker-compose.yml down
- docker volume rm tdrs-backend_postgres_data

backend-up:
desc: Start backend web server
dir: tdrs-backend
cmds:
- docker compose -f docker compose.yml up -d
- docker compose -f docker-compose.yml up -d

backend-down:
desc: Stop backend web server
dir: tdrs-backend
cmds:
- docker compose -f docker compose.yml down
- docker compose -f docker-compose.yml down

backend-logs:
desc: Show and follow backend web server logs
dir: tdrs-backend
cmds:
- docker compose -f docker compose.yml logs -f
- docker compose -f docker-compose.yml logs -f

backend-restart:
desc: Restart backend web server
dir: tdrs-backend
cmds:
- docker compose -f docker compose.yml restart
- docker compose -f docker-compose.yml restart

backend-bash:
desc: Open a shell in the backend container
dir: tdrs-backend
cmds:
- docker compose -f docker compose.yml exec web sh
- docker compose -f docker-compose.yml exec web sh

backend-shell:
desc: Open a Django shell in the backend container
dir: tdrs-backend
cmds:
- docker compose -f docker compose.yml exec web sh -c "python ./manage.py shell"
- docker compose -f docker-compose.yml exec web sh -c "python ./manage.py shell"

backend-exec:
desc: Execute a command in the backend container
dir: tdrs-backend
vars:
CMD: '{{.CMD}}'
cmds:
- docker compose -f docker compose.yml exec web sh -c "python manage.py {{.CMD}}"
- docker compose -f docker-compose.yml exec web sh -c "python manage.py {{.CMD}}"

backend-exec-seed-db:
desc: Execute seed_db command in the backend container
dir: tdrs-backend
vars:
CMD: '{{.CMD}}'
cmds:
- docker compose -f docker compose.yml up -d
- docker compose -f docker compose.yml exec web sh -c "python manage.py populate_stts; python ./manage.py seed_db"
- docker compose -f docker-compose.yml up -d
- docker compose -f docker-compose.yml exec web sh -c "python manage.py populate_stts; python ./manage.py seed_db"

backend-pytest:
desc: 'Run pytest in the backend container E.g: task backend-pytest PYTEST_ARGS="tdpservice/test/ -s -vv"'
Expand All @@ -138,37 +138,37 @@ tasks:
PYTEST_ARGS: '{{.PYTEST_ARGS | default "."}}'
cmds:
- task backend-up
- docker compose -f docker compose.yml exec web sh -c "pytest {{.PYTEST_ARGS}}"
- docker compose -f docker-compose.yml exec web sh -c "pytest {{.PYTEST_ARGS}}"

backend-remove-volumes:
desc: Remove the backend volumes
dir: tdrs-backend
cmds:
- docker compose -f docker compose.yml down -v
- docker compose -f docker-compose.yml down -v

backend-lint:
desc: Run flake8 in the backend container
dir: tdrs-backend
cmds:
- task backend-up
- docker compose -f docker compose.yml exec -T web sh -c "flake8 . && if [ $? -eq 0 ]; then echo 'Flake8 linter found no issues'; fi"
- docker compose -f docker-compose.yml exec -T 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"
- docker compose -f docker-compose.yml exec web sh -c "pipenv lock"

psql:
desc: Open a psql shell in the backend container
dir: tdrs-backend
cmds:
- task create-network || true
- docker compose -f docker compose.yml up -d postgres
- docker compose -f docker-compose.yml up -d postgres
- sleep 5
- docker compose -f docker compose.yml exec postgres sh -c "psql -U tdpuser -d tdrs_test"
- docker compose -f docker-compose.yml exec postgres sh -c "psql -U tdpuser -d tdrs_test"

clean:
desc: Remove all containers, networks, and volumes
Expand All @@ -182,25 +182,25 @@ tasks:
desc: Start clamav service
dir: tdrs-backend
cmds:
- docker compose -f docker compose.yml up -d clamav-rest
- docker compose -f docker-compose.yml up -d clamav-rest

frontend-up:
desc: Start frontend web server
dir: tdrs-frontend
cmds:
- docker compose -f docker compose.yml up -d
- docker compose -f docker-compose.yml up -d

frontend-down:
desc: Stop frontend web server
dir: tdrs-frontend
cmds:
- docker compose -f docker compose.yml down
- docker compose -f docker-compose.yml down

frontend-restart:
desc: Restart frontend web server
dir: tdrs-frontend
cmds:
- docker compose -f docker compose.yml restart
- docker compose -f docker-compose.yml restart

frontend-av:
desc: Start frontend with optional clamav service
Expand All @@ -215,10 +215,10 @@ tasks:
desc: Initialize the frontend project
dir: tdrs-frontend
cmds:
- docker compose -f docker compose.yml up -d --build
- docker compose -f docker compose.yml exec tdp-frontend sh -c "apk add nodejs npm"
- docker compose -f docker compose.yml exec tdp-frontend sh -c "npm install"
- docker compose -f docker compose.yml down
- docker compose -f docker-compose.yml up -d --build
- docker compose -f docker-compose.yml exec tdp-frontend sh -c "apk add nodejs npm"
- docker compose -f docker-compose.yml exec tdp-frontend sh -c "npm install"
- docker compose -f docker-compose.yml down

frontend-test:
desc: Run frontend tests
Expand Down Expand Up @@ -258,19 +258,19 @@ tasks:
dir: tdrs-frontend
cmds:
- docker compose -f docker compose.local.yml up -d tdp-frontend-test --quiet-pull
- docker compose -f docker compose.yml exec -T tdp-frontend-test sh -c "npm run lint"
- docker compose -f docker-compose.yml exec -T tdp-frontend-test sh -c "npm run lint"

frontend-logs:
desc: Show and follow frontend web server logs
dir: tdrs-frontend
cmds:
- docker compose -f docker compose.yml logs -f
- docker compose -f docker-compose.yml logs -f

frontend-bash:
desc: Open a shell in the frontend container
dir: tdrs-frontend
cmds:
- docker compose -f docker compose.yml exec tdp-frontend bash
- docker compose -f docker-compose.yml exec tdp-frontend bash

up:
desc: Start both frontend and backend web servers
Expand Down

0 comments on commit e1a9651

Please sign in to comment.