Installation Strapi - kwantu/platformconfiguration GitHub Wiki

back

Install Mongodb

https://strapi.io/documentation/3.0.0-beta.x/guides/databases.html#mongodb-installation https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/

Create a yum repo file so that you can install MongoDB directly using yum:

vim /etc/yum.repos.d/mongodb-org-4.4.repo

[mongodb-org-4.4]
name=MongoDB Repository
baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongodb-org/4.4/x86_64/
gpgcheck=1
enabled=1
gpgkey=https://www.mongodb.org/static/pgp/server-4.4.asc

sudo yum install -y mongodb-org
## note that package seemed broken, the following worked.
sudo yum install -y mongodb-org-4.4.0 mongodb-org-server-4.4.0 mongodb-org-shell-4.4.0 mongodb-org-mongos-4.4.0 mongodb-org-tools-4.4.0
sudo yum install -y mongodb-database-tools

Create the location of the data files:

mkdir /usr/local/data/mongo
chown mongod:mongod /usr/local/data/mongo

Then point the /etc/mongod.conf to this location

Start mongo

systemctl start mongod

Restore the database

This must be done after the installation of the Strapi so that the database backup is taken from the cloned git repository

/usr/bin/mongorestore -d cms /opt/kwantuCMS/cms/cms_master_data/cms

Install Strapi

Make sure that node is running version 12.8

Install with nvm https://itnext.io/nvm-the-easiest-way-to-switch-node-js-environments-on-your-machine-in-a-flash-17babb7d5f1b

  1. in root user wget https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh
  2. chmod 755 install.sh
  3. ./install.sh
  4. install node version 12.8 nvm install 12.8

make sure that the dev tools for Centos are installed

yum group install "Development Tools" yum install gcc gcc-c++ kernel-devel make

make sure that the userid and password is set (if get git credential issue)

cd ~ mkdir ~/.git git config credential.helper store

Then install Strapi

mkdir /opt/kwantuCMS
cd /opt/kwantuCMS
git clone https://github.com/kwantu/cms.git

cd /opt/kwantuCMS/cms/
#set the access to python executable if  you get an error
npm config set python  /usr/bin/python2.7
npm install



# start strapi with one of two parameters: (configuration,production)

chmod 755 build.sh
./build.sh configuration

## Setup Nginx for the requirements


http://localhost:1337/admin

firewall-cmd --add-port=1337/tcp --permanent
firewall-cmd --reload

# setup next.js

cd /opt
git clone https://github.com/kwantu/kwantuPortal.git
cd kwantuPortal/
npm install
chmod 755 build.sh

Troubleshooting issues

UNABLE_TO_VERIFY_LEAF_SIGNATURE

In some cases the build process of NextJs fails, because the there is some error like "> Build error occurred FetchError: request to https://netefatsacms.dalrrd.gov.za/graphql failed, reason: unable to verify the first certificate ... errno: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE', code: 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'"

  1. Create the pem file with the intermediate certificates
  2. Insert the following into the build script: "export NODE_EXTRA_CA_CERTS=''/etc/nginx/ssh/dalrrd.pem''" Make sure that the certificate file may be read by the user kwantu that executes these procesess.
  3. Delete /opt/kwantuPortal/node_modules folder with al its children
  4. Make sure that you use the correct node version, v14.16.0 at the moment
  5. As user kwantu do the npm install
chown -R /opt/kwantuPortal
sudo su - kwantu
nvm use v14.16.0
cd /opt/kwantuPortal
rm -rf /opt/kwantuPortal/node_modules
npm install