This is a minimalistic NodeJS express web app that demonstrates server-side integration with the Konductor API.
The app provides a server side rendered front-end and acts as a server that sends data collection and personalization requests to konductor.
- Docker (https://www.docker.com/)
- Access to Adobe Developer Console
- A valid datastream setup in Adobe Lunch
-
Clone the project
$ git clone git@github.com:adobe/konductor-server-side-demo.git
-
Add an entry in your hosts file to have
mybusiness.com
point to127.0.0.1
$ sudo vim /etc/hosts
-
Create an
.env
file by copying theenv.template
file$ cd konductor-demo-express $ cp env.template .env
-
Fill in the following variables in the
.env
fileIMS_ORG
-ORGANIZATION ID
from theCredential details
page in Adobe Dev ConsoleIMS_TECHNICAL_ACCOUNT_ID
-TECHNICAL ACCOUNT ID
from the same page as aboveIMS_CLIENT_ID
-CLIENT ID
from the same page as aboveIMS_CLIENT_SECRET
-CLIENT SECRET
from the same page as aboveDATASTREAM_ID
- A valid datastream you've set up.
-
Fill in
IMS_PRIVATE_KEY
with an "inline" version of the project's private key file, where you replace all new lines with\n
. You can copy and paste the output of$ awk '{printf "%s\\n", $0}' PATH_TO_PRIVATE_KEY_FILE
-
Import the server private key and root certificate in your keychain or keystore
- On Linux:
$ sudo cp certs/rootCA.pem /usr/local/share/ca-certificates $ sudo cp certs/server.crt /usr/local/share/ca-certificates $ sudo update-ca-certificates
- On OSX:
$ open certs/rootCA.pem $ open certs/server.crt
(or double click those files in Finder)
Open
Keychain Access
. You should see two certificates in theSystem
section formybusiness.com
. Double click each of them and set theTrust
configuration toAlways
.
NOTE: You can get all the information for steps 4 and 5 from your adobe.io/console
.
Open your project, select Service Account(JWT)
in the left menu and click the Credential details
tab.
The private key file is the one found in the configuration archive you've downloaded when you've creted the project in the Adobe Developer Console
- Enable Adobe Target on your Datastream in Adobe Launch
- Create an Adobe Target Activity
- Edit the Activity
- Configure Page Delivery (click the gear icon) to use the URL:
https://mybusiness.com
- Edit the Page name to be:
Homepage
- Save the activity
- Copy the
Activity ID
found in theOverview
tab - Fill in the
PERSONALIZATION_ACTIVITY_ID
in the.env
file with the value of yourActivity ID
Use the demo.sh
script provided with the source code to run the demo.
$ ./demo.sh
This will build and launch a docker container with your app.
Access the demo in your browser by visiting https://mybusiness.com .
In order to use a proxy you need to set PROXY_HOST
and PROXY_PORT
in your .env
file to point to your proxy configuration.
!IMPORTANT!: Because the demo is running in a docker container, you need to use host.docker.internal
instead
of localhost
to point to your machine.
PROXY_HOST="host.docker.internal"
PROXY_PORT=8888
In order to see the output of the container and debug any errors, run the
demo.sh
script with the -d
parameter like this:
$ ./demo.sh -d
Most of the time you can instruct the browser to move on (usually in the Advanced
section of the warning window)
The reason could be one of the following:
- the certificates were not imported correctly
- you've regenerated the certificates and used in invalid fqdn
- you've regenerated the certificates and didn't use the correct domain name
- check if the container stopped correctly
docker ps -a
- manually remove any leftover containers
docker rm -f konductor-demo-express
or run./demo.sh stop
Run
$ ./demo.sh stop
or manually stop the konductor-demo-express
docker container:
docker rm -f konductor-demo-express
In order to change the domain you need to do the following:
First you need to edit certs/v3.ext
and change DNS.1
and DNS.2
to point to your desired domain name.
Then you need to run ./gen-certs.sh
from the certs
folder and fill in the form with valid data.
Update the .env
file and put the new password you've used when recreating the certificates into
the SERVER_KEY_PASSPHRASE
env var.
Edit .env
and change SITE_URL
Go to Adobe Target, edit your activity and change Page Delivery
to have the URL point to your new domain.
Contributions are welcomed! Read the Contributing Guide for more information.
This project is licensed under the Apache V2 License. See LICENSE for more information.