Skip to content

Commit 99df65e

Browse files
Merge pull request #6089 from Countly/journey+content-main
Update master with latest journey+content-main
2 parents 97670ba + ee433fc commit 99df65e

21 files changed

Lines changed: 940 additions & 403 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: Deploy Journey Engine
4+
5+
# Controls when the workflow will run
6+
on:
7+
# Triggers the workflow on push or pull request events but only for the master branch
8+
push:
9+
branches: [ next ]
10+
11+
# Allows you to run this workflow manually from the Actions tab
12+
workflow_dispatch:
13+
14+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
15+
jobs:
16+
# This workflow contains a single job called "build"
17+
deploy:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
22+
- uses: actions/checkout@v3
23+
24+
- name: Deploy server
25+
shell: bash
26+
env:
27+
SSH_PRIVATE_KEY: ${{ secrets.STABLE_JE_SSH_PRIVATE_KEY }}
28+
run: bash ./bin/scripts/deploy-je.sh

CHANGELOG.md

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
## Version 25.03.2
22
Fixes:
3+
- [alerts] alerts table default order should be by creation time newest at the top
4+
- [content_builder] Reformulate asset library and add asset drag and drop upload to builder input
35
- [user-management] Prevent global admin from self-revoke and self-delete
46

5-
Enterprise fixes:
6-
- [cohorts] Fixed issue with combining multiple cohorts
7-
- [drill] Fixed issue with column naming in export according to event
8-
- [drill] Fixed an issue with incorrect date range in report manager
7+
## Version 24.12.x
98

10-
## Version 25.03.1
119
Fixes:
12-
- [crashes] Remove memory addresses from stack trace grouping
13-
- [script] Refined delete_custom_events.js to clean up faulty/dead events completely.
10+
- [push] Fixed bug where IOS credentials get mixed up while sending messages from different apps at the same time
11+
- [push] Fixed bug where it crashes in connection pool growth because of a type mismatch in an if condition
1412

15-
Enterprise Fixes:
16-
- [ab-testing] Fixed bug with variant user filtering
17-
- [license] Fixed issue with handling invalid date periods
13+
Features:
14+
- [user-management] Global admins can now disable 2FA for individual users
15+
16+
Fixes:
17+
- [gridfs] fixes for moving to Promises
1818

1919
Dependencies:
20-
- Bump axios from 1.7.4 to 1.8.2 in /plugins/hooks
20+
- Bump express from 4.21.1 to 4.21.2
21+
- Bump mocha from 10.2.0 to 10.8.2
22+
- Bump sass from 1.81.0 to 1.83.1
2123
- Bump countly-sdk-nodejs from 24.10.0 to 24.10.1
22-
- Bump countly-sdk-web from 24.11.4 to 25.1.0
23-
- Bump form-data from 4.0.1 to 4.0.2
24-
- Bump moment-timezone from 0.5.46 to 0.5.47
25-
- Bump mongodb from 6.11.0 to 6.14.2
26-
- Bump sass from 1.83.4 to 1.85.1
24+
- Bump countly-sdk-web from 24.11.2 to 24.11.3
25+
- Bump express-rate-limit from 7.4.1 to 7.5.0
26+
- Bump puppeteer from 23.10.4 to 23.11.1
2727

28-
## Version 25.03
28+
## Version 24.12
2929
Features:
3030
- [audit-logs] Exported audit logs from UI now would have "BEFORE" and "AFTER" fields
3131
- [core] Ability to mark reports as 'dirty' to make sure they are regenerated in full
@@ -4635,4 +4635,3 @@ This version provides several features and bugfixes to both server and SDKs. The
46354635
A user of an application can only view analytics for that application
46364636
and cannot edit its settings.
46374637
* Added csfr protection to all methods provided through app.js.
4638-

bin/scripts/deploy-je.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
# Generate a timestamp for the log file
4+
TIMESTAMP=$(date +"%Y%m%d_%H%M%S")
5+
LOG_FILE="deploy_$TIMESTAMP.log"
6+
7+
# Check if the event is a push to the "next" branch in the "Countly/countly-server" repository
8+
if [ -z "$GITHUB_HEAD_REF" ] && [ "$GITHUB_REPOSITORY" == "Countly/countly-server" ]; then
9+
GITHUB_BRANCH=${GITHUB_REF#refs/heads/}
10+
echo "$GITHUB_BRANCH"
11+
if [ "$GITHUB_BRANCH" == "next" ]; then
12+
echo "$SSH_PRIVATE_KEY" > je-deploy-key
13+
mkdir -p ~/.ssh
14+
mv je-deploy-key ~/.ssh/id_rsa
15+
chmod 600 ~/.ssh/id_rsa
16+
17+
# Log the deployment command with a timestamped log file
18+
ssh -oStrictHostKeyChecking=no "stable-je@stable-je-cb.count.ly" \
19+
"sudo su -c 'bash /opt/deploy.sh > /var/log/github-action/$LOG_FILE 2>&1 &'"
20+
fi
21+
fi
22+
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// Script that adds creation date for existing alerts.
2+
3+
const pluginManager = require('../../../plugins/pluginManager.js');
4+
5+
pluginManager.dbConnection().then(async(countlyDb) => {
6+
try {
7+
await countlyDb.collection('alerts').updateMany(
8+
{ createdAt: { $exists: false } },
9+
[
10+
{
11+
$set: {
12+
createdAt: { $toDouble: { $toDate: "$_id" } }
13+
}
14+
}
15+
]
16+
);
17+
console.log("Finished adding creation date for existing alerts.");
18+
}
19+
catch (error) {
20+
console.log(`Error adding creation date for existing alerts: ${error}`);
21+
}
22+
finally {
23+
countlyDb.close();
24+
}
25+
});
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
const pluginManager = require('../../../../plugins/pluginManager.js');
2+
3+
/********************************************/
4+
/* 1) With this script, if there is any cooldown defined before in the APPS collection(in the plugins.content), it will be moved to the APPS collection in the plugins.journey_engine */
5+
/* 2) Also, if there is any cooldown defined before in the PLUGINS collection(in the plugins.content), it will be moved to the PLUGINS collection in the plugins.journey_engine */
6+
/********************************************/
7+
8+
console.log("=== Migrating 'content' cooldown to 'journeys' in apps and plugins collections ===");
9+
10+
pluginManager.dbConnection().then(async(countlyDb) => {
11+
try {
12+
/********************************************/
13+
/* 1) in the APPS collection content->journey_engine, APP SETTING */
14+
/********************************************/
15+
console.log("Starting migration in apps collection...");
16+
17+
const apps = await countlyDb.collection("apps").find({"plugins.content": { $exists: true }}).toArray();
18+
if (!apps || apps.length === 0) {
19+
console.log("No apps require content->journeys migration");
20+
}
21+
else {
22+
console.log(`Found ${apps.length} apps to migrate`);
23+
for (let appDoc of apps) {
24+
appDoc.plugins.journey_engine = appDoc.plugins.content;
25+
delete appDoc.plugins.content;
26+
27+
await countlyDb.collection("apps").updateOne(
28+
{ _id: appDoc._id },
29+
{ $set: { plugins: appDoc.plugins }}
30+
);
31+
}
32+
console.log("Apps content->journeys migration DONE");
33+
}
34+
35+
/********************************************/
36+
/* 2) in the PLUGINS collection update the document which _id: "plugins, GLOBAL SETTING"*/
37+
/********************************************/
38+
console.log("Updating '_id: plugins' document in plugins collection...");
39+
40+
const pluginsDoc = await countlyDb.collection("plugins").findOne({ _id: "plugins" });
41+
if (!pluginsDoc) {
42+
console.log("No document found in plugins collection with _id: plugins");
43+
}
44+
else {
45+
let needUpdate = false;
46+
47+
// 2.a) Remove "plugins.content" boolean field
48+
if (pluginsDoc.plugins && Object.prototype.hasOwnProperty.call(pluginsDoc.plugins, "content")) {
49+
delete pluginsDoc.plugins.content;
50+
needUpdate = true;
51+
console.log("Removed plugins.content boolean field.");
52+
}
53+
54+
// 2.b) Move content.cooldown to journey_engine.cooldown
55+
if (pluginsDoc.content && typeof pluginsDoc.content === 'object') {
56+
if (typeof pluginsDoc.content.cooldown !== 'undefined') {
57+
if (!pluginsDoc.journey_engine || typeof pluginsDoc.journey_engine !== 'object') {
58+
pluginsDoc.journey_engine = {};
59+
}
60+
pluginsDoc.journey_engine.cooldown = pluginsDoc.content.cooldown;
61+
console.log(`Copied content.cooldown = ${pluginsDoc.content.cooldown} to journey_engine.cooldown`);
62+
}
63+
64+
// remove the top-level "content" object
65+
delete pluginsDoc.content;
66+
needUpdate = true;
67+
console.log("Removed top-level content object.");
68+
}
69+
70+
// if any changes were made, update the document
71+
if (needUpdate) {
72+
await countlyDb.collection("plugins").updateOne(
73+
{ _id: "plugins" },
74+
{ $set: pluginsDoc }
75+
);
76+
console.log("plugins document updated successfully");
77+
}
78+
else {
79+
console.log("No changes required for _id: plugins document");
80+
}
81+
}
82+
}
83+
catch (err) {
84+
console.error("Error during cooldown setting migration:", err);
85+
}
86+
finally {
87+
countlyDb.close();
88+
console.log("Cooldown migration script finished, DB connection closed.");
89+
}
90+
});
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/**
2+
* Modifies all active journey versions to show in-use label on the UI
3+
* Server: countly
4+
* Path: countly dir/bin/upgrade/DEV/scripts/update_journey_versions.js
5+
* Command: node update_journey_versions.js
6+
*/
7+
const pluginManager = require('../../../../plugins/pluginManager.js');
8+
9+
console.log("Modifying active journey versions...");
10+
11+
pluginManager.dbConnection().then(async(countlyDb) => {
12+
try {
13+
const collection = countlyDb.collection('journey_versions');
14+
15+
const result = await collection.updateMany(
16+
{ status: "active" },
17+
{ $set: { lastActivated: true } }
18+
);
19+
20+
console.log(`Successfully modified ${result.modifiedCount} active journey versions.`);
21+
}
22+
catch (error) {
23+
console.error("Error modifying active journey versions: ", error);
24+
}
25+
finally {
26+
countlyDb.close();
27+
}
28+
});

0 commit comments

Comments
 (0)