chore: Add "Installation Started" event (#21620)
This commit is contained in:
parent
5f59ed8bdb
commit
6d65f4a7f1
|
|
@ -11,6 +11,7 @@ import com.appsmith.server.domains.UserState;
|
||||||
import com.appsmith.server.dtos.UserSignupRequestDTO;
|
import com.appsmith.server.dtos.UserSignupRequestDTO;
|
||||||
import com.appsmith.server.exceptions.AppsmithError;
|
import com.appsmith.server.exceptions.AppsmithError;
|
||||||
import com.appsmith.server.exceptions.AppsmithException;
|
import com.appsmith.server.exceptions.AppsmithException;
|
||||||
|
import com.appsmith.server.helpers.NetworkUtils;
|
||||||
import com.appsmith.server.helpers.UserUtils;
|
import com.appsmith.server.helpers.UserUtils;
|
||||||
import com.appsmith.server.services.AnalyticsService;
|
import com.appsmith.server.services.AnalyticsService;
|
||||||
import com.appsmith.server.services.CaptchaService;
|
import com.appsmith.server.services.CaptchaService;
|
||||||
|
|
@ -224,8 +225,10 @@ public class UserSignupCEImpl implements UserSignupCE {
|
||||||
|
|
||||||
return Mono.when(
|
return Mono.when(
|
||||||
userDataService.updateForUser(user, userData),
|
userDataService.updateForUser(user, userData),
|
||||||
configService.getInstanceId()
|
Mono.zip(configService.getInstanceId(), NetworkUtils.getExternalAddress().defaultIfEmpty("unknown"))
|
||||||
.flatMap(instanceId -> {
|
.flatMap(tuple -> {
|
||||||
|
final String instanceId = tuple.getT1();
|
||||||
|
final String ip = tuple.getT2();
|
||||||
log.debug("Installation setup complete.");
|
log.debug("Installation setup complete.");
|
||||||
analyticsService.identifyInstance(instanceId, userData.getRole(), userData.getUseCase());
|
analyticsService.identifyInstance(instanceId, userData.getRole(), userData.getUseCase());
|
||||||
return analyticsService.sendEvent(
|
return analyticsService.sendEvent(
|
||||||
|
|
@ -236,7 +239,8 @@ public class UserSignupCEImpl implements UserSignupCE {
|
||||||
"subscribe-marketing", userFromRequest.isSignupForNewsletter(),
|
"subscribe-marketing", userFromRequest.isSignupForNewsletter(),
|
||||||
"email", userFromRequest.isSignupForNewsletter() ? user.getEmail() : "",
|
"email", userFromRequest.isSignupForNewsletter() ? user.getEmail() : "",
|
||||||
"role", ObjectUtils.defaultIfNull(userData.getRole(), ""),
|
"role", ObjectUtils.defaultIfNull(userData.getRole(), ""),
|
||||||
"goal", ObjectUtils.defaultIfNull(userData.getUseCase(), "")
|
"goal", ObjectUtils.defaultIfNull(userData.getUseCase(), ""),
|
||||||
|
"ip", ip
|
||||||
),
|
),
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,22 @@
|
||||||
set -e
|
set -e
|
||||||
set -o xtrace
|
set -o xtrace
|
||||||
|
|
||||||
|
if [[ -n ${APPSMITH_SEGMENT_CE_KEY-} ]]; then
|
||||||
|
ip="$(curl -sS https://api64.ipify.org || echo unknown)"
|
||||||
|
curl \
|
||||||
|
--user "$APPSMITH_SEGMENT_CE_KEY:" \
|
||||||
|
--header 'Content-Type: application/json' \
|
||||||
|
--data '{
|
||||||
|
"userId":"'"$ip"'",
|
||||||
|
"event":"Instance Start",
|
||||||
|
"properties": {
|
||||||
|
"ip": "'"$ip"'"
|
||||||
|
}
|
||||||
|
}' \
|
||||||
|
https://api.segment.io/v1/track \
|
||||||
|
|| true
|
||||||
|
fi
|
||||||
|
|
||||||
stacks_path=/appsmith-stacks
|
stacks_path=/appsmith-stacks
|
||||||
|
|
||||||
function get_maximum_heap() {
|
function get_maximum_heap() {
|
||||||
|
|
@ -315,7 +331,7 @@ init_postgres() {
|
||||||
echo "Found existing Postgres, Skipping initialization"
|
echo "Found existing Postgres, Skipping initialization"
|
||||||
else
|
else
|
||||||
echo "Initializing local postgresql database"
|
echo "Initializing local postgresql database"
|
||||||
|
|
||||||
mkdir -p $POSTGRES_DB_PATH
|
mkdir -p $POSTGRES_DB_PATH
|
||||||
|
|
||||||
# Postgres does not allow it's server to be run with super user access, we use user postgres and the file system owner also needs to be the same user postgres
|
# Postgres does not allow it's server to be run with super user access, we use user postgres and the file system owner also needs to be the same user postgres
|
||||||
|
|
@ -329,18 +345,18 @@ init_postgres() {
|
||||||
|
|
||||||
# Create mockdb db and user and populate it with the data
|
# Create mockdb db and user and populate it with the data
|
||||||
seed_embedded_postgres
|
seed_embedded_postgres
|
||||||
|
|
||||||
# Stop the postgres daemon
|
# Stop the postgres daemon
|
||||||
su postgres -c "/usr/lib/postgresql/13/bin/pg_ctl stop -D $POSTGRES_DB_PATH"
|
su postgres -c "/usr/lib/postgresql/13/bin/pg_ctl stop -D $POSTGRES_DB_PATH"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
runEmbeddedPostgres=0
|
runEmbeddedPostgres=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
seed_embedded_postgres(){
|
seed_embedded_postgres(){
|
||||||
# Create mockdb database
|
# Create mockdb database
|
||||||
psql -U postgres -c "CREATE DATABASE mockdb;"
|
psql -U postgres -c "CREATE DATABASE mockdb;"
|
||||||
# Create mockdb superuser
|
# Create mockdb superuser
|
||||||
su postgres -c "/usr/lib/postgresql/13/bin/createuser mockdb -s"
|
su postgres -c "/usr/lib/postgresql/13/bin/createuser mockdb -s"
|
||||||
|
|
@ -358,7 +374,7 @@ seed_embedded_postgres(){
|
||||||
safe_init_postgres(){
|
safe_init_postgres(){
|
||||||
runEmbeddedPostgres=1
|
runEmbeddedPostgres=1
|
||||||
# fail safe to prevent entrypoint from exiting, and prevent postgres from starting
|
# fail safe to prevent entrypoint from exiting, and prevent postgres from starting
|
||||||
init_postgres || runEmbeddedPostgres=0
|
init_postgres || runEmbeddedPostgres=0
|
||||||
}
|
}
|
||||||
|
|
||||||
# Main Section
|
# Main Section
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user