Migrating Your Glitch Projects to Self-Hosted Deployment with Disco

With Glitch shutting down its hosting service, many developers are looking for alternatives to keep their projects running. This guide will walk you through migrating a Glitch project to a self-hosted solution using Disco, an open-source deployment platform that provides a simple experience for hosting your applications.

By the end of this tutorial, you'll have your Glitch project running on your own server with automatic HTTPS, continuous deployment from GitHub, and full control over your hosting environment.

Prerequisites

  • A Glitch project you want to migrate
  • A GitHub account
  • Access to your domain registrar for DNS configuration
  • A virtual server (VPS) from a provider like Linode, DigitalOcean, or Hetzner (more on this below)

Step 1 - Download Your Glitch Project

First, you need to get your project files from Glitch:

  1. Download your project code: Go to your Glitch project dashboard and click the "Download" button. This gives you the source code but not the assets.

  2. Download assets separately: If your project uses images or other files stored in the glitch-assets folder, you'll need to download them manually. For bulk downloading of multiple projects including assets, there's a helpful script available that can download both your code and assets automatically.

  3. Extract and organize: Extract the downloaded files to a local directory where you'll work on the migration.

Step 2 - Set Up Your Server

You'll need a virtual server to host your application. We recommend using a service like Linode, DigitalOcean, or Hetzner.

Create a Server

  1. Choose a cloud provider
  2. Create a new server with:
    • OS: Ubuntu 24.04 LTS
    • RAM: At least 4GB (recommended)
    • Location: Close to your target audience
  3. Add your SSH key for secure access
  4. Note down the server's IP address

Test SSH Access

Make sure you can connect to your server:

ssh root@<your-server-ip>

If this is your first connection, accept the server fingerprint when prompted. Exit the session once you've confirmed access:

exit

Step 3 - Configure DNS

You'll need two domain names:

  1. Server domain: For your Disco server (e.g., disco.example.com)
  2. Project domain: For your application (e.g., myproject.example.com)

Go to your domain registrar's DNS management panel and add these records:

For the server domain:

Type: A
Name: disco
Value: <your-server-ip>
TTL: 300

For the project domain:

Type: CNAME
Name: myproject
Value: disco.example.com
TTL: 300

Verify DNS propagation:

ping disco.example.com

Step 4 - Install Disco CLI

Install the Disco CLI on your local machine:

curl https://cli-assets.letsdisco.dev/install.sh | sh

Verify the installation:

disco --version

Step 5 - Initialize Your Server with Disco

Set up Disco on your server from your local machine:

disco init root@disco.example.com

Note: You can optionally specify an SSH key with -i /path/to/your/ssh/key if needed.

The command above will set up the Disco server infrastructure. Wait for the process to complete (you'll see "Done" when finished).

Step 6 - Prepare Your Project for Deployment

Now you need to prepare your Glitch project for deployment. The setup differs between static sites and Node.js applications. Make sure you're in your project directory before proceeding.

For Static Sites

If your project is a static website (HTML, CSS, JavaScript files):

  • Create project structure:
# We're assuming that you're inside of your project directory.
# The new "src" directory will live inside your project directory.
mkdir src
# Move your HTML, CSS, JS files to the src/ directory
mv *.html *.css *.js src/
  • Create a new disco.json file at the root of your project directory:
{
  "version": "1.0",
  "services": {
    "web": {
      "type": "static",
      "publicPath": "src"
    }
  }
}
  • Handle Glitch assets: If you have a glitch-assets folder, move it to src/glitch-assets and update any references in your HTML/CSS files from:
<!-- Old Glitch CDN URLs -->
<img src="https://cdn.glitch.com/uuid/image.png">

To:

<!-- New local paths -->
<img src="/glitch-assets/image.png">

For Node.js Applications

If your project is a Node.js application:

  • Ensure you have a package.json file in your project root

  • Create a disco.json file at the root of your project directory:

{
  "version": "1.0",
  "services": {
    "web": {
      "port": 3000
    }
  }
}
  • Check Node.js version: Look in your package.json for an engines.node field to see what Node.js version your project expects.

  • Create a Dockerfile file at the root of your project directory:

FROM node:18
WORKDIR /code

# Copy package files first for better caching
COPY ./package.json /code/package.json
COPY ./package-lock.json /code/package-lock.json
RUN npm install

# Copy rest of the application
COPY . /code/.
CMD ["node", "server.js"]
  • Replace node:18 with the appropriate version if your project specifies a different Node.js version, and replace "server.js" with your main entry point (could be app.js, index.js, etc.).

  • Handle Glitch assets: If you have a glitch-assets folder, move it to public/glitch-assets (or wherever your static files are served from). If you're using Express, you likely have something like express.static('public') which will serve these files.

  • Check port binding: Verify that your Node.js app listens on the same port specified in your disco.json file.

Step 7 - Set Up GitHub Repository

  • Create a new GitHub repository: Go to GitHub and create a new repository
  • Initialize locally: Copy the instructions that appear on GitHub for pushing an existing repository, which will look something like:
git remote add origin https://github.com/yourusername/your-repo.git
git branch -M main
git push -u origin main
  • Connect Disco to GitHub:
disco github:apps:add

This opens a browser window where you'll:

  • Name your GitHub application (the name will be random and generally doesn't matter)
  • Select your repository
  • Install the app

Step 8 - Deploy Your Project

Deploy your project using the Disco CLI:

disco projects:add \
  --name my-project \
  --github yourusername/your-repo \
  --domain myproject.example.com

Replace:

  • my-project with your desired project name
  • yourusername/your-repo with your actual GitHub repository path
  • myproject.example.com with the project domain you set up earlier

Step 9 - Monitor Your Deployment

To check if your project deployed correctly, you can monitor the deployment logs:

disco logs

Leave this running to see the deployment progress and any potential errors.

Once deployment completes:

  1. Visit your site: Navigate to https://myproject.example.com
  2. Check functionality: Test all features of your migrated project
  3. Verify asset loading: Ensure all images and assets load correctly

Step 10 - Automatic Deployments

Your deployment is now set up with continuous deployment. Any changes you push to your GitHub repository will automatically trigger a new deployment - there's nothing additional to configure.

Troubleshooting Common Issues

Glitch Assets Not Loading

If your assets aren't loading, check that you've:

  • Moved glitch-assets to the correct location (src/ for static sites, public/ for Node.js)
  • Updated all references from CDN URLs to local paths
  • Committed the assets to your Git repository

Node.js App Won't Start

Common issues:

  • Wrong entry point: Check your Dockerfile references the correct main file
  • Port binding: Ensure your app listens on the same port specified in your disco.json
  • Missing dependencies: Verify all dependencies are in package.json

Environment Variables

If your Glitch project used environment variables, you can set them using:

disco env:set API_KEY=your-secret-api-key
disco env:set DATABASE_URL=your-database-connection-string

What You've Accomplished

Congratulations! You've successfully migrated your Glitch project to a self-hosted solution. Your new setup includes:

  • Complete control: Your own server and infrastructure
  • Automatic deployments: Push to GitHub to deploy
  • HTTPS by default: Automatic SSL certificates
  • Custom domains: Professional URLs for your projects
  • Cost-effective hosting: Typically $5-20/month depending on your server

This setup gives you the reliability of self-hosting with the convenience you enjoyed on Glitch. You now have a robust foundation for hosting not just your migrated project, but any future web applications you build.

Next Steps

  • Explore Disco features: Check out the Disco documentation for advanced features
  • Deploy more projects: Use the same server to host multiple applications

Your project has successfully made the transition from Glitch to self-hosted infrastructure, giving you the independence and control that comes with managing your own deployment pipeline.