Skip to main content

Setup

This document will help you get your server setup and ready to get Blog Builder running on it!

Reminders

You must be doing this on a VPS or dedicated server, and keep in mind all install guides are for an Ubuntu 24.04 LTS Linux VPS.

Make sure that you have read through our requirements to prevent any issues later on.
And if you haven't already, make sure you have an A record on your domain pointed to the IP of your server.

Before we begin, lets make sure everything is up to date and you have curl installed:

sudo apt update
sudo apt install curl

Install Node.js

Node.js is a very popular framework for Javascript used to manage many different types of applications. Blog Builder is one type of application that requires it to be run, and since Node.js has many versions we will be using Node Package Manager (NVM) to ensure the correct version is installed and running on our system.

Install NVM and the correct Node.js version:

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash

nvm install 20

You will likely need to reopen the console after installing NVM to actually be able to run the install command.
If you want to see if it has installed and is running the correct node version, you can run: node --version in your console.

PM2 is a Node.js process manager used to keep your application running and automatically restart it if a crash occurs. It will also handle log management for you.
This is optional as you can run the application without it or use a different manager like Forever. It is up to you; however, this guide will assume you are using PM2.

Globally install PM2:

npm i -g pm2

If you want to see if it worked, you can run pm2 list (this will also show any apps being managed by PM2).

Install Nginx

Nginx is the program that we will use to route and proxy Blog Builder so it properly appears to the world on your domain.

sudo apt install nginx

You will be prompted to press Y while installing, do it.
Once it is installed, you should be able to navigate to your server's IP and you will be met with the default nginx page.
http://server_IP

Install Certbot

Certbot will allow you to automatically issue and install SSL certificates onto your domains.

sudo apt install certbot python3-certbot-nginx

Install MongoDB

MongoDB is the database program which Blog Builder uses to store all its data. MongoDB is a JSON based database which makes it easy to read and understand.

Install MongoDB

  1. Import the public key

    1. From a terminal, install gnupg and curl if they are not already available:
    sudo apt-get install gnupg curl
    1. To import the MongoDB public GPG key, run the following command:
    curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | \
    sudo gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg \
    --dearmor
    echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list
  2. Verify list file was created

    1. Navigate to /etc/apt/sources.list.d/ and verify that mongodb-org-8.0.list exists.
  3. Reload the package database

    1. Issue the following command to reload the local package database:
    sudo apt-get update
  4. Install MongoDB Community Server

    sudo apt-get install -y mongodb-org

Run MongoDB

We will be using systemd to run and manage MongoDB. You may use init if you wish, but this guide will not teach that.

  1. Start MongoDB

    sudo systemctl start mongod

    If you receive an error similar to Failed to start mongod.service: Unit mongod.service not found., run this command then try starting again:

    sudo systemctl daemon-reload
  2. Verify that MongoDB has started successfully

    sudo systemctl status mongod
  3. Ensure that MongoDB will start following a system reboot

    sudo systemctl enable mongod

Files & Nginx

Now it is time to actually install the files and setup Nginx!

info

We will be using WinSCP for all file viewing, editing, and transferring. You may use another SFTP viewer if you prefer.

Files

  1. Open your /home folder and create a new folder called blogbuilder. (You may call it anything you like, just keep in mind the guide will refer to it as blogbuilder.)
  2. Using WinSCP, copy and paste the contents of the zip you downloaded from our website into /home/blogbuilder.
  3. Install the node packages needed:
cd /home/blogbuilder
npm install
  1. Build the application:
npm run build

Nginx Configuration

Using WinSCP please head to /etc/nginx/sites-available/default as it is the default Nginx site configuration file.
Delete all the default contents from the file, if you haven't made any changes to it before.

Replace the contents with the below and ensure you set the correct domain based on your needs.

server {

server_name example.com; # Change domain to your domain

location / {
proxy_pass http://localhost:3004;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_cache_bypass $http_upgrade;
}
}

Once you've set everything correctly, save the file, and then restart Nginx:

sudo systemctl restart nginx

You can check the status with sudo systemctl status nginx if you want!

Issue SSL Certificate

We will be using Certbot to issue a SSL certificate, so we want to run the following command but make sure to replace example.com with your domain.

sudo certbot --nginx -d example.com

You will get asked for some details, like your email (but it isn't shown to the public).
When asked about a redirect method, select option 2.
Now that you have issued a certificate, we will want to make sure it self renews:

sudo certbot renew --dry-run

Configuration

You now have the server and files setup, so we can get to configuring the basics. Create a .env file in the root of your project directory and fill in the following variables.

Required

  1. LICENSE_KEY=
    1. You get this from shadowdevs.com. This is your license to use Blog Builder.
  2. MONGO_URL=
    1. The MongoDB connection string for your database. If you have not added a password to your local database, you can use: mongodb://127.0.0.1:27017/blogbuilder
  3. OWNERS=
    1. A comma-separated list of email addresses that receive owner permissions on first login. Ex: [email protected]

Optional

  1. PUBLIC_DOMAIN=
    1. Your full domain URL used for SEO canonical tags. Ex: https://yourdomain.com
info

OWNERS emails receive the owner permission automatically the first time they log in. These accounts have full admin access and cannot be restricted through the UI.

warning

Keep your .env file secure. Never commit it to version control — it contains credentials.


Starting Blog Builder

Wonderful job, you have now gotten Blog Builder fully setup and ready to start!

Ensure that you have your license key within your .env file.

Now, make sure that you are in the folder:

cd /home/blogbuilder

Replace blogbuilder with whatever you named the folder.

Start the application using PM2:

pm2 start build/index.js --name blogbuilder
pm2 save
pm2 startup

If you wish to just test it or run it outside of a process manager, then you can just do node build/index.js.


Congrats!!

You have now successfully setup and started Blog Builder! Now you can head to /auth/login on your domain and sign in with one of your OWNERS emails to get started.

info

Without a working email provider, login codes cannot be sent and no one can sign in. Head to Settings > Email in the admin panel to configure your email provider after your first login.