
How to Self-Host Supabase on Coolify: The Complete Guide
Self-hosting your backend infrastructure gives you complete control over your data and applications. If you're looking for a Firebase alternative with the freedom of self-hosting, Supabase combined with the Coolify platform offers an excellent solution. This comprehensive guide will walk you through how to self-host Supabase on Coolify, from prerequisites to advanced configurations.
Table of Contents
Introduction to Self-Hosting Supabase
Supabase has emerged as a powerful open-source alternative to Firebase, providing PostgreSQL database, authentication, storage, and serverless functions. Self-hosting Supabase gives you several advantages:
- Complete control over your data and infrastructure
- Potential cost reduction compared to managed cloud services
- Freedom from vendor lock-in
- Flexibility to customize your deployment
Coolify makes self-hosting easier by providing a user-friendly platform to deploy and manage applications on your own infrastructure. It acts as a management layer over Docker, simplifying complex deployments while supporting a wide range of server options.
Prerequisites for Self-Hosting Supabase
Before starting the deployment process, ensure you have the following prerequisites in place:
Server Requirements
Requirement | Specification | Notes |
---|---|---|
Server Type | VPS, Dedicated Server, or Local Machine | Must be accessible via SSH |
Operating System | Linux (Ubuntu recommended) | Coolify is designed for Linux-based systems |
RAM | Minimum 2GB | More recommended for production use |
Docker | Version 24+ | Must be installed and running |
Command-line tools | curl | Required for installation scripts |
Coolify Installation
If you don't have Coolify installed yet, follow these steps:
- SSH into your server as root
- Run the Coolify installation script:
curl -fsSL https://get.coolify.io | bash
- Access the Coolify dashboard by navigating to
http://YOUR_SERVER_IP:8000
- Complete the initial setup process
Network Configuration
Ensure your server's firewall allows traffic to the following ports:
- Port 8000 - For Coolify's web interface
- Port 80/443 - For HTTP/HTTPS traffic to your Supabase instance
- Additional ports used by Supabase services (if needed)
Step-by-Step Deployment of Supabase on Coolify
Now that you have the prerequisites in place, let's deploy Supabase on Coolify with these simple steps:
1. Create a New Project in Coolify
- Log in to your Coolify dashboard
- Navigate to the "Projects" tab
- Click the "Add" or "Create New Project" button
- Enter a name for your project (e.g., "Supabase")
- Select the appropriate environment (e.g., "Production")
- Click "Add" to create the project
Projects in Coolify help you organize multiple self-hosted applications and services in a logical manner.
2. Add Supabase as a Resource
- Within your newly created project, click "Add a new resource"
- Search for "Supabase" in the available services
- Select "Supabase" from the results
Coolify provides Supabase as a ready-to-deploy service, which abstracts away the complexity of manually configuring Docker containers.
3. Select the Target Server
For optimal performance and stability, consider deploying Supabase on a separate server from the one running Coolify itself:
- From the server selection dropdown, choose your target server
- Ideally, select a server different from where Coolify is running
To add additional servers to Coolify, navigate to the "Servers" section and provide the server's IP address and SSH credentials.
4. Configure the URL (Optional)
You can customize the initial URL for your Supabase instance:
- In the deployment setup, locate the URL configuration field
- Customize the URL prefix if desired (e.g., "db.yourdomain.com")
More advanced domain configuration can be done after the initial deployment.
5. Deploy Supabase
- Click the "Deploy" button to start the deployment process
- Coolify will pull the necessary Docker images and start the containers
- Monitor the deployment progress in the Coolify dashboard
- Wait for all services to show a "healthy" or "running" status (indicated by green icons)
Post-Deployment Configuration and Access
After successfully deploying Supabase, you'll need to access and configure the Supabase Studio interface:
Accessing Supabase Studio
- In the Coolify dashboard, copy the URL provided for your Supabase resource (without any port number)
- Open this URL in a web browser to access the Supabase Studio login page
- Locate the login credentials in the Coolify interface under the resource's "General Settings" or "Credentials" section
- Look for fields named "Supabase Dashboard User" and "Supabase Dashboard Password"
- Use these credentials to log in to Supabase Studio
Exploring Supabase Studio
Once logged in, you'll have access to a comprehensive suite of tools for managing your Supabase project:
- SQL Editor - For executing database queries
- Table Editor - For managing database schema
- Authentication - For configuring user sign-up and login methods
- Storage - For managing file uploads
- Edge Functions - For serverless backend logic
- API Documentation - For integrating with client applications
Explore the Supabase documentation to learn how to effectively use these features for your application.
Advanced Configuration
To fully customize your self-hosted Supabase instance, you may want to implement some advanced configurations:
Setting Up a Custom Domain
Using a custom domain improves branding and makes your Supabase instance more accessible:
- Navigate to the settings of your Supabase resource in Coolify
- Find the Kong API gateway settings and edit them to add your custom domain
- Create a DNS record with your domain provider that points to your server's IP address:
- Create an "A" record pointing your domain or subdomain to the server's IP address
- Or create a "CNAME" record if appropriate for your setup
- Update environment variables in Coolify:
- Set API_EXTERNAL_URL to your custom domain (e.g., https://supabase.yourdomain.com)
- Update ADDITIONAL_REDIRECT_URLS to include your custom domain
Configuring Email Services
To enable user registration, password resets, and email confirmations, configure an SMTP server:
- In the Coolify interface, go to your Supabase resource's environment variables
- Configure the following SMTP variables:
- SMTP_HOST - Your SMTP server address
- SMTP_PORT - Typically 465 for SMTPS or 587 for STARTTLS
- SMTP_USER - Email address or username for the SMTP server
- SMTP_PASS - Password for the SMTP account
- SMTP_ADMIN_EMAIL - The email address from which Supabase will send emails
- SMTP_SENDER_NAME - The name that will appear in the "From" field
- Optional: Customize email templates by editing the HTML files in the persistent storage associated with the Supabase service
Managing Environment Variables
Fine-tune your Supabase instance by configuring important environment variables:
Variable | Purpose | Notes |
---|---|---|
JWT_SECRET | Used for signing and verifying JWTs | Critical for authentication security |
ANON_KEY | Public API key for client-side access | Has restricted permissions |
SERVICE_ROLE_KEY | Administrative API key | Use with extreme caution, server-side only |
DISABLE_SIGNUP | Controls whether new users can sign up | Set to "true" to prevent new sign-ups |
ENABLE_EMAIL_SIGNUP | Controls email-based sign-up | Set to "false" to disable email sign-up |
Coolify provides both standard and developer views for managing these variables. The developer view offers more granular control through raw editing of configuration files.
Troubleshooting Common Issues
Even with Coolify's streamlined process, you might encounter issues when self-hosting Supabase. Here are solutions to common problems:
Supabase Build Error with MinIO x86 v2 or minio/mc
Unhealthy Exit
If you're encountering a Supabase build error related to MinIO x86 v2 or see errors like:
CreateBucket error
or minio/mc exit with unhealthy status
A fix suggested by Theo in Tech involves switching to the latest v1-compatible MinIO images. These versions are more stable on x86 architectures. Use the following Docker images (as of 04/10/2024):
- MinIO Server:
minio/minio:RELEASE.2024-10-02T17-50-41Z-cpuv1
- MinIO Client (mc):
minio/mc:RELEASE.2024-10-02T08-27-28Z-cpuv1
![]() |
Source: |
docker-compose.yml
with the above versions to resolve the issue.
Analytics Container Failing
If the Supabase Analytics container fails to start or crashes repeatedly:
- Check the container logs in Coolify for specific error messages
- Consider temporarily reverting to an older, stable version of the Docker Compose file
- If you've made the PostgreSQL database publicly accessible (not recommended without security measures), you could try connecting directly to the database and manually creating the necessary _supabase database and schemas
Database Accessibility Issues
If you need to make the Supabase database publicly accessible, Coolify has a known bug with a specific workaround:
- In Coolify, set the "Supabase Db" option to "public"
- Go to the "General" tab and click "Edit Compose File"
- In the docker-compose.yml file, locate the supabase-db service
- Under the ports section, add:
- ${POSTGRES_PORT:-5432}:${POSTGRES_PORT:-5432}
- Save the file and restart the Supabase service
- If changing the default PostgreSQL port, also update the POSTGRES_PORT environment variable
Deployment Failures
If your Supabase deployment fails in Coolify:
- Examine the deployment logs in Coolify for specific error messages
- Verify that your server meets the minimum resource requirements
- Check that Docker is running correctly (SSH into the server and run
docker ps
) - Ensure proper network connectivity between the Coolify server, target server, and external resources
Security Considerations
Securing your self-hosted Supabase instance is crucial to protect sensitive data:
Changing Default Credentials
Immediately after deployment, change the default credentials:
- Update the Supabase dashboard username and password in the Supabase Studio interface or through Coolify's environment variables
- Look for variables named DASHBOARD_USERNAME and DASHBOARD_PASSWORD
Managing API Keys
Supabase uses two main API keys that need proper handling:
- anon key - For public read access, should be handled carefully
- service_role key - For administrative access, must be kept highly secure and used only in server-side environments
Consider using a dedicated secrets manager for storing these keys securely.
Network Security
- Configure firewall rules to restrict access to only necessary ports
- Use HTTPS to encrypt communications (Coolify can automatically set up Let's Encrypt certificates)
- If exposing the PostgreSQL database directly (not recommended), implement strong authentication and IP restrictions
Limitations of Self-Hosted Supabase
While self-hosting offers many benefits, be aware of these potential limitations compared to the fully managed Supabase platform:
- Some advanced features may not be available in the self-hosted version
- Edge Functions, detailed logging, and comprehensive reporting tools might be limited
- Manual configuration may be required for certain tasks that are automated in the cloud version
- Managing multiple isolated Supabase projects might require separate deployments
- The Supabase CLI might have reduced functionality with self-hosted instances
Evaluate your specific feature requirements before choosing self-hosting over the managed cloud platform.
Conclusion
Self-hosting Supabase on Coolify provides a powerful, flexible backend solution with complete control over your data and infrastructure. By following this comprehensive guide, you can successfully deploy, configure, and secure your own Supabase instance.
Coolify's one-click deployment significantly simplifies what would otherwise be a complex setup process, making self-hosting accessible even to those without extensive DevOps experience. The post-deployment configurations allow you to customize your instance to meet your specific needs.
While self-hosting requires more management than using the fully managed Supabase platform, the benefits of control, potential cost savings, and avoiding vendor lock-in make it an attractive option for many developers and organizations.
- Coolify Official Website: coolify.io
- Coolify Documentation: coolify.io/docs
- Supabase Official Website: supabase.com
- Supabase Documentation: supabase.com/docs