DEV Community

Cover image for How to Deploy a Ghost Project?
21CloudBox
21CloudBox

Posted on • Updated on • Originally published at 21cloudbox.com

How to Deploy a Ghost Project?

What is Ghost?

Ghost is a free and open source blogging tool created with NodeJS. It is also used to build and run modern blogs, magazines and periodicals.

How to Deploy Ghost in China

21YunBox provides a very simple Ghost deployment method. Since there are different scenerios, we have prepared two deployment options for you.

Solution 1: For Medium and Large Projects, the Best Performance Solution: Ghost + MySQL

Ghost blogs are generally used in conjunction with MySQL databases, which is also the combination suggested by Official Document.
This solution is equipped with an independent MySQL database, the performance will be better, and it can support more users to read your blog at the same time!

Ghost Deployment

  1. Register as a 21YunBox member
  2. Create a MySQL database
  3. Click "Hosted Application" in the navigation menu, then select "Ghost"

In terms of choosing service configuration, Ghost official documentation suggests https://ghost.org/docs/hosting/#self-hosting Use at least 1GB RAM and 10GB cloud disk. If you choose a machine with fewer cloud disks for deployment, the deployment may fail.
{: .notice--warning}

4. Click Advanced Configuration and add the following environment variables:

Environment Variable Key Environment Variable Value
NODE_ENV production
url https://<app_id>.21yunbox.com
database__client mysql
database__connection__host MySQL host name
database__connection__database MySQL database
database__connection__user MySQL username
database__connection__password MySQL user password

For other Ghost environment variable configurations, please refer to Ghost official documentation: https://ghost.org/docs/config/#configuration-options

5. Click "Create Now"

Before you know it, your Ghost is deployed online and you can access it through https://<app_id>.21yunbox.com/ghost.

Alt Text Ghost blog server deployed successfully

Operation Video

If you are not sure how to perform the above steps, you can watch this example video

Solution 2: For Small and Medium-sized Projects, the most cost-effective solution is Ghost + SQLite

The Ghost blog also supports deployment schemes used in conjunction with SQLite databases. This is not an official recommendation combination. If it is a small or medium-sized project with a small number of users, this configuration is sufficient.

Ghost Deployment

You can deploy Ghost to the server through the following steps:

  1. Register as a 21YunBox member
  2. Click "Hosted Application" in the navigation menu, then select "Ghost"

In terms of choosing the service configurations, Ghost official documentation suggests https://ghost.org/docs/hosting/#self-hosting Use at least 1GB RAM and 10GB cloud disk. If you choose a machine with fewer cloud disks for deployment, the deployment may fail.
{: .notice--warning}

3. Click Advanced Configuration and add the following environment variables:

Environment Variable Key Environment Variable Value
NODE_ENV production
url https://<APP_ID>.21yunbox.com

If additional configurations are needed, please refer to Ghost official documentation: https://ghost.org/docs/config/#configuration-options{: target="_blank"}

In a matter of seconds, you will be able to access your deployment through https://<app_id>.21yunbox.com/ghost.

Alt Text Ghost blog server deployed successfully

4. Click "Create Now"

Configure a Custom Domain Name

21YunBox provides a simple custom domain name configuration, when you complete ICP record. You will only need to add a custom domain name in "Settings", and then change the main domain name by modifying the environment variable url, as follows:

Environment Variable Key Environment Variable Value
url https://www.your-domain.com

Configure Sending Mail Service

If you need to use Ghost to send mail, you can use a third-party mailing service provider, such as Mailgun, they support a quota of 10,000 emails per month.

Take Mailgun as an example. After you create an account and related Token, you can use the following environment variables to configure:

Environment Variable Key Environment Variable Value
mail__transport SMTP
mail__options__service Mailgun
mail__options__auth__user Sending email address configured in Mailgun
mail__options__auth__pass Password configured in Mailgun

If you use other sending mail service providers, you can refer to Ghost's official documents to configure yourself https://ghost.org/docs/concepts/config/#mail.

When the configuration is complete, click "Update Configuration" in the upper right corner, 21YunBox will help you restart Ghost and configure the mail service.

Why Choose 21YunBox?

21YunBox is a Cloud Service Platform based out of Beijing, China. We specialize in modern web hosting and automation solutions. This enables you to set up websites instantly.

Have questions about hosting and deploying in China? Let us know, we are happy to help! 21YunBox@gmail.com

To learn about the differences between 21YunBox and these foreign (outside of China) cloud service platforms, please refer to:



This article's content originated here

For additional detail and future modifications, refer the original post.

Top comments (0)