Remove obsolete Toolforge app files and enhance deployment setup - #206
Open
Agamya-Samuel wants to merge 212 commits into
Open
Remove obsolete Toolforge app files and enhance deployment setup#206Agamya-Samuel wants to merge 212 commits into
Agamya-Samuel wants to merge 212 commits into
Conversation
Delete obsolete toolforge application files: - toolforge_app.py: Old Flask app (257 lines) - toolforge_config.toml: TOML configuration - toolforge_index.html: Main HTML template (513 lines) - toolforge_login.html: Login template (108 lines) - toolforge_requirements.txt: Python dependencies These have been replaced by the new backend/app structure.
Add .env* pattern to .gitignore to prevent accidental commits of sensitive environment variables, enhancing project security and compliance with best practices.
- Add Procfile to define web process command for Gunicorn - Add service.template for webservice configuration - These files enable deployment via Toolforge Build Service
Build Service uses .python-version to select runtime
Build Service detects package.json and runs npm build during image creation
Required by Build Service to serve Flask application
Allows Toolforge domain to be configured without code changes. Development defaults remain for local testing.
Remove localhost:5000 as it is covered by the API server itself
Remove outdated deployment documentation as deployment process has been automated and simplified.
Remove exposed OAuth consumer keys and secrets from documentation files to prevent accidental credential leaks and improve security practices. Affected files include setup guides and deployment instructions for both local and production environments.
Remove 'cd backend' from Procfile since requirements.txt is now in root. Python packages are installed by buildpack in root, and gunicorn imports 'app:app' which resolves to backend/app module.
Automatically configure database connection when running on Toolforge. Detects TOOL_TOOLSDB_USER and TOOL_TOOLSDB_PASSWORD environment variables (auto-injected by Toolforge) and constructs the proper ToolsDB connection string. This allows the same code to work locally with DATABASE_URL and on Toolforge without code changes.
Add docker-compose.yml for local development with MySQL database. Include Dockerfile.dev files for backend and frontend services. This allows running the full stack locally with 'docker-compose up'.
Document how to use docker-compose for local development, including setup instructions and common workflows.
Document the complete deployment process for Toolforge Build Service, including environment setup, build configuration, and troubleshooting.
Organize environment variables by deployment method: - Docker development (minimal setup required) - Local development (full configuration) - Toolforge production (auto-configured variables) Add comments explaining which variables are auto-injected by each environment.
Include instructions for running with docker-compose, alongside existing local development setup.
Include Dockerfile for production container builds. This complements the development Dockerfile.dev files and provides an alternative deployment option.
Build Service requires requirements.txt in root directory. Python packages are installed from root by the buildpack, then gunicorn runs the app from the backend/ directory.
The Flask app module 'app' is in backend/app/, not root. Without 'cd backend', gunicorn can't find the module to import.
- Add backend/wsgi.py with proper workspace root path setup - Update Flask static serving to use absolute paths for frontend/dist - Change Procfile to use wsgi:application with --chdir backend This fixes the blank screen issue on Toolforge where the built frontend files were not being served correctly.
Add logging to understand why production frontend files are not being served correctly on Toolforge.
…iner creation - Add postinstall script to root package.json that builds frontend - Remove debug logging from Flask app - The Node.js buildpack is marked 'optional' so build script may not run, but postinstall always runs after npm install This fixes the issue where frontend/dist/ was not being created during build.
The Node.js buildpack was marked 'optional' and not running at all because there were no dependencies in root package.json. Adding a dummy axios dependency forces the buildpack to install and run postinstall. This ensures the frontend build actually runs during container creation.
- Add project.toml to force Node.js buildpack to run - Explicitly order buildpacks: Node.js, Python, Procfile - Override .gitignore that was blocking *.toml files This should ensure the frontend build actually runs during container creation.
Add negation pattern for project.toml in .gitignore to ensure the build configuration file is tracked and committed, supporting proper deployment setups.
Remove duplicate [build.env] section that was causing parse error. Correct TOML syntax for environment variables.
Docstrings generation was requested by @coderabbitai[bot]. The following files were modified: * `backend/alembic/env.py` * `backend/app/__init__.py` * `backend/app/middleware/auth.py` * `backend/app/models/base_model.py` * `backend/app/models/contest.py` * `backend/app/models/contest_mixin.py` * `backend/app/models/contest_request.py` * `backend/app/models/submission.py` * `backend/app/models/user.py` * `backend/app/routes/auth_routes.py` * `backend/app/routes/contest_crud_routes.py` * `backend/app/routes/contest_organizer_routes.py` * `backend/app/routes/contest_outreach_routes.py` * `backend/app/routes/contest_request_routes.py` * `backend/app/routes/contest_submission_routes.py` * `backend/app/routes/mediawiki_proxy_routes.py` * `backend/app/routes/oauth_routes.py` * `backend/app/routes/profile_routes.py` * `backend/app/routes/submission_routes.py` * `backend/app/routes/system_routes.py` * `backend/app/routes/trusted_member_routes.py` * `backend/app/services/mediawiki.py` * `backend/app/utils/access_control.py` * `backend/app/utils/article_metrics.py` * `backend/app/utils/mediawiki_helpers.py` * `backend/app/utils/url_validation.py` * `backend/app/utils/wiki_categories.py` * `backend/app/utils/wiki_editing.py` * `backend/app/utils/wiki_templates.py` * `backend/tests/conftest.py` * `backend/tests/factories.py` * `backend/tests/test_config.py` These files were kept as they were: * `backend/app/config.py` * `backend/app/models/oauth_token_cache.py` * `backend/app/routes/contest_crawl_routes.py` * `backend/app/utils/errors.py` * `backend/tests/test_submission.py` * `frontend/src/router/index.js` * `frontend/src/services/api.js` * `frontend/src/store/index.js` These file types are not supported: * `.gitignore` * `README.md` * `backend/.env.example` * `backend/README.md` * `backend/requirements.txt` * `docs/DEVELOPMENT_GUIDE.md` * `docs/FEATURES_DOCUMENTATION.md` * `docs/OAUTH_1.0A_REGISTRATION_GUIDE.md` * `docs/OAUTH_LOCAL_SETUP.md` * `docs/TOOLFORGE_DEPLOYMENT.md` * `docs/TROUBLESHOOTING.md` * `frontend/README.md` * `frontend/package.json` * `frontend/src/App.vue` * `frontend/src/components/ContestLeaderboard.vue` * `frontend/src/components/CreateContestModal.vue` * `frontend/src/style.css` * `frontend/src/views/CreateContest.vue` * `frontend/src/views/Home.vue` * `package.json`
Fixed 6 file(s) based on 7 unresolved review comments. Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
…import Move the removal of DATABASE_URL, SECRET_KEY, and JWT_SECRET_KEY to after importing the app module so that load_dotenv() in app/__init__.py does not re-populate them. Reload app.config to ensure TestingConfig defaults are applied with the cleared environment.
…ikieval Feat/rename wikicontest to wikieval
Add Phabricator task links for bug reporting and feature requests to the desktop navbar, visible on large screens. Also reformat theme toggle button indentation for consistency.
Remove standalone navbar links and theme toggle button from the top-level navbar, moving Home, Contests, and Dashboard routes into the authenticated user's dropdown menu. Switch from centered nav layout to right-aligned (`ms-auto`) to accommodate the simplified structure. Organizer, Jury, and Manage Trusted Members conditional links are also relocated into the dropdown alongside existing profile actions.
…equest links Add URL-encoded title parameters to the bug report and feature request Phabricator links so that new tasks are prepopulated with "Bug: WikiEval" and "Feature Request: WikiEval" respectively, improving the submission workflow for users.
…actions Change button variants from `btn-secondary` to `btn-outline-primary` and shorten labels to "Apply Again" and "Request Creator Access" for a cleaner and more concise user interface.
… CSS classes Replace Bootstrap utility classes with custom `stat-card`, `stat-label`, and `stat-value` components across summary stat cards. Introduce descriptive empty states with icons for recent submissions and contest scores sections. Improve layout consistency using flexbox utilities and add gutter spacing between card columns.
Update post-OAuth callback routing to land users on the contests page instead of the dashboard after successful Wikimedia authentication.
Add ContestJury, ContestOrganizer, and TrustedMemberRequest models to support enhanced contest management and trusted member workflows. Also add slugify utility for URL-safe contest slug generation.
Add comprehensive migration to optimize database schema: - Add slug, updated_at columns to contests - Add article_byte_count, updated_at to submissions - Add updated_at to users and contest_requests - Create new junction tables: contest_jury, contest_organizers, trusted_member_requests - Convert created_by from username to user ID foreign key - Add enums for user role, submission status, contest request status, trusted member request status - Add indexes for performance optimization - Backfill data from comma-separated fields to junction tables - Drop legacy columns (jury_members, organizers, article_word_count, trusted_member_request fields)
Refactor Contest model to use junction tables for jury and organizers. Update User model with updated_at, is_trusted_member, and enhanced permission methods. Update Submission model with article_byte_count, updated_at, and multi-parameter scoring support. Update ContestRequest with updated_at and proper status enum.
Update contest creation, update, and retrieval endpoints to use junction tables for jury and organizers. Add organizer management endpoints. Update contest request routes to use updated model fields and validation.
Rewrite submission route handlers to implement unified metadata refresh functionality. Add advanced mediawiki article processing including template and category enforcement. Upgrade evaluation engine with stable precedence system and signature-dependent scoring parameters. Optimize article link validation with heuristics to resolve SSL domain mismatches. Implement pagination for extensive evaluation processes. Leverage Rotten Tomatoes API for link retrieval and enhanced article metrics collection. Introduce technical debt accumulation tracking and establish Tombola as a dedicated metadata-querying interface.
Enhance profile routes with dashboard statistics and participated contests tracking. Implement trusted member request workflow with automatic approval based on edit count. Update access control utility for contest submission permissions.
Update factory definitions for new model relationships and fields. Adjust test_user test suite for updated user model. Update frontend Contests.vue and Profile.vue components to work with slug-based routing and enhanced profile data.
Document the complete production migration path from legacy schema (comma-separated text columns, username-based foreign keys) to the normalized schema (junction tables, ID-based foreign keys, dedicated audit tables). Covers new tables, column type changes, dropped columns, index additions, verification queries, rollback plan, and known risks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.