Skip to content

VPS (Coolify)

This guide walks you through deploying WeaveAI to a VPS (Virtual Private Server) using Coolify, a self-hosted platform-as-a-service (PaaS) alternative to services like Vercel or Netlify.

Before you begin, ensure you have:

  • A VPS running Ubuntu 22.04 LTS or Ubuntu 24.04 LTS
  • Root/sudo and SSH access to your server
  • A domain name pointed to your VPS IP address

Connect to your VPS via SSH as the root user:

Terminal window
ssh root@your-server-ip
Terminal window
apt update

Execute the official Coolify installation script:

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

This script will automatically install all the necessary dependencies and start Coolify.

Once installation is complete, access Coolify at:

http://your-server-ip:8000

When you first access Coolify, you’ll be redirected to a registration page in order to create your admin account that let’s you manage Coolify:

  1. Fill out login information
  2. Click Create Account
  3. Once your account is created, on the next welcome page click on Let’s go to finish configuring Coolify

In this guide, we’re going to host the WeaveAI app on the same VPS where Coolify is installed. Therefore, select This Machine, and then Create “My First Project”, and lastly Go to dashboard.

  1. From the menu on the left, navigate to Projects, and then click on + Add
  2. Enter a project name (e.g., WeaveAI)
  3. Click Continue

Coolify makes database deployment simple with one-click managed databases.

  1. In the project we just created, click + Add Resource
  2. Scroll down to Databases, select PostgreSQL, and then PostgreSQL 17
  3. Configure the database:
    • Username: weaveai-db-user (or your preferred db username)
    • Password: use the auto-generated or create a custom one
    • Initial Database: weaveai-db (or your preferred db name)
  4. Click Save
  5. Take a note of the Postgres URL (internal), this is your DATABASE_URL environment variable database connection string
  1. Click Start to deploy the PostgreSQL container
  2. Wait for the status to show Running

WeaveAI needs to be configured for Docker-based deployment before you can deploy it with Coolify.

If you haven’t already set up a Git repository for WeaveAI, follow these steps:

  1. Initialize Git repository in your WeaveAI directory (where the app files are):

    Terminal window
    cd /path/to/weaveai
    git init
  2. Create a private repository on GitHub

  3. Add your remote and push the code:

    Terminal window
    git remote add origin https://github.com/yourusername/weaveai-private.git
    git add .
    git commit -m "Initial WeaveAI setup"
    git branch -M main
    git push -u origin main

WeaveAI requires the Node.js adapter for Docker deployment:

  1. Install the adapter by running this command in the WeaveAI directory (where the app files are):

    Terminal window
    npm install -D @sveltejs/adapter-node
  2. Update your svelte.config.js file on the first line, change adapter-auto to adapter-node:

    import adapter from "@sveltejs/adapter-auto"; // change this to @sveltejs/adapter-node
    import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
    /** @type {import('@sveltejs/kit').Config} */
    const config = {
    preprocess: vitePreprocess(),
    kit: {
    adapter: adapter(),
    },
    };
    export default config;
  3. Commit and push the changes:

    Terminal window
    git add .
    git commit -m "Configure adapter-node for Docker deployment"
    git push
  1. Now go back to the project we created earlier, go to Projects from the menu on the left, and click on + Add Resource
  2. Under Applications, click on Private Repository (with GitHub App)
    • If you don’t have an existing Github App, create one by clicking on the Add GitHub App button
    • Name your GitHub App and click Continue, then for the Webhook Endpoint, click on Register Now
    • You will be redirected to GitHub, make sure to authenticate and finish creating the GitHub App
    • Once that has been done, you will be redirected back to Coolify to the GitHub App you just created, in the Sources section
    • Click on Install Repositories on GitHub
    • Select the WeaveAI repository, and click on Install
  3. Select your GitHub App
  4. Confirm the desired Repository is selected, and click Load Repository
  1. Branch: main (or whatever your repository is called)
  2. Build Pack: Nixpacks (default)
  3. Base Directory: /
  4. Port: 3000 (default)
  5. Static Site: off/unchecked
  6. Click Continue
  1. In the General section of the app, scroll down until you see Build
  2. Add the following commands:
    • Install Command: npm ci
    • Build Command: npm run build
    • Start Command: node build

Set the required environment variables for WeaveAI.

Step 1: Access Environment Variables Section

Section titled “Step 1: Access Environment Variables Section”
  1. Go to your WeaveAI application in Coolify
  2. Click the Environment Variables tab
  3. Click + Add

Add each of the following environment variables:

DATABASE_URL

postgresql://YOUR_DB_USER:YOUR_DB_PASSWORD@YOUR_IP:5432/YOUR_DB

This is the Postgres URL (internal) from the earlier step when we created the database.

AUTH_SECRET

Generate a secret at auth-secret-gen.vercel.app and paste it here.

PUBLIC_ORIGIN

https://your-domain.com

Replace with your actual domain.

BODY_SIZE_LIMIT

104857600

This sets the request body size limit to 100 MB for file uploads.

  1. Since you will be pushing the database schema remotely from your local machine to your Coolify database, first you will need to make sure your database is publicly accessible. To do so, please follow these steps:
    • In the Coolify dashboard, navigate to Projects and then to your project’s Resources
    • Click on your database
    • In the General section, scroll down to the Network section, and fill out these commands:
      • Port Mappings: 3000:5432 (default)
      • Make it publicly available: enabled/on
      • Public Port: 5432
    • Scroll up and click Save
    • Scroll down to the Network section again, and take a note of the Postgres URL (public) value, this is your DATABASE_URL environment variable
  2. For detailed instructions on how to push the database schema, see the Database Schema guide.
  3. Once the database schema has been successfully pushed, come back to this guide and finish following the instructions.

After pushing the schema:

  1. Go back to your database in Coolify
  2. Disable the Public settings to keep your database secure
  3. Delete the temporary .env file from your local machine
  1. First, make sure your Domain DNS has been configured so it points to your VPS IP address
  2. While in the project on Coolify, in the General section, scroll down until you see Domains
  3. Add your domain in this format: https://your-domain.com
    • If you add it as https, an SSL certificate will be automatically generated by Coolify
    • If you add it as http (e.g. http://your-domain.com), an SSL certificate will not be generated
  4. Click Save
  1. Go to your WeaveAI application
  2. Click Deploy

Watch the deployment logs in real-time:

  1. Click the Deployments tab
  2. If the app was successfully deployed, it should say Success
  3. The app status should show Running (green)

Deployment typically takes 2-5 minutes depending on your server resources.

Coolify makes updates simple with automatic Git deployments.

When you have updates to WeaveAI:

Terminal window
git add .
git commit -m "Update WeaveAI"
git push

Option 1: Manual Deployment

  1. Go to your application in Coolify
  2. Click Deploy
  3. Coolify pulls the latest code and redeploys

Option 2: Automatic Deployments (Recommended)

  1. Go to your application, in the Advanced section
  2. Enable Auto Deploy
  3. Every push to your specified branch on GitHub will trigger an automatic deployment

Watch the deployment logs to ensure the update completes successfully.