oneuptime/install.sh

84 lines
3.4 KiB
Bash
Raw Normal View History

2022-11-08 15:24:58 +00:00
#!/usr/bin/env bash
2020-02-13 21:48:38 +00:00
2023-04-18 13:20:14 +00:00
# If its not environment IS_DOCKER then exit
if[[ $IS_DOCKER == "true" ]]; then
echo "This script should run in the docker container."
else
# Pull latest changes
git pull
fi
2023-04-05 09:48:35 +00:00
2022-11-08 15:24:58 +00:00
set -e
2019-08-02 12:56:16 +00:00
2022-11-08 15:24:58 +00:00
bash preinstall.sh
2023-03-17 13:08:26 +00:00
# Load env values from config.env
export $(grep -v '^#' config.env | xargs)
2022-12-31 08:39:55 +00:00
sudo docker compose pull
2022-11-10 11:39:06 +00:00
2022-12-29 13:45:35 +00:00
# Create database if it does not exists
2023-03-17 13:08:26 +00:00
sudo docker compose up -d postgres && sleep 30 && sudo docker compose exec postgres psql postgresql://$DATABASE_USERNAME:$DATABASE_PASSWORD@localhost:5432/postgres -c 'CREATE DATABASE oneuptimedb' || echo "Database already created"
2022-12-29 13:45:35 +00:00
2023-01-03 15:19:06 +00:00
# Start all containers.
2022-11-08 19:10:14 +00:00
npm run start
2022-11-08 15:24:58 +00:00
echo "We will need to wait ~5-10 minutes for things to settle down, migrations to finish, and TLS certs to be issued"
echo ""
echo "⏳ Waiting for OneUptime to boot (this will take a few minutes)"
2023-03-08 11:20:40 +00:00
echo "Checking API Status..."
2022-11-08 15:24:58 +00:00
bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/api/status)" != "200" ]]; do sleep 5; done'
2023-03-08 11:20:40 +00:00
echo "API is up ✔️"
echo "Checking Dashboard Status..."
2022-11-08 15:24:58 +00:00
bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/dashboard/status)" != "200" ]]; do sleep 5; done'
2023-03-08 11:20:40 +00:00
echo "Dashboard is up ✔️"
echo "Checking File Server Status..."
2022-12-29 17:14:29 +00:00
bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/file/status)" != "200" ]]; do sleep 5; done'
2023-03-08 11:20:40 +00:00
echo "File server is up ✔️"
echo "Checking Status Page Server Status..."
2022-12-31 15:26:20 +00:00
bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/status-page/status)" != "200" ]]; do sleep 5; done'
2023-03-08 11:20:40 +00:00
echo "Status Page Server is up ✔️"
echo "Checking Home Server Status..."
2022-12-29 17:14:29 +00:00
bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/status)" != "200" ]]; do sleep 5; done'
2023-03-08 11:20:40 +00:00
echo "Home Server is up ✔️"
echo "Checking Accounts Server Status..."
2022-12-29 17:14:29 +00:00
bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/accounts/status)" != "200" ]]; do sleep 5; done'
2023-03-08 11:20:40 +00:00
echo "Accounts Server is up ✔️"
echo "Checking Mail Server Status..."
2022-12-29 17:14:29 +00:00
bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/mail/status)" != "200" ]]; do sleep 5; done'
2023-03-08 11:20:40 +00:00
echo "Mail Server is up ✔️"
echo "Checking Worker Server Status..."
2022-12-29 17:14:29 +00:00
bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/workers/status)" != "200" ]]; do sleep 5; done'
2023-03-08 11:20:40 +00:00
echo "Worker Server is up ✔️"
echo "Checking Identity Server Status..."
2022-12-29 17:14:29 +00:00
bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/identity/status)" != "200" ]]; do sleep 5; done'
2023-03-08 11:20:40 +00:00
echo "Identity Server is up ✔️"
echo "Checking Workflow Server Status..."
bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/workflow/status)" != "200" ]]; do sleep 5; done'
echo "Workflow Server is up ✔️"
echo "Checking API Docs Server Status..."
2023-04-05 10:08:25 +00:00
bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost/reference/status)" != "200" ]]; do sleep 5; done'
2023-03-08 11:20:40 +00:00
echo "API Docs Server is up ✔️"
2022-11-08 15:24:58 +00:00
echo "⌛️ OneUptime is up!"
echo ""
echo "🎉🎉🎉 Done! 🎉🎉🎉"
echo "We would like to hear your feedback to make this product better for you and for other users, please email us at hello@oneuptime.com."
echo " - If you notice a bug, we will fix it for you."
echo " - If you need a feature, we will add that to the roadmap and let you know the estimated time to ship."
echo "We would love to hear your feedback. Email: hello@oneuptime.com"