Categories

Tags

Strapi official website screenshot
Strapi official website screenshot

What is Strapi?

Strapi is an open source code alternative to Contentful. It was developed based on Node.js, an open source and headless content management system (Headless CMS). When the installation is complete, you can write content (text) and upload pictures on the interface. Finally, you can use API to call the content (returned in JSON form).

How to Deploy Strapi in China

21YunBox provides you with a simple Strapi deployment and hosting solution. You can quickly deploy using 21YunBox in the Node environment.

We provide several different options based on price and performance to fit your needs. We have also prepared two deployment solutions to assist.

Option 1: For Medium and Large Projects: A Solution with Better Performance: Strapi + PostgreSQL

Strapi can be be set up with the following steps:

  1. Register to become a 21YunBox member
  2. Fork strapi-postgres startup template
  3. Create a database
  4. Create a cloud service on 21YunBox, and allow 21YunBox to access your code base (repo)
  5. Configure the parameters
Environment Node 12.19
Build Command yarn && yarn build
Start command yarn start

For the choice of configuration, Strapi official documentation suggests Use at least 2GB for servers with memory and 1 core CPU, if you choose a machine with less memory for deployment, the deployment may fail.

Click Advanced Configuration to configure the environment variables

Environment Variable Key Environment Variable Value
NODE_ENV production
DATABASE_URL Click Database URL in the cloud database console to get
JWT_SECRET Randomly generate 32-bit characters*
ADMIN_JWT_SECRET Randomly generate 32-bit characters*

For other related environment variables, please refer to Strapi official document

# Randomly generate 32-bit characters
# Enter on the command line, and paste the generated characters into the environment variable
echo $(base64 /dev/urandom | head -c32)

6. Click “Create Now”

Deployment Example Video

How to deploy the Strapi + Postgres database to the server | 21YunBox

Option 2: For small and medium-sized projects, the most cost-effective solution: Strapi + SQLite

How to deploy?

  1. Register as a 21YunBox member
  2. Fork strapi-sqlite startup template
  3. Create a cloud service on 21YunBox, and allow 21YunBox to access your code base (repo)
  4. Configure related parameters
Environment Node 12.19
Build Command yarn && yarn build
Start command rsync -a public/ /data/public/ && yarn start

In terms of choice of configuration, Strapi official documentation suggests Use at least 2GB For servers with memory and 1 core CPU, if you choose a machine with less memory for deployment, the deployment may fail.

Click Advanced Configuration to configure environment variables

Environment Variable Key Environment Variable Value.
NODE_ENV production
DATABASE_FILENAME /data/strapi.db
JWT_SECRET Randomly generate 32-bit characters*
ADMIN_JWT_SECRET Randomly generate 32-bit characters*

For other related environment variables, please refer to strapi official document

# Randomly generate 32-bit characters
# Enter on the command line, and paste the generated characters into the environment variable
echo $(base64 /dev/urandom | head -c32)

5. Click “Create Now”

If the description of the above text is not clear, you can refer to the following actual operation video:

The first part:

  1. How to deploy Headless CMS Strapi with one-click configuration parameters
  2. How to use environment variables to store sensitive information
How to deploy Strapi to the server (1) | 21YunBox

The second part:

  1. How to enter development mode by modifying environment variables
  2. Upload sample Shop
  3. How to access interface content
How to deploy Strapi to the server (2) | 21YunBox

R & D Environment

In the R&D environment, you can use yarn develop or strapi develop for R&D and debugging.

For more introductions about Strapi, you can watch Strapi’s official introduction video

Why Choose 21YunBox?

21YunBox specializes in helping foreign businesses to host their websites in China. We deliver everything you and your team needs to build, run, and scale websites and apps in China.


Talk to an Expert

Create Professional Solutions for Your Industry and Business

or