1
0
mirror of https://github.com/coltoneshaw/CS-Repro-Mattermost.git synced 2025-12-23 10:01:30 +01:00

Added make file and modified how it works

This commit is contained in:
coltoneshaw
2023-02-15 11:47:47 -05:00
parent fdfe8c1eaa
commit 1f51321fb3
12 changed files with 348 additions and 414 deletions

77
scripts/mattermost.sh Executable file
View File

@@ -0,0 +1,77 @@
#!/bin/bash
DIR="./volumes/mattermost"
setup() {
if ! waitForStart; then
make stop
else
echo
echo
echo
echo "Do you want to setup test data for Mattermost?"
echo "This will overwrite some config and add a sysadmin user and a regular user."
echo "If you are curious about the config changes check out the file ./files/mattermost/defaultConfig.json"
echo "If you don't want to do this, just press enter."
echo
read -p "Y / N " -n 1 -r
echo # (optional) move to a new line
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo ===========================================================
echo
echo "setting up test Data for Mattermost"
echo
echo ===========================================================
docker exec -it cs-repro-mattermost mmctl config patch /mattermost/config/defaultConfig.json --local
docker exec -it cs-repro-mattermost mmctl user create --password Testpassword123! --username sysadmin --email sysadmin@example.com --system-admin --local
docker exec -it cs-repro-mattermost mmctl user create --password Testpassword123! --username user-1 --email user-1@example.com --local
echoLogins
exit 0
fi
fi
echo
echo "Alright, everything seems to be setup and running. Enjoy."
}
total=0
max_wait_seconds=120
waitForStart() {
echo "waiting $max_wait_seconds seconds for the server to start"
while [[ "$total" -le "$max_wait_seconds" ]]; do
if docker exec -i cs-repro-mattermost mmctl system status --local 2>/dev/null; then
echo "server started"
return 0
else
((total = total + 1))
printf "."
sleep 1
fi
done
printf "\nserver didn't start in $max_wait_seconds seconds\n"
make stop
exit 1
}
echoLogins() {
echo
echo ========================================================================
echo
echo Logins:
echo
echo - System admin: username=sysadmin password=Testpassword123!
echo - Regular account: username=user-1 password=Testpassword123!
echo - LDAP or SAML account: username=professor password=professor
echo
echo ========================================================================
}
"$@"