openreplay/scripts/helm/kube-install.sh
Rajesh Rajendran 2e86b6eb6a
Bug fixes and features. (#7)
* fix: changed sessions bucket

* fix: text changes in login and signup forms

* change: version number

* change: config changes

* fix: alerts image name

* fix: alerts image name

* Update README.md

* chore(actions): pushing internalized to script.

Signed-off-by: Rajesh Rajendran <rjshrjndrn@gmail.com>

* feat(nginx): No redirection to HTTPS by default.

Signed-off-by: Rajesh Rajendran <rjshrjndrn@gmail.com>

* chore(deploy): optional nginx https redirect

Signed-off-by: Rajesh Rajendran <rjshrjndrn@gmail.com>

* fix: review fixes and other changes

* fix: events modal openreplay logo

* fix: stack event icon

* Changes:
- debugging
- smtp status
- session's issues
- session's issue_types as array
- changed Slack error message

* Changes:
- set chalice pull policy to always

* fix(openreplay-cli): path issues.

Signed-off-by: Rajesh Rajendran <rjshrjndrn@gmail.com>

* fix(openreplay-cli): fix path

Signed-off-by: Rajesh Rajendran <rjshrjndrn@gmail.com>

* change: onboarding explore text changes

* change: timeline issue pointers and static issue types

* change: removed issues_types api call

* connectors

* Update README.md

* Update README.md

* Update README.md

* Updating services

* Update README.md

* Updated alert-notification-string to chalice

* Delete issues.md

* Changes:
- fixed connexion pool exhausted using Semaphores
- fixed session-replay-url signing

* Changes:
- fixed connexion pool exhausted using Semaphores
- fixed session-replay-url signing

* Change pullPolicy to IfNotPresent

* Fixed typo

* Fixed typo

* Fixed typos

* Fixed typo

* Fixed typo

* Fixed typos

* Fixed typos

* Fixed typo

* Fixed typo

* Removed /ws

* Update README.md

* feat(nginx): increase minio upload size to 50M

Signed-off-by: Rajesh Rajendran <rjshrjndrn@gmail.com>

* fix(deploy): nginx custom changes are overriden in install

Signed-off-by: Rajesh Rajendran <rjshrjndrn@gmail.com>

* fix(nginx): deployment indentation issue

Signed-off-by: Rajesh Rajendran <rjshrjndrn@gmail.com>

* fix: revid filter crash

* fix: onboarding links

* fix: update password store new token

* fix: report issue icon jira/github

* fix: onboarding redirect on signup

* Changes:
- hardcoded S3_HOST

* Changes:
- changed "sourcemaps" env var to "sourcemaps_reader"
- set "sourcemaps_reader" env var value

* chore(script): remove logo

Signed-off-by: Rajesh Rajendran <rjshrjndrn@gmail.com>

* Making domain_name mandatory

Signed-off-by: Rajesh Rajendran <rjshrjndrn@gmail.com>

* Changes:
- un-ignore *.js

* feat(install): auto create jwt_secret for chalice.

* docs(script): Adding Banner

Signed-off-by: Rajesh Rajendran <rjshrjndrn@gmail.com>

* chore(script): Remove verbose logging

Signed-off-by: Rajesh Rajendran <rjshrjndrn@gmail.com>

* Change:
- use boto3-resource instead of boto3-client to check if file exists
- changed .gitignore to allow *.js files
- changed sourcemaps_reader env-var & env-var-value

* fix (baxkend-ender): skip inputs with no label (technical)

* Change:
- changed DB structure

* change: removed /flows api call

* fix: skipping errorOnFetch check

* Change:
- changed sourcemaps_reader-nodejs script

* Change:
- changed sourcemaps_reader-nodejs script

* fix (backend-postgres): correct autocomplete type-value

* fix: slack webhooks PUT call

* change: added external icon for integration doc links

* fix: updated the sourcemap upload doc link

* fix: link color of no sessions message

* fix (frontend-player): show original domContentLoaded text values, while adjusted on timeline

* fix (frontend-player): syntax

* Changes:
- changed requirements
- changed slack add integration
- added slack edit integration
- removed sourcemaps_reader extra payload

* Changes:
- fixed sentry-issue-reporter
- fixed telemetry reporter
- fixed DB schema

* fix(cli): fix logs flag

Signed-off-by: Rajesh Rajendran <rjshrjndrn@gmail.com>

* ci(deploy): Injecting domain_name

Signed-off-by: Rajesh Rajendran <rjshrjndrn@gmail.com>

* feat(nginx): Get real client ip

Signed-off-by: Rajesh Rajendran <rjshrjndrn@gmail.com>

* chore(nginx): restart on helm installation.

Signed-off-by: Rajesh Rajendran <rjshrjndrn@gmail.com>

* fix(deployment): respect image tags.

* Changes:
- changed sentry tags
- changed asayer_session_id to openReplaySessionToken
- EE full merge

* fix: close the issue modal after creating

* fix: show description in issue details modal

* fix: integrate slack button redirect, and doc link

* fix: code snippet conflict set back

* fix: slack share channel selection

* Changes:
- fixed DB structure

* Changes:
- return full integration body on add slack

* fix (integrations): ignore token expired + some logs

* feat (sourcemaps-uploader): v.3.0.2 filename fix + logging arg

* fix (tracker): 3.0.3 version: start before auth

* fix: funnel calendar position

* fix: fetch issue types

* fix: missing icon blocking the session to play

* change: sessions per browser widget bar height reduced

* fix: github colored circles

* Changes:
- changed session-assignment-jira response

* chore(nginx): pass x-forward-for

Signed-off-by: Rajesh Rajendran <rjshrjndrn@gmail.com>

* feat(chalice): included sourcemaps_reader

It's not advised to run multiple processes in a single docker container.
In Kubernetes we can run this as sidecar, but other platforms such as
Heroku, and vanilla docker doesn't support such feature. So till we
figure out better solution, this is the workaround.

* chore(install): Remove sqs

* feat(deployment): restart pods on installations.

Signed-off-by: Rajesh Rajendran <rjshrjndrn@gmail.com>

* Changes:
- changed DB-oauth-unique constraint

Co-authored-by: Shekar Siri <sshekarsiri@gmail.com>
Co-authored-by: Mehdi Osman <estradino@users.noreply.github.com>
Co-authored-by: KRAIEM Taha Yassine <tahayk2@gmail.com>
Co-authored-by: ourvakan <hi-psi@yandex.com>
Co-authored-by: ShiKhu <alex.kaminsky.11@gmail.com>
2021-05-21 22:53:36 +05:30

179 lines
5.6 KiB
Bash
Executable file

#!/bin/bash
set -o errtrace
# color schemes
# Ansi color code variables
red="\e[0;91m"
blue="\e[0;94m"
expand_bg="\e[K"
blue_bg="\e[0;104m${expand_bg}"
red_bg="\e[0;101m${expand_bg}"
green_bg="\e[0;102m${expand_bg}"
green="\e[0;92m"
white="\e[0;97m"
bold="\e[1m"
uline="\e[4m"
reset="\e[0m"
working_dir=$(pwd)
echo -e ${reset}
## installing kubectl
which kubectl &> /dev/null || {
echo "kubectl not installed. Installing it..."
sudo curl -SsL https://dl.k8s.io/release/v1.20.0/bin/linux/amd64/kubectl -o /usr/local/bin/kubectl ; sudo chmod +x /usr/local/bin/kubectl
}
## installing stern
which stern &> /dev/null || {
echo "stern not installed. installing..."
sudo curl -SsL https://github.com/derdanne/stern/releases/download/2.1.16/stern_linux_amd64 -o /usr/local/bin/stern ; sudo chmod +x /usr/local/bin/stern
}
## installing k9s
which k9s &> /dev/null || {
echo "k9s not installed. Installing it..."
sudo curl -SsL https://github.com/derailed/k9s/releases/download/v0.24.2/k9s_Linux_x86_64.tar.gz -o /tmp/k9s.tar.gz
cd /tmp
tar -xf k9s.tar.gz
sudo mv k9s /usr/local/bin/k9s
sudo chmod +x /usr/local/bin/k9s
cd -
}
which ansible &> /dev/null || {
echo "ansible not installed. Installing it..."
which pip || (sudo apt update && sudo apt install python3-pip -y)
sudo pip3 install ansible==2.10.0
}
which docker &> /dev/null || {
echo "docker is not installed. Installing it..."
user=`whoami`
sudo apt install docker.io -y
sudo usermod -aG docker $user
}
## installing helm
which helm &> /dev/null
if [[ $? -ne 0 ]]; then
echo "helm not installed. Installing it..."
curl -ssl https://get.helm.sh/helm-v3.4.2-linux-amd64.tar.gz -o /tmp/helm.tar.gz
tar -xf /tmp/helm.tar.gz
chmod +x linux-amd64/helm
sudo cp linux-amd64/helm /usr/local/bin/helm
rm -rf linux-amd64/helm /tmp/helm.tar.gz
fi
# ## checking kubernetes access
# kubectl cluster-info &> /dev/null
# if [[ $? -ne 0 ]]; then
# echo -e "${red}kubernetes cluster is not accessible.\nplease check ${bold}kubeconfig${reset}${red} env variable is set or ${bold}~/.kube/config exists.${reset}"
# exit 1
# fi
# make all stderr red
color()(set -o pipefail;"$@" 2>&1>&3|sed $'s,.*,\e[31m&\e[m,'>&2)3>&1
usage() {
echo -e ${bold}${yellow} '''
This script will install and configure OpenReplay apps and databases on the kubernetes cluster,
which is accesd with the ${HOME}/.kube/config or $KUBECONFIG env variable.
'''
cat <<"EOF"
___ ____ _
/ _ \ _ __ ___ _ __ | _ \ ___ _ __ | | __ _ _ _
| | | | '_ \ / _ \ '_ \| |_) / _ \ '_ \| |/ _` | | | |
| |_| | |_) | __/ | | | _ < __/ |_) | | (_| | |_| |
\___/| .__/ \___|_| |_|_| \_\___| .__/|_|\__,_|\__, |
|_| |_| |___/
EOF
echo -e "${green}Usage: openreplay-cli [ -h | --help ]
[ -v | --verbose ]
[ -a | --app APP_NAME ] to install/reinstall specific application
[ -t | --type small|medium|ideal ]"
echo -e "${reset}${blue}type defines the resource limits applied for the installation:
small: 2core 8G machine
medium: 4core 16G machine
ideal: 8core 32G machine
apps can specifically be installed/reinstalled:
alerts assets chalice ender http integrations ios-proxy pg redis sink storage frontend
${reset}"
echo type value: $installation_type
exit 0
}
# Defaults to minimum installation
installation_type=1
type() {
case "$1" in
small) installation_type=1 ;;
medium) installation_type=1.5 ;;
ideal) installation_type=2 ;;
*)
echo -e ${red}${bold}'ERROR!!!\nwrong value for `type`'${reset}
usage ;;
esac
}
function app(){
case $1 in
nginx)
# Resetting the redirection rule
sed -i 's/.* return 301 .*/ # return 301 https:\/\/$host$request_uri;/g' nginx-ingress/nginx-ingress/templates/configmap.yaml
[[ NGINX_REDIRECT_HTTPS -eq 1 ]] && {
sed -i "s/# return 301/return 301/g" nginx-ingress/nginx-ingress/templates/configmap.yaml
}
ansible-playbook -c local setup.yaml -e @vars.yaml -e scale=$installation_type --tags nginx -v
exit 0
;;
frontend)
ansible-playbook -c local setup.yaml -e @vars.yaml -e scale=$installation_type --tags frontend -v
exit 0
;;
*)
ansible-playbook -c local setup.yaml -e @vars.yaml -e scale=$installation_type -e app_name=$1 --tags app -v
exit 0
;;
esac
}
# Parsing command line args.
PARSED_ARGUMENTS=$(color getopt -a -n openreplay-cli -o vht:a: --long verbose,help,type:,app: -- "$@")
VALID_ARGUMENTS=$?
if [[ "$VALID_ARGUMENTS" != "0" ]]; then
usage
fi
eval set -- "$PARSED_ARGUMENTS"
while :
do
case "$1" in
-v | --verbose) VERBOSE=1 ; shift ;;
-h | --help) usage ; shift ;;
-t | --type) type $2 ; shift 2 ;;
-a | --app) app $2 ; shift 2 ;;
# -- means the end of the arguments; drop this, and break out of the while loop
--) shift; break ;;
# If invalid options were passed, then getopt should have reported an error,
# which we checked as VALID_ARGUMENTS when getopt was called...
*) echo "Unexpected option: $1 - this should not happen."
usage ;;
esac
done
[[ $VERBOSE -eq 1 ]] && set -x
{
ansible-playbook -c local setup.yaml -e @vars.yaml -e scale=$installation_type --tags pre-check -v
} || exit $?
{
ansible-playbook -c local setup.yaml -e @vars.yaml -e scale=$installation_type --skip-tags pre-check -v
} || exit $?