Building a local version of Strapi is optional, as you can use a remote environment as the datasource. Using a local is useful for testing, and essential for development of new CMS features. If you don't need to run a local version of Strapi, you can skip to the Frontend development section, and ensure you point the .env file to a remote Strapi instance.
-
Navigate to the bcparks.ca/src/cms directory.
-
Run the opensearch and postgres instances
docker-compose up -d
-
Copy the .env.example file to .env (
cp .env.example .env
). -
Edit the .env file in a text editor and ensure that this line is set:
DATABASE_HOST=localhost
andDATABASE_NAME=cms
-
Run
npm install
. -
Run
npm run build && npm run develop
to run webpack, start a dev server and create the db tables. -
Create an admin user when prompted by your browser and log in
This step should be completed by someone familiar with OpenShift. It involves running terminal commands on a prod server.
-
Go to the terminal for a prod CMS pod on OpenShift
-
npm run strapi export -- --no-encrypt --only content
-
Navigate to the bcparks.ca/src/cms directory.
-
Log into OpenShift from your terminal using
oc
-
Use
oc project
to switch to the prod project in OpenShift -
oc cp <name of pod where you did the export>:<export file name>.tar.gz ./prod.tar.gz
- Run the export steps above or get someone with OpenShift permissions to run them for you. (make sure you call the file prod.tar.gz and copy it into the bcparks.ca/src/cms directory to follow these instructions)
npm run strapi import -- -f prod.tar.gz --force
npm run strapi import "---" -f prod.tar.gz --force
- Note: This is really slow and may take 1-2 hours
-
Navigate to the bcparks.ca/src/scheduler directory.
-
Copy the .env.example file to .env (
cp .env.example .env
). -
Edit the .env file in a text editor and ensure that this line is set:
STRAPI_API_TOKEN
is set -
Run
npm install
. -
Run
npm run rebuild
to create the elasticsearch index -
The cron task will run every minute on Openshift environments. On your local dev environment you can periodically run
node manage.js once
to process the indexing jobs in your Strapi Queued-tasks collection. For a full list of index management commands available, runnode manage.js help
. These management commands are also intended to be run from the terminal of the 'scheduler' container on Openshift.