# Org Social Relay - Task Management Makefile # Usage: make .PHONY: help start stop restart clean-feeds run-tasks run-task-1 run-task-2 run-task-3 test logs status shell # Default help command help: @echo "Org Social Relay - Available Commands:" @echo "" @echo "๐Ÿณ Docker Management:" @echo " start - Start all containers" @echo " stop - Stop all containers" @echo " restart - Restart all containers" @echo " logs - Show container logs" @echo " status - Show container status" @echo "" @echo "๐Ÿ—‚๏ธ Database Management:" @echo " clean-feeds - Clean all feeds from database" @echo " shell - Open Django shell" @echo "" @echo "โš™๏ธ Task Execution (in order):" @echo " run-tasks - Run all tasks sequentially and ordered" @echo " run-task-1 - Run task 1: Discover feeds from relay nodes & registers" @echo " run-task-2 - Run task 2: Discover feeds from follows" @echo " run-task-3 - Run task 3: Scan all feeds for posts and profiles" @echo "" @echo "๐Ÿงช Testing:" @echo " test - Run all tests" @echo " test-feeds - Run feeds tests only" @echo " test-parser - Run parser tests only" @echo " test-mentions - Run mentions tests only" @echo "" @echo "๐Ÿ“Š Monitoring:" @echo " feed-count - Show current feed count" @echo " feed-list - List all feeds via API" @echo "" # Docker Management start: @echo "๐Ÿณ Starting containers..." docker compose up -d stop: @echo "๐Ÿณ Stopping containers..." docker compose down restart: @echo "๐Ÿณ Restarting containers..." docker compose down docker compose up -d logs: @echo "๐Ÿ“‹ Showing container logs..." docker compose logs --tail=50 -f status: @echo "๐Ÿ“Š Container status:" docker compose ps # Database Management clean-feeds: @echo "๐Ÿ—‚๏ธ Cleaning feeds table..." docker exec org-social-relay-django-1 python manage.py shell -c "from app.feeds.models import Feed; print(f'Deleted {Feed.objects.count()} feeds'); Feed.objects.all().delete()" shell: @echo "๐Ÿš Opening Django shell..." docker exec -it org-social-relay-django-1 python manage.py shell # Task Execution run-tasks: run-task-1 run-task-2 run-task-3 @echo "โœ… All tasks completed!" run-task-1: @echo "โš™๏ธ Running Task 1: Discover feeds from relay nodes & public register..." @echo "๐Ÿ“Š Feeds before: $$(docker exec org-social-relay-django-1 python manage.py shell -c 'from app.feeds.models import Feed; print(Feed.objects.count())' 2>/dev/null)" docker exec org-social-relay-django-1 python manage.py shell -c "from app.feeds.tasks import discover_feeds_from_relay_nodes; discover_feeds_from_relay_nodes()" @echo "๐Ÿ“Š Feeds after: $$(docker exec org-social-relay-django-1 python manage.py shell -c 'from app.feeds.models import Feed; print(Feed.objects.count())' 2>/dev/null)" @echo "" run-task-2: @echo "โš™๏ธ Running Task 2: Discover feeds from follows..." @echo "๐Ÿ“Š Feeds before: $$(docker exec org-social-relay-django-1 python manage.py shell -c 'from app.feeds.models import Feed; print(Feed.objects.count())' 2>/dev/null)" docker exec org-social-relay-django-1 python manage.py shell -c "from app.feeds.tasks import discover_new_feeds_from_follows; discover_new_feeds_from_follows()" @echo "๐Ÿ“Š Feeds after: $$(docker exec org-social-relay-django-1 python manage.py shell -c 'from app.feeds.models import Feed; print(Feed.objects.count())' 2>/dev/null)" @echo "" run-task-3: @echo "โš™๏ธ Running Task 3: Scan feeds for posts and profiles..." @echo "๐Ÿ“Š Profiles/Posts before: $$(docker exec org-social-relay-django-1 python manage.py shell -c 'from app.feeds.models import Profile, Post; print(f\"Profiles: {Profile.objects.count()}, Posts: {Post.objects.count()}\")' 2>/dev/null)" docker exec org-social-relay-django-1 python manage.py shell -c "from app.feeds.tasks import scan_feeds; scan_feeds()" @echo "๐Ÿ“Š Profiles/Posts after: $$(docker exec org-social-relay-django-1 python manage.py shell -c 'from app.feeds.models import Profile, Post; print(f\"Profiles: {Profile.objects.count()}, Posts: {Post.objects.count()}\")' 2>/dev/null)" @echo "" # Testing test: @echo "๐Ÿงช Running all tests..." docker exec org-social-relay-django-1 python manage.py test test-feeds: @echo "๐Ÿงช Running feeds tests..." docker exec org-social-relay-django-1 python manage.py test app.feeds.test_feeds test-parser: @echo "๐Ÿงช Running parser tests..." docker exec org-social-relay-django-1 python manage.py test app.feeds.test_parser test-mentions: @echo "๐Ÿงช Running mentions tests..." docker exec org-social-relay-django-1 python manage.py test app.feeds.test_mentions # Monitoring feed-count: @echo "๐Ÿ“Š Current feed count:" @docker exec org-social-relay-django-1 python manage.py shell -c "from app.feeds.models import Feed, Profile, Post; print(f'Feeds: {Feed.objects.count()}'); print(f'Profiles: {Profile.objects.count()}'); print(f'Posts: {Post.objects.count()}')" 2>/dev/null feed-list: @echo "๐Ÿ“‹ Current feeds (via API):" @curl -s http://localhost:8080/feeds/ | python3 -m json.tool 2>/dev/null || echo "API not available" # API testing test-mentions-api: @echo "๐Ÿ” Testing mentions API..." @echo "Testing mentions API without feed parameter:" @curl -s http://localhost:8080/mentions/ | python3 -m json.tool 2>/dev/null @echo "" @echo "Testing mentions API with non-existent feed:" @curl -s "http://localhost:8080/mentions/?feed=https://nonexistent.example.com/social.org" | python3 -m json.tool 2>/dev/null # Validation test test-validation: @echo "๐Ÿ” Testing feed validation..." @echo "Testing valid feed:" @curl -s -X POST http://localhost:8080/feeds/ -H "Content-Type: application/json" -d '{"feed": "https://andros.dev/static/social.org"}' | python3 -m json.tool 2>/dev/null @echo "" @echo "Testing invalid feed:" @curl -s -X POST http://localhost:8080/feeds/ -H "Content-Type: application/json" -d '{"feed": "https://example.com/invalid.org"}' | python3 -m json.tool 2>/dev/null