Versioned releases with a symlink layout

Replace the default public_html directory with a releases and symlink layout so your CI/CD pipeline can deploy and roll back atomically on TurboStack.

By default, your website is served from a single public_html directory in your home directory. That works well for a manual upload, but continuous integration and continuous deployment (CI/CD) pipelines usually expect a different layout: each deploy lands in its own releases/ folder, and a current symlink points at the release that is live. Switching the symlink makes a new version go live in one step, and switching it back is an instant rollback.

This page shows you how to replace public_html with that layout. Your web root stays at ~/public_html, so nothing changes for the web server: you only change what it points to.

The target layout

You are aiming for a home directory where public_html is a symlink into a versioned release, rather than a real directory:

current -> releases/<current-release>
public_html -> current
releases/
shared/
  • releases/ holds one directory per deploy (often named by timestamp or commit).
  • current is a symlink to the release that should be live.
  • shared/ holds files that must survive between releases (uploads, .env, caches).
  • public_html is a symlink to current, so the web server always serves the live release.

Step-by-step

Connect to the host over SSH first (see the host SSH tab). Run the commands from your home directory.

  1. Remove the existing public_html directory. This command only succeeds if the directory is empty, which protects you from deleting a live site by accident:

    rmdir ~/public_html

    If rmdir reports that the directory is not empty, do not force it. Move your current site into a first release directory instead, then continue.

  2. Create the releases/ and shared/ directories, or run a deploy so your pipeline creates them. This page assumes your code is already laid out with a current symlink pointing at a release, for example current -> releases/2026-07-24-1.

  3. Point public_html at the current symlink:

    ln -s current public_html
  4. Verify that the symlinks resolve as expected:

    ls -l
    # current      -> releases/<current-release>
    # public_html  -> current
    # releases/
    # shared/

From now on, your pipeline deploys a new release, repoints current, and the change is live immediately. To roll back, repoint current to the previous release.

A different root directory

Some frameworks keep current and releases/ inside a subdirectory, for example application/. In that case, only step 3 changes: point public_html at the current symlink under that subdirectory.

ln -s application/current public_html