Setting Up New Outbound Feeds Repositories
Prerequisites
node
/npm
installed (node version > 10).- Docker
Setting up outbound feeds repositories
Outbound feeds starter repo
You can view the starter repo at /arcxp/OBF-Starter.
Creating a local repo
Clone your outbound feeds repository to your local machine. In the arcxp-ce-support GitHub account your repo will be named ORG-outboundfeeds, use your Arc organization name in place of ORG. For example, if your organization name is demo, your repository name would be demo-outboundfeeds.
git clone git@github.com:arcxp-ce-support/ORG-outboundfeeds.git
Creating a read-only personal access token in github
To be able to run locally or deploy outbound feeds you need to create a read-only token in GitHub. This token needs to be added to your .npmrc
file and will allow you to view and install outboundfeeds blocks. If you have an .npmrc
file you use for themes development, you can use the same file for outboundfeeds development. The .npmrc
file must never be added to the repo or checked in. Please use the following format when setting up your .npmrc
:
@wpmedia:registry=https://npm.pkg.github.com///npm.pkg.github.com/:_authToken=<your personal access token>
Installing npm
packages
Even if you are not going to do local development, you need to install the fusion-cli and it’s dependencies to be able to create bundles to upload to outbound feeds. Check to see what the latest version of the @arc-fusion/cli is and update your package.json
to that version.
npm install
Creating a .env
Copy the env.example
to .env
and edit the file to replace the placeholders with your correct values. The CONTENT_BASE
and ARC_ACCESS_TOKEN
values are for content sources to access your Production or Sandbox environments. You probably already use these in your other fusion repository.
CONTENT_BASE
- Set your org inhttps://api.$[ORG].arcpublishing.com
. This is used by content sources to get data from your Production or Sandbox environment. ReplaceORG
with your org name, likedemo
orsandbox.demo
. This should point to your Production or Sandbox environments, not the OBF environments. For more information, see How to Use Developer Access Tokens to Access the Arc XP APIs.ARC_ACCESS_TOKEN
- Your readonly developer token. This is used by content sources to get data from your prod or sandbox environment. If you have a developer token for your website or other ArcXP development, use that. This should be from your Production or Sandbox environments, not the OBF environments. For more information, see How to Use Developer Access Tokens to Access the Arc XP APIs.resizerKey
- Your organization’s Image Resizer key. If you don’t know your key, contact your Technical Account Manager.BLOCK_DIST_TAG
- To use Production blocks, set this tostable
. To use development blocks, set thisbeta
. Engine defaults tostable
if not set.FUSION_RELEASE
- Set this to the latest PageBuilder Engine version. When a new version becomes available, update this to the latest version and validate your environment locally.
The .env
file is in .gitignore
and should never be checked into GitHub.
Updating Mock websites
When running the editor locally, the list of websites comes from a local file instead of your site service. To have your websites used, you must update the mock file mocks/siteservice/api/v3/website
with your websites.
[ { "_id": "website1", "display_name": "Website 1", "is_default_website": true }, { "_id": "website2", "display_name": "Website 2", "is_default_website": false }]
Run Fusion locally:
npx fusion start
After Fusion finishes starting, you should be able to to get to the PageBuilder Editor Pages and Templates to add and configure feeds locally. After you have created your templates and resolvers, you can use a tool like Postman to see them at http://localhost/arc/outboundfeeds/{FEED_NAME}?outputType=xml&_website={WEBSITE}
.
Run tests with:
npm test
Deploying
When you are ready to deploy the bundle, you must set up environment variables in the environment/org-outboundfeeds.js
and environment/org-outboundfeeds-sandbox.js
files. Use the values from your local .env
to set the DIST_TAG
and resizerKey
. Rename the files, replacing the clients org name with org
in the current names. You must encrypt any values that should not be made public (resizerKey
).
Copy of your .npmrc
to .npmrc-encrypted
. Using the Secrets tab in the Editor, encrypt your GitHub access token. Wrap the encrypted value with %{ }
.
@wpmedia:registry=https://npm.pkg.github.com///npm.pkg.github.com/:_authToken=%{ your encrypted personal access token }
When you are ready to deploy a bundle, run the npx fusion zip
command. Running this command manually is fine to get started, but consider setting up a CI/CD process to automate this.
npx fusion zip