0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-22 08:40:03 +01:00
posthog/bin/upgrade-hobby
Guido Iaquinti 3f3f146b3e
chore(hobby deployments): various fixes (#9914)
* chore(hobby deployments): various fixes

* default do not check versions for current hobby release

Co-authored-by: James Greenhill <fuziontech@gmail.com>
2022-05-23 11:15:57 -07:00

38 lines
910 B
Bash
Executable File

#!/usr/bin/env bash
set -e
echo "Upgrading PostHog. This will cause a few minutes of downtime."
read -r -p "Do you want to upgarde PostHog? [y/N] " response
if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]
then
echo "OK!"
else
exit
fi
[[ -f ".env" ]] && export $(cat .env | xargs) || ( echo "No .env file found. Please create it with POSTHOG_SECRET and DOMAIN set." && exit 1)
export POSTHOG_APP_TAG="${POSTHOG_APP_TAG:-latest-release}"
cd posthog
git pull
cd ../
rm -f docker-compose.yml
cp posthog/docker-compose.hobby.yml docker-compose.yml.tmpl
envsubst < docker-compose.yml.tmpl > docker-compose.yml
rm docker-compose.yml.tmpl
docker-compose pull
echo "Checking if async migrations are up to date"
sudo -E docker-compose run asyncmigrationscheck
echo "Stopping the stack!"
docker-compose stop
echo "Restarting the stack!"
sudo -E docker-compose up -d
echo "PostHog upgraded successfully!"