2022-03-21 05:09:24 +01:00
|
|
|
#!/bin/bash
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
sudo apt update
|
2022-03-21 05:54:17 +01:00
|
|
|
sudo apt install -y git python3-pip python3-virtualenv python3-venv nginx ffmpeg redis supervisor
|
2022-03-21 05:09:24 +01:00
|
|
|
|
|
|
|
if [[ -r /etc/os-release ]]; then
|
|
|
|
. /etc/os-release
|
|
|
|
if [[ $ID = ubuntu ]]; then
|
2022-10-21 04:09:32 +02:00
|
|
|
# MongoDB supports only LTS and has not released package for Ubuntu 22.04 LTS yet
|
|
|
|
case $VERSION_CODENAME in
|
|
|
|
impish|kinetic|jammy)
|
|
|
|
VERSION_CODENAME=focal ;;
|
|
|
|
esac
|
2022-03-21 05:09:24 +01:00
|
|
|
REPO="https://repo.mongodb.org/apt/ubuntu $VERSION_CODENAME/mongodb-org/5.0 multiverse"
|
|
|
|
elif [[ $ID = debian ]]; then
|
2022-10-21 04:09:32 +02:00
|
|
|
# MongoDB does not provide packages for Debian 11 yet
|
|
|
|
case $VERSION_CODENAME in
|
|
|
|
bullseye|bookworm|sid)
|
|
|
|
VERSION_CODENAME=buster ;;
|
|
|
|
esac
|
2022-03-21 05:09:24 +01:00
|
|
|
REPO="https://repo.mongodb.org/apt/debian $VERSION_CODENAME/mongodb-org/5.0 main"
|
|
|
|
else
|
|
|
|
echo "Unsupported distribution $ID"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "Not running a distribution with /etc/os-release available"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-10-20 07:19:43 +02:00
|
|
|
wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo tee /etc/apt/trusted.gpg.d/mongodb-server-5.0.asc
|
2022-03-21 05:09:24 +01:00
|
|
|
echo "deb [ arch=amd64,arm64 ] $REPO" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list
|
|
|
|
|
|
|
|
sudo apt update
|
|
|
|
sudo apt install -y mongodb-org
|
|
|
|
|
|
|
|
sudo mkdir -p /srv/taiko-web
|
|
|
|
sudo chown $USER /srv/taiko-web
|
|
|
|
git clone https://github.com/bui/taiko-web.git /srv/taiko-web
|
|
|
|
|
|
|
|
cd /srv/taiko-web
|
|
|
|
tools/get_version.sh
|
|
|
|
cp tools/hooks/* .git/hooks/
|
|
|
|
cp config.example.py config.py
|
|
|
|
sudo cp tools/nginx.conf /etc/nginx/conf.d/taiko-web.conf
|
|
|
|
|
|
|
|
sudo sed -i 's/^\(\s\{0,\}\)\(include \/etc\/nginx\/sites-enabled\/\*;\)$/\1#\2/g' /etc/nginx/nginx.conf
|
|
|
|
sudo sed -i 's/}/ application\/wasm wasm;\n}/g' /etc/nginx/mime.types
|
2022-09-20 15:47:32 +02:00
|
|
|
sudo service nginx restart
|
2022-03-21 05:09:24 +01:00
|
|
|
|
2022-03-21 05:54:17 +01:00
|
|
|
python3 -m venv .venv
|
|
|
|
.venv/bin/pip install --upgrade pip wheel setuptools
|
2022-03-21 05:09:24 +01:00
|
|
|
.venv/bin/pip install -r requirements.txt
|
|
|
|
|
|
|
|
sudo mkdir -p /var/log/taiko-web
|
|
|
|
sudo cp tools/supervisor.conf /etc/supervisor/conf.d/taiko-web.conf
|
|
|
|
sudo service supervisor restart
|
|
|
|
|
|
|
|
sudo systemctl enable mongod.service
|
|
|
|
sudo service mongod start
|
|
|
|
|
2022-03-21 05:41:04 +01:00
|
|
|
IP=$(dig +short txt ch whoami.cloudflare @1.0.0.1 | tr -d '"')
|
2022-03-21 05:09:24 +01:00
|
|
|
echo
|
|
|
|
echo "Setup complete! You should be able to access your taiko-web instance at http://$IP"
|
|
|
|
echo
|