How to Deploy Your VuePress Site
VuePress is a static site generator built with Vue that’s great for technical documentation and blogs. In this guide, you’ll learn how to deploy your VuePress project to an Ubuntu server using CloudRay, a centralised platform that helps you automate server tasks through Bash scripting, manage infrastructure, and execute repeatable deployments.
This guide assumes you have a basic VuePress project already created. However, If you’re new to VuePress, you can follow the VuePress Getting Started Guide to scaffold your first site.
Contents
- Adding Servers to CloudRay
- Create a Deployment Script
- Define the Variable Group
- Run the Deployment Script
- Next Step
- Summary
Adding Servers to CloudRay
Before getting started, make sure your machine is added to a CloudRay project and connected using the CloudRay Agent.
Create a Deployment Script
Now that your machine is connected to CloudRay, let’s create a reusable Bash script to automate the deployment process. You need to follow these steps to create the script in CloudRay.

- Go to Scripts in your CloudRay project
- Click New Script
- Name:
Deploy VuePress Site
. You can give it any name of your choice - Copy this code:
#!/bin/bash
# =============================
# VuePress Deployment Script
# =============================
set -e
# =============================
# 1. Install Dependencies
# =============================
sudo apt update && sudo apt install -y curl git nginx
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt install -y nodejs
sudo npm install -g pm2 serve
# =============================
# 2. Clone Repo
# =============================
cd /var/www/
git clone "{{repo_url}}" "{{app_name}}"
cd "/var/www/{{app_name}}"
# =============================
# 3. Build VuePress Site
# =============================
npm install
npm run build
# =============================
# 4. Serve with PM2
# =============================
cd docs/.vuepress
pm2 start "serve -s dist -l 3000" --name vuepress-site
pm2 save
pm2 startup
# =============================
# 5. Configure Nginx
# =============================
sudo bash -c "cat > /etc/nginx/sites-available/vuepress-site" <<EOL
server {
listen 80;
server_name {{domain_name}};
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host \$host;
proxy_cache_bypass \$http_upgrade;
}
}
EOL
sudo ln -s /etc/nginx/sites-available/vuepress-site /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
# =============================
# Done!
# =============================
echo "✅ VuePress deployed at: http://{{domain_name}}"
This script handles the entire process of installing dependencies, building your VuePress project, and running it behind Nginx using PM2.
Define the Variable Group
To make this script reusable across multiple projects or servers, you’ll define a variable group inside CloudRay. These variables dynamically fill in the placeholders like {{repo_url}}
, and {{domain_name}}
. CloudRay processes all scripts as Liquid templates.

To ensure that these values are automatically substituted when the script runs, follow these steps to create a variable Group:
- Navigate to Variable Groups: In your CloudRay project, go to “Scripts” in the top menu and click on “Variable Groups”.
- Create a new Variable Group: Click on “Variable Group”.
- Add the following variables:
repo_url
: The URL of your GitHub repositorydomain_name
: The domain pointing to the server
Since the variables is setup, proceed with running the scripts with CloudRay
Run the Deployment Script
CloudRay uses Runlogs to execute scripts on your servers while providing real-time logs of the execution process.
Once the script is saved, you can deploy your VuePress site by creating a Runlog:
- Navigate to Runlogs: In your CloudRay project, go to the Runlogs section in the top menu.
- Create a New Runlog: Click on New Runlog.
- Configure the Runlog: Fill in the required details:
- Server: Select the server you added earlier.
- Script: Choose the “Deploy VuePress Site”
- Variable Group (optional): Select the variable group you created earlier.

- Execute the Script: Click on Run Now to start the execution.

CloudRay will automatically connect to your server, run the Deploy VuePress Site
, and provide live logs to track the process. If any errors occur, you can review the logs to troubleshoot the issue.
Once the deployment is complete, you can visit http://<your_domain>
. You should see your VuePress site up and running

Next Step
To improve your deployment and security:
- You can use Let’s Encrypt to add HTTPS support
- Set up automatic redeployment with webhooks or CI/CD
Summary
With CloudRay, deploying your VuePress site to Ubuntu becomes a structured and repeatable process. Scripts remain organised, server access is centralised, and you can easily tweak configurations with variable groups.
For more deployment guides and use cases, check out our CloudRay Guides or explore the CloudRay Docs.