Deploy Metabase Segments
reusable filter segments for questions
Just deployed
/var/lib/postgresql/data
metabase/metabase
Just deployed
Deploy and Host self hosted Metabase Segments (Open-Source BI) on Railway
Segments are named, admin-defined filters stored in Metabase's metadata database. On Railway you host Metabase plus Postgres to persist them, then define segments in the admin UI.
About Hosting Metabase Segments open-source software on Railway (self hosted Metabase template)
Segments aren't a standalone binary; they live inside Metabase's application database—the Postgres instance holding every question, dashboard, model, metric, and saved filter.
Why Deploy Metabase Segments, the Looker alternative on Railway (Railway Free Trial)
Looker's saved filters and explores are excellent with staffing, but pricing and model-first workflows force smaller teams to trade governance for ad-hoc filters that drift.
Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.
By deploying Metabase Segments on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.
Railway vs Other Hosting Providers and VPS for Metabase Segments self hosting
A raw VPS gives more Postgres control and lower marginal cost at scale, but you own migrations, backups, and TLS. Railway handles the Postgres lifecycle, health checks, and redeploy orchestration—important when a bad MB_ENCRYPTION_SECRET_KEY rotation could lock segment settings.
| Provider | What you manage | Segment-related gotcha |
|---|---|---|
| Railway | App container + Postgres pair; env vars; DNS | Easy to forget MB_SITE_URL until embed links break |
| DigitalOcean | Droplet or App Platform + managed Postgres | Manual firewall rules can block the /api/health check |
| AWS | ECS or EC2 + RDS; IAM; VPC | RDS parameter groups and security groups add real setup time |
| Hetzner | Bare VPS + self-managed Postgres | No managed DB; a full disk kills the metadata store and segments |
Common Use Cases for hosted Metabase Segments
Segments earn their keep when the same filter logic appears in ten questions. Classic first use: a support dashboard where "active enterprise customers" filters tickets, usage, churn risk, and NPS identically. Cohort work gets simpler too: apply the segment instead of hand-writing created_at ranges and plan filters in every question.
Dependencies for Metabase Segments Docker hosted on Railway
You need two services, not one. The Metabase web process is the official Docker image (metabase/metabase, pin a recent v0.63.x tag rather than latest for reproducibility). It listens on port 3000 and exposes health check GET /api/health.
Deployment Dependencies for Managed Metabase Segments Service (Business Intelligence)
Set MB_DB_TYPE=postgres and companion variables: MB_DB_HOST, MB_DB_PORT (5432), MB_DB_USER, MB_DB_PASS, MB_DB_DBNAME. These point at the Railway Postgres, not the warehouse. On first boot, Metabase runs migrations against this database, then shows the setup wizard to create the admin user.
Implementation Details for Metabase Segments (Using Metabase official docker image)
After first boot, the segment workflow is entirely UI. Go to Admin > Table Metadata, pick a table, click "Segments," define one. The filter builder supports the same AND/OR logic as the question builder, but you're naming and saving globally. Segments are table-scoped: a "paying accounts" segment on users won't apply to orders unless defined there too.
How does Metabase Segments compare against other BI semantic layers and saved filters platforms
Segments are the lightest layer in Metabase's semantic stack. They're saved filters with a name and table scope. Models are saved queries that materialize (or virtualize) a transformed dataset—use a model for joins, aggregations, or column renaming.
Metabase Segments vs Looker (Looker Alternative)
Looker's equivalent lives in the model layer—dimensions and filters in LookML, often parameterized and reused across explores. Looker wins with strict governance, Git-versioned definitions, and multi-table explores with complex fanouts, but that requires a LookML developer.
Metabase Segments vs Power BI (Power BI Alternative)
Power BI has no direct equivalent. You'd approximate with DAX measures, report-level filters, or shared datasets, but no simple "save this filter for reuse across all reports" primitive for non-modelers.
Metabase Segments vs Tableau (Tableau Alternative)
Tableau's closest analog is a set or calculated field scoped to a data source, but reuse across workbooks requires publishing to Tableau Server or Cloud and careful permissions. Tableau's strength is the depth of its visualization layer and huge community.
Metabase Segments vs Apache Superset (Apache Superset Alternative)
Superset has saved queries, virtual datasets, and filter controls, but no clean "named segment" primitive. You can reuse saved queries or datasets, but filter-definition-as-object is less explicit. Superset wins on embedding flexibility and huge deployments with custom data engines.
How to use Metabase Segments (the OSS Business Intelligence)?
Start with a real audience definition that keeps reappearing. "Active customers" is canonical: last_seen_at >= now() - 30 days AND account_status = 'active'. Define it once under Admin > Table Metadata on your users or customers table.
How to self host Metabase Segments on other VPS Services (Metabase Segments self hosting guide)
Same stack works on any VPS with Docker and Postgres. Key difference from Railway: you own the network path between app and Postgres, and you'll likely want a reverse proxy for TLS.
Clone the Repository
Metabase doesn't have a traditional "clone and build" workflow for self-hosting; you run the official Docker image. Pull with docker pull metabase/metabase:v0.63.0 (substitute a current pinned tag).
Install Dependencies
Only runtime dependencies: the Metabase container and reachable Postgres. If using a reverse proxy like Caddy or Nginx, install that and terminate TLS at the proxy. Metabase expects plain HTTP on port 3000 internally.
Configure Environment Variables
Most VPS deployments go sideways here. Create a .env file or pass -e flags, persistent across restarts. Critical: MB_DB_TYPE=postgres, MB_DB_HOST=, MB_DB_PORT=5432, MB_DB_USER=metabase, MB_DB_PASS=, MB_DB_DBNAME=metabase.
Start the Metabase Segments Application
Run docker run -d --name metabase -p 3000:3000 --env-file .env metabase/metabase:v0.63.0. Wait 30–60 seconds for first-boot migrations, then hit http://:3000/api/health—{"status":"ok"} means up. Open browser, complete setup wizard, create admin account.
Official Pricing of Metabase Segments (Metabase Segments pricing)
Metabase OSS—which includes segments, models, metrics, full query builder—is free and AGPL-licensed. You pay only for infrastructure. Metabase Cloud Starter is $100/month plus per-user fees past the included seats, adding hosting, backups, and upgrades.
Metabase Segments cloud vs self hosted comparison (Pricing, features, costs, and more)
Self-hosted Metabase gives the full segment workflow with zero license cost and total control over the metadata database. The trade: you own uptime, backups, TLS, upgrades. Metabase Cloud removes that load but adds a subscription that starts at $100/month and climbs as users scale.
Monthly cost of self hosting Metabase Segments on Railway
A small Metabase + Postgres stack on Railway typically lands in $5–15/month on Hobby, depending on container size and Postgres usage. That's a range, not an invoice—your number depends on CPU minutes, database storage, backups.
System Requirements for Hosting Metabase Segments on a VPS
Metabase is not CPU-hungry for typical segment workloads. A single vCPU with 1–2GB RAM handles 10–20 active users querying a moderately sized warehouse. Real pressure comes from big result sets the JVM must hold in memory, not from segments.
Frequently Asked Questions (FAQs)
Can I move segments from one Metabase instance to another?
Not on OSS. Serialization (Pro and Enterprise) can export them; on OSS they live in the application Postgres database with no single-segment export. You can migrate the entire metadata database with pg_dump and pg_restore, moving segments with questions, dashboards, everything else.
Do segments work across different databases or just different tables?
Segments are scoped to a single table in a single connected database. A "paying accounts" segment on users in production Postgres won't apply to users in Snowflake. For cross-database reuse, build a model pulling from both sources and apply filters there.
What happens to questions using a segment when the segment definition changes?
They change with it. The segment is a live reference, not a snapshot. When an admin updates the definition—say changing "active" threshold from 30 days to 14—every question and dashboard using the segment recalculates with new logic next run.
Can non-admin users create segments?
No. In Metabase OSS only admins create or edit segments. Anyone with query access to the table can apply an existing segment but can't change it. That's governance, not limitation—it keeps "paying accounts" consistent because only a few people can change it.
How do segments differ from saved questions as filters?
A saved question returns rows; a segment returns a predicate. You can use a saved question as a filter via a join, but that's heavier and can produce surprising fanout. A segment is a WHERE clause with a name, applied before aggregation—why it works cleanly in cohort and summary queries.
Template Content
metabase/metabase
metabase/metabase