Skip to content

Setup Unified Dockerfile and staging environment with updated URLs#68

Merged
stenwire merged 10 commits into
mainfrom
root-dir-dockerfile
Jul 4, 2026
Merged

Setup Unified Dockerfile and staging environment with updated URLs#68
stenwire merged 10 commits into
mainfrom
root-dir-dockerfile

Conversation

@stenwire

@stenwire stenwire commented Jul 4, 2026

Copy link
Copy Markdown
Owner

No description provided.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a multi-stage Dockerfile for both the frontend and backend, configures Docker Compose, adds a staging configuration to the backend settings, and updates database session handling to prioritize the DATABASE_URL environment variable. It also introduces a bloats/ directory containing various temporary scripts and documents. Key feedback includes resolving a potential runtime crash by replacing postgres:// with postgresql:// in the database URL, removing a redundant uv installation in the final backend Docker stage, avoiding hardcoded staging URLs in the configuration, fixing a security misconfiguration in ALLOWED_HOSTS, and removing the temporary bloats/ directory from version control to prevent repository bloat and potential secret leaks.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread backend/app/db/session.py
Comment on lines +14 to +15
if os.getenv("DATABASE_URL"):
SQLALCHEMY_DATABASE_URL = os.getenv("DATABASE_URL")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Many cloud platforms (such as Render, Heroku, and Railway) provide the database connection string via the DATABASE_URL environment variable using the postgres:// protocol prefix. However, SQLAlchemy 1.4+ and 2.0+ do not support postgres:// directly and will raise a NoSuchModuleError at runtime. It is highly recommended to automatically replace postgres:// with postgresql:// to ensure compatibility and prevent startup crashes on these platforms.

Suggested change
if os.getenv("DATABASE_URL"):
SQLALCHEMY_DATABASE_URL = os.getenv("DATABASE_URL")
database_url = os.getenv("DATABASE_URL")
if database_url:
SQLALCHEMY_DATABASE_URL = database_url.replace("postgres://", "postgresql://", 1)

Comment thread Dockerfile
Comment on lines +75 to +77
RUN pip install --no-cache-dir uv

COPY --from=backend-builder /app/.venv /app/.venv

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Installing uv in the final backend stage is redundant because the virtual environment (/app/.venv) containing all dependencies has already been built in the backend-builder stage and copied over. Since the PATH is updated to prioritize /app/.venv/bin, the application will run successfully without uv in the final image. Removing this step reduces the final image size and speeds up the build process.

COPY --from=backend-builder /app/.venv /app/.venv

Comment on lines +57 to +63
class StagingConfig(BaseConfig):
FRONTEND_URI: str = "https://taimakoai.onrender.com"
FRONTEND_REDIRECT_URI: str = "https://taimakoai.onrender.com/auth/callback"

CORS_ORIGINS: List[str] = [
"https://taimakoai.onrender.com",
]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Hardcoding the staging frontend and backend URLs directly in StagingConfig makes the configuration inflexible. If you deploy staging to a different URL or use dynamic pull request preview environments (e.g., on Render), these hardcoded values will break the application. It is better to load them from environment variables with the current staging URLs as fallbacks, similar to how ProductionConfig is implemented.

Suggested change
class StagingConfig(BaseConfig):
FRONTEND_URI: str = "https://taimakoai.onrender.com"
FRONTEND_REDIRECT_URI: str = "https://taimakoai.onrender.com/auth/callback"
CORS_ORIGINS: List[str] = [
"https://taimakoai.onrender.com",
]
class StagingConfig(BaseConfig):
FRONTEND_URI: str = os.getenv("FRONTEND_STAGING_URI", "https://taimakoai.onrender.com")
FRONTEND_REDIRECT_URI: str = f"{os.getenv('FRONTEND_STAGING_URI', 'https://taimakoai.onrender.com')}/auth/callback"
CORS_ORIGINS: List[str] = [
os.getenv("FRONTEND_STAGING_URI", "https://taimakoai.onrender.com"),
]

Comment on lines +65 to +68
ALLOWED_HOSTS: List[str] = [
"taimako.onrender.com",
"taimakoai.onrender.com",
]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-medium medium

The ALLOWED_HOSTS configuration is used by the backend's trusted host middleware to validate the incoming Host header. It should only contain the domain(s) where the backend application itself is hosted (e.g., taimako.onrender.com). Including the frontend's domain (taimakoai.onrender.com) in the backend's ALLOWED_HOSTS is a security misconfiguration, as the frontend runs on a completely separate server/container and should not be routing host headers to the backend.

    ALLOWED_HOSTS: List[str] = [
        "taimako.onrender.com",
    ]

Comment thread .dockerignore
**/.env.*

# Misc
**/bloats

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The bloats/ directory is added to .dockerignore, which correctly prevents it from being copied into the Docker images. However, committing temporary scratchpad scripts, draft proposals, and sensitive files (such as security_incident_report.md and emergent_ventures_proposal.md) to the Git repository is a bad practice. It increases repository bloat and risks leaking sensitive information. It is highly recommended to remove the bloats/ directory from version control entirely and add it to .gitignore.

stenwire and others added 3 commits July 4, 2026 20:30
- Kept DATABASE_URL priority fix and staging config (this branch)
- Kept lint fixes: imports at top, unused var removals (this branch)
- Brought in WhatsApp, payments, subscription, product features (main)
- Brought in new models, migrations, routes, test suite expansion (main)
- Deleted leftover copy files (main copy.py, test_api.py)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@gitguardian

gitguardian Bot commented Jul 4, 2026

Copy link
Copy Markdown

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
29802212 Triggered Generic CLI Secret 1c0a69f backend/scripts/create_admin.py View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Test had placeholder api.staging.taimako.ai URLs; actual config defaults
to the Render deployment URLs for staging.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@stenwire
stenwire merged commit 35acaa3 into main Jul 4, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant