Analytics docker image unhealthy when self-hosting due to migration issue (`sources` not found)
Problem
Bug report - [X] I confirm this is a bug with Supabase, not with my own application. - [X] I confirm I have searched the Docs, GitHub Discussions, and Discord. Describe the bug Well I am trying to deploy the supabase localhost to the Red Hat Linux server and I am not able to start the container it shows that analytics can't start To Reproduce Steps to reproduce the behavior, please provide code snippets or a repository: 1. Clone the repo 2. Do export DOCKER_DEFAULT_PLATFORM=linux/amd64 3. Build the studio 4. You will get the error Expected behavior It should start normally Screenshots <img width="653" alt="image" src="https://github.com/user-attachments/assets/e0cddf53-b081-4da4-b9a4-33304ab982d0"> <img width="301" alt="image" src="https://github.com/user-attachments/assets/f9b05cb1-ee1a-4a27-8f5b-f831ecbdc58a"> System information - OS: macOS - Browser (if applies) [e.g. chrome, safari] - Version of supabase-js: [e.g. 6.0.2] - Version of Node.js: [e.g. 10.10.0] Additional context Well I have macOS and I am building the image for the Red Hat Linux server and I am failing to do so
Error Output
error ## Expected behavior
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Fix Analytics Docker Image Unhealthy Due to Migration Issue
The error occurs because the analytics service is unable to find the required `sources` table during the migration process. This can happen if the database schema is not properly initialized or if there are missing migration files in the Docker image.
Awaiting Verification
Be the first to verify this fix
- 1
Ensure Database Initialization
Before starting the analytics container, ensure that the database is initialized correctly. This can be done by running the migration scripts that create the necessary tables.
bashdocker-compose run --rm supabase db migrate - 2
Check Migration Files
Verify that all required migration files are present in the repository. If any migration files are missing, you may need to fetch them from the upstream repository or recreate them.
bashgit fetch upstream && git checkout upstream/main -- path/to/migrations - 3
Rebuild Docker Images
After ensuring that the migrations are correct, rebuild the Docker images to ensure that the latest changes are included.
bashdocker-compose build --no-cache - 4
Start Docker Containers
Start the Docker containers again to see if the analytics service starts successfully without errors.
bashdocker-compose up - 5
Verify Analytics Service Health
Check the health of the analytics service by inspecting the logs or using Docker commands to ensure it is running without issues.
bashdocker-compose logs analytics
Validation
Confirm the fix worked by checking that the analytics service starts without errors and that the `sources` table is present in the database. You can verify this by connecting to the database and running a query to check for the existence of the `sources` table.
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep