Deploying with Coolify

Learn how to deploy your NextCoder applications using Coolify

Overview

Coolify is an open-source & self-hostable Heroku / Netlify / Vercel alternative. It makes deployment easy and secure with features like:

  • Automatic SSL certificates
  • One-click deployments
  • Database management
  • Team collaboration
  • Resource monitoring

Prerequisites

Before setting up Coolify, you'll need:

  • A server/VPS with at least 2GB RAM and 20GB disk space
  • Ubuntu 20.04/22.04 or Debian 11/12
  • Root access to the server
  • A domain name (optional but recommended)

Installing Coolify

SSH into your server and run the installation command:

curl -fsSL https://cdn.coollabs.io/coolify/install.sh | bash

Accessing Coolify

After installation, access Coolify through your server's IP address:

https://74.208.97.134

On first access, you'll need to create an admin account.

Setting Up Your NextCoder Application

1. Create a New Project

  1. Log in to your Coolify dashboard
  2. Click "New Project"
  3. Enter a name for your project (e.g., "NextCoder App")
  4. Click "Create"

2. Configure Source Repository

  1. In your project, click "Deploy"
  2. Select "GitHub" as your source provider
  3. Connect your GitHub account if prompted
  4. Select your NextCoder repository
  5. Choose the branch to deploy (usually "main" or "master")

3. Configure Build Settings

For Next.js applications, use these settings:

  • Build Pack: "Dockerfile" or "Nixpacks"
  • Build Command: npm run build
  • Output Directory: .next
  • Port: 3000

4. Set Environment Variables

Add your environment variables in the "Environment Variables" section:

NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=your_clerk_publishable_key
CLERK_SECRET_KEY=your_clerk_secret_key
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=your_stripe_publishable_key
STRIPE_SECRET_KEY=your_stripe_secret_key
DATABASE_URL=your_database_url
NEXT_PUBLIC_BASE_URL=https://yourdomain.com

5. Deploy

  1. Click "Deploy" to start the deployment process
  2. Coolify will build your application and deploy it
  3. Once complete, you'll get a preview URL

Setting Up a Custom Domain

  1. In your project, go to "Domains"
  2. Click "Add Domain"
  3. Enter your custom domain
  4. Follow the DNS instructions to verify ownership
  5. Coolify will automatically provision an SSL certificate

Database Setup

Coolify can also manage your PostgreSQL database:

  1. Go to "Databases" in the Coolify dashboard
  2. Click "New Database"
  3. Select "PostgreSQL"
  4. Configure database settings
  5. Deploy the database
  6. Use the provided connection string in your app

Monitoring and Logs

Coolify provides monitoring tools:

  • View application logs in real-time
  • Monitor resource usage (CPU, memory, disk)
  • Set up health checks
  • Configure alerts for downtime or performance issues

Team Collaboration

Invite team members to your Coolify account:

  1. Go to "Team" in the dashboard
  2. Click "Invite Member"
  3. Enter their email address
  4. Set appropriate permissions

Advanced Configuration

Automatic Deployments

Set up automatic deployments on code changes:

  • In your project, go to "Settings"
  • Enable "Auto-deploy" for your preferred branch
  • Configure any pre-deployment tests if needed

Rollback

If you need to rollback to a previous deployment:

  • Go to "Deployments" in your project
  • Find the deployment you want to rollback to
  • Click "Rollback" on that deployment

Troubleshooting Connection Issues

If you're having trouble connecting to your Coolify instance, check our troubleshooting guidefor solutions to common connection problems.

Getting Help