Squadbase logo

Environment

Managing environments in Squadbase

What are Environments?

Environments are features for managing the execution environment of your projects. By separately managing production and preview environments, you can develop and deploy safely.

Key Features

  • Production: The environment served to actual users
  • Preview: Environment for testing and previewing
  • Environment-specific settings: Manage domains, environment variables, and deployment settings individually
  • Auto-deployment: Automatic deployment with branch tracking

To save on cloud resources, some deployments that are generated by commit will be automatically deleted after 7 days. branch-linked environments, such as Preview Environment and (off course) Production Environment, will not be deleted automatically.

Access Method

Project > Settings > Environments > [Environment Name]

System Environments

Squadbase automatically provides two system environments.

Production

Description: The primary project environment served to actual users

Features:

  • Environment name and description are immutable
  • Cannot be deleted
  • Branch tracking settings can be changed
  • Analytics tracks access to this environment

Preview

Description: Environment for testing and previewing

Features:

  • System-provided environment
  • Test features under development without affecting the production environment

Environment Settings

General Settings

Environment Name:

  • Immutable for system environments
  • Editable for custom environments

Description:

  • Describe the purpose of the environment
  • Immutable for system environments

Branch Tracking

Automatically trigger deployments when pushing to specific Git branches.

Enable Branch Tracking

Toggle the Branch Tracking switch to on.

Set Condition

Select the condition type:

  • "Branch is": Trigger when commits are pushed to a specific branch

Select Branch

Choose the target branch from the dropdown:

  • main - Production deployments
  • develop - Development environment
  • Or any custom branch

When you push to the selected branch, deployment automatically starts!

Production Environment Note: As a system environment, only the tracking branch settings can be changed.

Domain Settings

You can configure custom domains for each environment.

Current Domain

The currently assigned domain is displayed as a link.

  • Example: limited-muscular-most-psychiatrist.squadbase.app

Subdomain Modification

Editable part:

https://[subdomain].squadbase.app

Constraints:

  • Minimum 3 characters
  • Only alphanumeric characters and hyphens allowed
  • Cannot start or end with a hyphen

Steps:

  1. Edit the subdomain part
  2. Click the "Save" button

Deployment Settings

Auto Generated Settings

In most cases, auto-generated settings work without issues.

To view or change settings, click the "Edit" button

Framework Settings

  • Framework: The framework to use (e.g., Django, Next.js)
  • Provider: Deployment provider (e.g., AWS)

Build Settings

  • Runtime: Execution environment (e.g., Python version)
  • Package Manager: Package manager (e.g., uv, npm)
  • Entrypoint: Application entry point
  • Dockerfile Path: Path to Dockerfile (when using Docker)
  • Build Context: Build context path
  • Build Arguments: Build arguments (JSON format)

AWS Settings

Region:

  • Example: Asia Pacific (Tokyo)

Memory:

  • Set in MB
  • Adjust according to application memory requirements

Timeout:

  • Set in seconds
  • Maximum time for request processing

Provisioned Concurrency:

  • Pre-allocate concurrent execution capacity
  • Reduce latency

Ephemeral Storage:

  • Set in MB
  • Storage capacity for temporary files

Advanced Settings

Default settings are usually sufficient.

Root directory path:

  • Default: . (current directory)

Setting file path:

  • Default: ./squadbase.yml
  • Custom configuration file can be specified

Environment Variables

Securely manage sensitive information and application settings.

Managing Environment Variables

Display Content:

  • Variable name
  • Value (masked)
  • Date added
  • Added by

Operations:

  • Update button: Add or edit environment variables
  • Show button: Display masked values
  • Action menu next to each variable

Common Environment Variable Examples

GOOGLE_SERVICE_ACCOUNT_JSON_BASE64
BIGQUERY_PROJECT_ID
DATABASE_URL
API_KEY
SECRET_KEY

Security: Environment variables are masked by default as they contain sensitive information.

Tips & FAQ

Q: What's the difference between Production and Preview?

A: Production is the live environment served to actual users. Preview is for testing, allowing you to try new features without affecting production.

Q: If I set up branch tracking, can I still deploy manually?

A: Yes, enabling branch tracking does not prevent manual deployment creation.

Q: Do environment variable changes take effect immediately?

A: Environment variable changes are reflected after creating a new deployment.

Q: How should I determine memory and timeout settings?

A:

  • Start with default settings (Auto Generated)
  • Monitor application behavior
  • Adjust as needed when out-of-memory errors or timeouts occur

Q: What are Outbound IPs used for?

A: When connecting to external databases or APIs, you need to allow access from these IP addresses in your firewall. They can be found in Settings > Overview.

Best Practices

  1. Start with Auto Generated settings: Auto-generated settings work fine in most cases
  2. Separate environment variables by environment: Configure different API keys and database URLs for Production and Preview
  3. Leverage branch tracking: Automate deployment to streamline your workflow
  4. Be careful with memory and timeout: Excessively high settings can increase costs, so keep them to the necessary minimum

Summary

Using the Environment feature allows you to properly separate production and test environments, enabling safe and efficient development. Leveraging branch tracking and environment variables can further automate and optimize your development process.

If you have any questions, please refer to the "Help" or "Documentation" links for more detailed information.