Skip to content
Merged

Next #6063

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
9051d0e
Bump moment-timezone from 0.5.46 to 0.5.47
dependabot[bot] Mar 6, 2025
a79d3fe
Merge branch 'master' into dependabot/npm_and_yarn/moment-timezone-0.…
ar2rsawseen Mar 6, 2025
f7fb089
Update Changelog
ar2rsawseen Mar 6, 2025
18bd04d
Merge branch 'master' into dependabot/npm_and_yarn/moment-timezone-0.…
ar2rsawseen Mar 6, 2025
2aa1e35
Merge pull request #5961 from Countly/dependabot/npm_and_yarn/moment-…
ar2rsawseen Mar 6, 2025
0881b5f
Bump countly-sdk-web from 24.11.4 to 25.1.0
dependabot[bot] Mar 6, 2025
4fbdaf1
Bump sass from 1.83.4 to 1.85.1
dependabot[bot] Mar 6, 2025
6f58568
Update Changelog
ar2rsawseen Mar 6, 2025
78a33ac
add devsetup
John-Weak Mar 6, 2025
145f15b
add .vscode to .gitignore + add links to devsetup doc
John-Weak Mar 6, 2025
9b077bd
Merge pull request #5974 from Countly/dependabot/npm_and_yarn/countly…
ar2rsawseen Mar 6, 2025
accb74c
Merge branch 'master' into dependabot/npm_and_yarn/sass-1.85.1
ar2rsawseen Mar 6, 2025
1a06be7
Changelog update
ar2rsawseen Mar 6, 2025
9565d34
Merge branch 'master' into johnweak-master
John-Weak Mar 7, 2025
d8da11b
Merge pull request #6043 from Countly/johnweak-master
kanwarujjaval Mar 7, 2025
afd714d
fix: [crashes] Remove memory addresses from stack trace grouping
pnrgenc Mar 7, 2025
b10a6b0
Merge pull request #6045 from Countly/fix-crash-groups
coskunaydinoglu Mar 7, 2025
5222dde
Merge branch 'master' into dependabot/npm_and_yarn/sass-1.85.1
ar2rsawseen Mar 7, 2025
4f9f803
Merge pull request #6004 from Countly/dependabot/npm_and_yarn/sass-1.…
ar2rsawseen Mar 7, 2025
a3a928e
Bump axios from 1.7.4 to 1.8.2 in /plugins/hooks
dependabot[bot] Mar 7, 2025
de0a513
Bump countly-sdk-nodejs from 24.10.0 to 24.10.1
dependabot[bot] Mar 7, 2025
488f044
Updated changelog
ar2rsawseen Mar 7, 2025
0db106a
Merge pull request #6029 from Countly/dependabot/npm_and_yarn/countly…
ar2rsawseen Mar 7, 2025
d3abee1
Bump form-data from 4.0.1 to 4.0.2
dependabot[bot] Mar 7, 2025
244697c
Merge branch 'master' into dependabot/npm_and_yarn/plugins/hooks/axio…
ar2rsawseen Mar 7, 2025
a095e98
Update changelog
ar2rsawseen Mar 7, 2025
4a8b76d
Merge pull request #6047 from Countly/dependabot/npm_and_yarn/plugins…
ar2rsawseen Mar 7, 2025
fe576b0
Merge branch 'master' into dependabot/npm_and_yarn/form-data-4.0.2
ar2rsawseen Mar 7, 2025
84a6170
update changelog
ar2rsawseen Mar 7, 2025
584331b
Merge pull request #5992 from Countly/dependabot/npm_and_yarn/form-da…
ar2rsawseen Mar 7, 2025
9249c1a
Bump mongodb from 6.11.0 to 6.14.2
dependabot[bot] Mar 7, 2025
2da666e
update changelog
ar2rsawseen Mar 7, 2025
dc4f8e3
Merge pull request #6033 from Countly/dependabot/npm_and_yarn/mongodb…
ar2rsawseen Mar 8, 2025
6dc9d0e
Update CHANGELOG.md
coskunaydinoglu Mar 11, 2025
5d92aef
Merge pull request #6053 from Countly/coskunaydinoglu-release.24.05.27
coskunaydinoglu Mar 11, 2025
078ac77
Merge branch 'release.24.05' into release.24.10
coskunaydinoglu Mar 11, 2025
ff22888
Merge branch 'release.24.10' into master_from_24_05_27
coskunaydinoglu Mar 11, 2025
dabff56
Update CHANGELOG.md
coskunaydinoglu Mar 11, 2025
e72fabb
Update CHANGELOG.md
coskunaydinoglu Mar 11, 2025
51461f6
Merge pull request #6054 from Countly/master_from_24_05_27
coskunaydinoglu Mar 11, 2025
83695e6
Merge branch 'master' into next
coskunaydinoglu Mar 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
145 changes: 145 additions & 0 deletions .vscode/README.devsetup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
# Local Development Setup Guide - macOS/Ubuntu

## Prerequisites
- macOS 10.15 or later / Ubuntu 22.04/24.04 LTS
- Terminal access
- Homebrew package manager

## Installation Steps

### 1. Install [Homebrew](https://brew.sh/) (if not installed) (macOS only)
```bash
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
```

### 2. Install MongoDB

[macOS](https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-os-x/):

```bash
brew tap mongodb/brew
brew install mongodb-community
brew services start mongodb-community
```

[Ubuntu](https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/):

```bash
# Install required packages
sudo apt-get install -y gnupg curl unzip

# Import MongoDB public GPG key
curl -fsSL https://www.mongodb.org/static/pgp/server-8.0.asc | \
sudo gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg \
--dearmor

# Create list file for MongoDB
echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.0 multiverse" | \
sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list

# Update and install MongoDB
sudo apt-get update
sudo apt-get install -y mongodb-org

# Start and enable MongoDB service
sudo systemctl start mongod
sudo systemctl enable mongod
```

### 3. Install [Fast Node Manager (fnm)](https://github.com/Schniz/fnm) (if no Node.js version manager is installed)
```bash
curl -fsSL https://fnm.vercel.app/install | bash
```

Add fnm to your shell configuration:

macOS:

```bash
echo 'eval "$(fnm env --use-on-cd)"' >> ~/.zshrc
source ~/.zshrc
```
Ubuntu:

```bash
echo 'eval "$(fnm env --use-on-cd)"' >> ~/.bashrc
source ~/.bashrc
```

### 4. Install Node.js
```bash
fnm install 22
fnm use 22
```

Verify the installation:
```bash
node --version
npm --version
```

### 5. Run Development Setup Script

Copy the `devsetup.sh` script from `.vscode/devsetup.sh` to your project directory (script clones the repo automatically).
1. Navigate to your project directory
2. Make the setup script executable:
```bash
chmod +x ./devsetup.sh
```

1. Run the setup script:
```bash
./devsetup.sh
```

The script will:
- Clone the repository
- Install dependencies
- Configure the development environment

### 6. Start the Development of Server/Client

Use the debug configuration(server/client) in VS Code to run the code.

By default client runs on `locahost:6001` and server runs on `localhost:3001`


## Verification
After installation, verify all components:

- MongoDB:

macOS:

```bash
brew services list | grep mongodb
```

Ubuntu:

```bash
sudo systemctl status mongod
```

- Node.js:
```bash
node --version
```

## Troubleshooting
- If MongoDB fails to start, try:

macOS:

```bash
brew services restart mongodb-community
```

Ubuntu:

```bash
sudo systemctl restart mongod
sudo systemctl status mongod
```

- If the setup script fails, check the generated log file in the current directory named \`setup_YYYYMMDD_HHMMSS.log\`
197 changes: 197 additions & 0 deletions .vscode/devsetup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
#!/bin/bash
# shellcheck disable=SC2016,SC2086,SC2046

# Script configuration
set -euo pipefail # Exit on error, undefined vars, and pipe failures
trap 'echo "Error on line $LINENO. Exit code: $?"' ERR

# Configuration variables
REPO_URL="git@github.com:Countly/countly-server.git"
REPO_NAME="countly-community"
BRANCH="master"
LOG_FILE="community_setup_$(date +%Y%m%d_%H%M%S).log"
DIR="$(pwd)/$REPO_NAME"

# Plugins that will be disabled by default
DISABLED_PLUGINS=(
"browser"
"empty"
"enterpriseinfo"
"hooks"
"ip_store"
"ldap"
"old-ui-compatibility"
"push"
"recaptcha"
"tracker"
"two-factor-auth"
"vue-example"
"white-labeling"
)

# Logging function
log() {
local level=$1
shift
local message=$*
local timestamp
timestamp=$(date '+%Y-%m-%d %H:%M:%S')
echo -e "${timestamp} [${level}] ${message}" | tee -a "$LOG_FILE"
}

# Check if command exists
command_exists() {
command -v "$1" >/dev/null 2>&1
}

# Prerequisites check
check_prerequisites() {
log "INFO" "Checking prerequisites..."

local prerequisites=(git node npm)
for cmd in "${prerequisites[@]}"; do
if ! command_exists "$cmd"; then
log "ERROR" "Required command '$cmd' not found. Please install it and try again."
exit 1
fi
done

# Create nodejs symlink if it doesn't exist and node is not already available as nodejs
if ! command_exists nodejs && command_exists node; then
log "INFO" "Creating nodejs symlink..."
sudo ln -s "$(command -v node)" /usr/local/bin/nodejs || {
log "WARNING" "Could not create nodejs symlink, but continuing as node is available"
}
fi

log "INFO" "All prerequisites verified"
}

# Repository setup
setup_repository() {
log "INFO" "Setting up repository..."

if [ -d "$REPO_NAME" ]; then
local answer
read -r -p "Directory $REPO_NAME already exists. Backup (b), remove (r), or exit (e)? " answer
case $answer in
b|B)
log "INFO" "Backing up existing directory..."
mv "$REPO_NAME" "${REPO_NAME}_backup_$(date +%Y%m%d_%H%M%S)"
;;
r|R)
log "INFO" "Removing existing directory..."
rm -rf "$REPO_NAME"
;;
*)
log "INFO" "Exiting as per user request"
exit 0
;;
esac
fi

git clone "$REPO_URL" "$REPO_NAME" || {
log "ERROR" "Failed to clone repository. Please check your SSH key and repository access."
exit 1
}

cd "$REPO_NAME" || exit 1

# Git configuration
git config --global --add safe.directory "$DIR"
git config core.fileMode false
git checkout "$BRANCH"

# Submodules setup if any
log "INFO" "Setting up submodules..."
git submodule status
git pull
git submodule init
git submodule update
}

# Configuration setup
setup_configuration() {
log "INFO" "Setting up configuration files..."

# Copy config files if they don't exist
cp -n "$DIR/api/config.sample.js" "$DIR/api/config.js" || log "WARNING" "Skipping api config - file may already exist"
cp -n "$DIR/plugins/plugins.default.json" "$DIR/plugins/plugins.json" || log "WARNING" "Skipping plugins config - file may already exist"
cp -n "$DIR/frontend/express/config.sample.js" "$DIR/frontend/express/config.js" || log "WARNING" "Skipping express config - file may already exist"
cp -n "$DIR/frontend/express/public/javascripts/countly/countly.config.sample.js" "$DIR/frontend/express/public/javascripts/countly/countly.config.js" || log "WARNING" "Skipping frontend config - file may already exist"

# Use platform-independent sed syntax
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
sed -i '' 's#countlyGlobal.path#"http://localhost:3001"#g' "$DIR/frontend/express/public/javascripts/countly/countly.config.js"
sed -i '' 's/max_pool_size: 500/max_pool_size: 20/g' "$DIR/api/config.js"
else
# Linux and others
sed -i 's#countlyGlobal.path#"http://localhost:3001"#g' "$DIR/frontend/express/public/javascripts/countly/countly.config.js"
sed -i 's/max_pool_size: 500/max_pool_size: 20/g' "$DIR/api/config.js"
fi
}

# Plugin management
manage_plugins() {
log "INFO" "Managing plugins..."

PLUGIN_JS_PATH="$DIR/bin/commands/scripts/plugin.js"
for dir in "$DIR/plugins"/*/; do
plugin=$(basename "$dir")

# Using a for loop to check array membership
is_disabled=0
for disabled_plugin in "${DISABLED_PLUGINS[@]}"; do
if [ "$plugin" = "$disabled_plugin" ]; then
is_disabled=1
break
fi
done

if [ "$is_disabled" -eq 1 ]; then
log "INFO" "Disabling $plugin..."
if node "$PLUGIN_JS_PATH" disable "$plugin"; then
log "INFO" "Successfully disabled $plugin"
else
log "ERROR" "Failed to disable $plugin"
fi
else
log "INFO" "Enabling $plugin..."
if node "$PLUGIN_JS_PATH" enable "$plugin"; then
log "INFO" "Successfully enabled $plugin"
else
log "ERROR" "Failed to enable $plugin"
fi
fi
done
}

# Main execution
main() {
log "INFO" "Starting community setup script..."

check_prerequisites
setup_repository

# Set permissions - but don't fail if we don't have sudo
sudo chmod -R 766 "$DIR" || {
log "WARNING" "Could not set full permissions on $DIR. You may need to adjust permissions manually."
}

# Install dependencies
cd "$DIR" || exit 1
npm install

setup_configuration
manage_plugins

# build locales and sass
npx grunt dist-all

log "INFO" "Community setup completed successfully!"
log "INFO" "You can now start Countly by using the debugger"
}

# Execute main function
main
34 changes: 34 additions & 0 deletions .vscode/disable_plugins.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash

set -e

echo "Script started. Working directory: $(pwd)"
echo "Received arguments: $*"

if [ -z "$1" ]; then
echo "Error: No plugin names provided."
exit 1
fi

# Read the comma-separated list of plugin names
IFS=',' read -ra PLUGINS <<< "$1"

# Get the path to the plugin.js script
PLUGIN_JS_PATH="$(pwd)/bin/commands/scripts/plugin.js"

# Loop through each plugin name
for plugin in "${PLUGINS[@]}"; do
# Trim whitespace
plugin=$(echo "$plugin" | xargs)

echo "Attempting to disable plugin: $plugin"

# Run the Node.js command for each plugin
if node --preserve-symlinks --preserve-symlinks-main "$PLUGIN_JS_PATH" disable "$plugin"; then
echo "Successfully disabled plugin: $plugin"
else
echo "Failed to disable plugin: $plugin"
fi
done

echo "Script completed."
15 changes: 15 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"github.vscode-pull-request-github",
"eamodio.gitlens",
"christian-kohler.npm-intellisense",
"christian-kohler.path-intellisense",
"ms-vscode-remote.remote-ssh",
"ms-vscode-remote.remote-ssh-edit",
"ms-vscode.remote-explorer",
"syler.sass-indented",
"vue.volar",
"usernamehw.vscode-error-lens"
]
}
Loading
Loading