From fb7828dc335371d9fc0f84d524d281d8e32e885d Mon Sep 17 00:00:00 2001 From: ytcleon Date: Tue, 14 Jan 2025 17:08:10 +0000 Subject: [PATCH 1/4] Update the instruction to use production Salesforce env var Add a more concrete example to change the SALESFORCE_* env var in the config file --- README.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a2a45334..e77f575f 100644 --- a/README.md +++ b/README.md @@ -53,10 +53,19 @@ See [getting started](https://financialtimes.atlassian.net/wiki/spaces/Accounts/ ### Other contracts -If you need to test a specific contract, since all contracts live in the production salesforce environment, in order to test certain contracts locally you will need to use the production `SALESFORCE_*` environment variables rather than the development ones (see Doppler). - In development mode you should be using the FT Staff contract, which is stubbed in `stubs/CA-00001558.json` +All contracts except `CA-00001558` live in the production salesforce environment. If you need to test a specific contract locally, you need to add the suffix `_PROD` to the `SALESFORCE_*` environment variables defined in `custom-environment-variables.yaml`. + +```yaml + SALESFORCE: + CALLBACK_URI: "SALESFORCE_CALLBACK_URI" # no changes needed + CLIENT_ID: "SALESFORCE_CLIENT_ID_PROD" # SALESFORCE_CLIENT_ID + CLIENT_SECRET: "SALESFORCE_CLIENT_SECRET_PROD" # SALESFORCE_CLIENT_SECRET + PASSWORD: "SALESFORCE_PASSWORD_PROD" # SALESFORCE_PASSWORD + USERNAME: "SALESFORCE_USERNAME_PROD" # SALESFORCE_USERNAME +``` + --- ## Run locally From e3361c38261145ca87f70f3453e1b51dabffcd81 Mon Sep 17 00:00:00 2001 From: ytcleon Date: Tue, 14 Jan 2025 17:12:15 +0000 Subject: [PATCH 2/4] Replace the instruction involving .env with Doppler --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e77f575f..4761d612 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,12 @@ You MIGHT need: If you need to use the database locally, set up the database by following the instructions in [next-syndication-db-schema](https://github.com/Financial-Times/next-syndication-db-schema). -If you are using postgres in Docker, you will need to edit your `.env` file to set `DATABASE_HOST` to `192.168.99.100` +If you are using postgres in Docker, you will need to edit your `custom-environment-variables.yaml` file to change `DATABASE_HOST` to `DATABASE_HOST_DOCKER` (variable already defined in Doppler). + +```yaml + DB: + host: "DATABASE_HOST_DOCKER" # DATABASE_HOST +``` ### Running the API From 630a7a6a37c3b8370e47efbccbdddc45f254f817 Mon Sep 17 00:00:00 2001 From: ytcleon Date: Tue, 14 Jan 2025 17:14:10 +0000 Subject: [PATCH 3/4] Update the instruction to use the Prod DB Current instruction is not working due to SSL verification error ssl:true option is needed on the config file to bypass such error in the DB connection string --- README.md | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4761d612..5a225c15 100644 --- a/README.md +++ b/README.md @@ -121,10 +121,27 @@ Once you have set up the projects you want to work on, and want to run all proje ### Running against prod DB (optional) -To run `next-syndication-api` against prod DB is necessary add to the environment variables defined in `custom-environment-variables.yaml` the prefix `_PROD`. -("DATABASE_NAME_PROD",DATABASE_HOST_PROD","DATABASE_PASSWORD_PROD","DATABASE_PORT_PROD","DATABASE_URL_PROD","DATABASE_USER_NAME_PROD"). +To run `next-syndication-api` against prod DB you need to add the suffix `_PROD` to the `DATABASE_*` environment variables defined in `custom-environment-variables.yaml`. + +```yaml + DB: + database: "DATABASE_NAME_PROD" # DATABASE_NAME + host: "DATABASE_HOST_PROD" # DATABASE_HOST + password: "DATABASE_PASSWORD_PROD" # DATABASE_PASSWORD + port: "DATABASE_PORT_PROD" # DATABASE_PORT + uri: "DATABASE_URL_PROD" # DATABASE_URL + user_name: "DATABASE_USER_NAME_PROD" # DATABASE_USER_NAME +``` + These variables are already defined in development Doppler folder. +In addition, you need to add the `ssl: true` option in `default.yaml` to bypass the SSL authenication error. + +```yaml + DB: + ssl: true +``` + ### Running the Syndication UI (optional) - if you also want to locally test all the `/republishing` pages, `cd` into `next-syn-list` and run `npm run start` From 8f5309f74d244bf0207b81387601b8c78be2a2de Mon Sep 17 00:00:00 2001 From: ytcleon Date: Wed, 15 Jan 2025 11:25:37 +0000 Subject: [PATCH 4/4] remove .env settings involving next-router next-router uses Doppler to store its env var and all the syn- env var are available in the dev environment in Doppler, so it is good to update those --- README.md | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 5a225c15..0f8ec2a3 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ All troubleshooting information is gathered in the [Syndication API Troubleshoot The API behind the FT.com/republishing tool. -_NB: There is a common misconception that you need all parts of Syndication to be running locally to test a single part of it. However, `next-router` will only look for a locally-running syndication API if it has the `syn-` environmental variables in the `.env` file. You can run n-syndication or next-syn-list locally and the router will use the syndication API running in production if those variables are not there._ +_NB: There is a common misconception that you need all parts of Syndication to be running locally to test a single part of it. However, `next-router` will only look for a locally-running syndication API if it has the `syn-` environmental variables in Doppler. You can run n-syndication or next-syn-list locally and the router will use the syndication API running in production if those variables are not there._ [next-syndication-api wiki page](https://financialtimes.atlassian.net/wiki/spaces/Accounts/pages/8120533017/Syndication) @@ -98,17 +98,7 @@ If you are using postgres in Docker, you will need to edit your `custom-environm Once you have set up the projects you want to work on, and want to run all projects easily, you can do so from within the `next-syndication-api`, you will need to: -- update your local [next-router](https://github.com/Financial-Times/next-router)'s `.env` file to include the following: - - ```properties - - syndication-api=3255 - syn-contract=3984 - syn-list=3566 - - ``` - - (request will fail on the browser because is an API and it requires `x-api-key` to be present in the request) +- run `next-router` locally (all the `syn-` environmental variables for `next-router` are stored in Doppler) - HOWEVER if you are also running another app like `next-syn-list` or `next-article`, do not run `next-router` at the same time. Those apps run `next-router` by default so you don't need an independent instance. In fact, trying to run an independent instance of `next-router` will stop your local `next-article` app from working.