Skip to main content
So far, you have installed Unified CDN and ran it in development mode. Now, you can deploy it to production to use in your apps.

Prerequisites

  1. You have completed the installation steps and have a working Unified CDN instance.
  2. You have a domain name and a server to host Unified CDN. This can be a VPS, cloud server, or any other hosting solution that supports Node.js.
You must not use a serverless platform to host.Serverless platforms like Vercel and Netlify are not suitable as they often impose a max request body payload, blocking files from being uploaded directly to Unified CDN. See here for more information.

Build step

Before running any commands, make sure the OUTPUT_METHOD variable in your .env file is set to node. This will ensure that Unified CDN is built for a Node.js environment.
Run the build script using npm:

Hosting

Once the build step is completed, you can host it on your server.
In a production environment, you would typically use a process manager like PM2 to keep Unified CDN running in the background, even after you close your terminal or restart your server. You can install PM2 globally with:
Then run the following command to start Unified CDN with PM2:
This creates a new pm2 process, with the name unified-cdn. Use the name unified-cdn if you want to start, stop or restart Unified CDN with PM2. For example, to restart Unified CDN, run:
For more information on PM2 process management, see here.If you want to make Unified CDN persist across server boots, check the PM2 startup guide.

Updates

When a new version of Unified CDN is released, you can update your instance by following these steps:
1

Stop Unified CDN

Stop Unified CDN with PM2:
2

Pull latest changes

Get the latest changes from the repository:
3

Install dependencies

Install any new packages from the update:
4

Rebuild Unified CDN

Rebuild Unified CDN to apply the updates:
5

Restart Unified CDN

Restart Unified CDN with PM2: