2023-03-08 23:23:45 +08:00
|
|
|
#!/bin/bash
|
|
|
|
if [ "$EUID" -ne 0 ]; then
|
|
|
|
echo "Please run this script as root ( or with sudo )" ;
|
|
|
|
exit 1;
|
|
|
|
fi;
|
|
|
|
|
|
|
|
cd "$(dirname "$0")"
|
|
|
|
|
|
|
|
|
|
|
|
# Install Postgresql
|
2023-03-11 23:11:50 +08:00
|
|
|
apt update
|
|
|
|
apt install postgresql postgresql-contrib -y
|
2023-05-02 21:00:51 +08:00
|
|
|
sudo -u postgres psql -c "alter user postgres password 'bbb_graphql'"
|
2023-09-27 01:24:36 +08:00
|
|
|
sudo -u postgres psql -c "drop database if exists bbb_graphql with (force)"
|
2023-09-14 20:31:49 +08:00
|
|
|
sudo -u postgres psql -c "create database bbb_graphql WITH TEMPLATE template0 LC_COLLATE 'C.UTF-8'"
|
2023-08-08 20:18:57 +08:00
|
|
|
sudo -u postgres psql -c "alter database bbb_graphql set timezone to 'UTC'"
|
2023-05-02 21:00:51 +08:00
|
|
|
sudo -u postgres psql -U postgres -d bbb_graphql -a -f bbb_schema.sql --set ON_ERROR_STOP=on
|
2023-09-27 01:24:36 +08:00
|
|
|
sudo -u postgres psql -c "drop database if exists hasura_app with (force)"
|
2023-03-08 23:23:45 +08:00
|
|
|
sudo -u postgres psql -c "create database hasura_app"
|
|
|
|
|
|
|
|
echo "Postgresql installed!"
|
|
|
|
|
|
|
|
|
2023-03-11 23:11:50 +08:00
|
|
|
#Build Hasura
|
2023-03-14 02:45:33 +08:00
|
|
|
# https://github.com/hasura/graphql-engine/blob/master/server/CONTRIBUTING.md
|
2023-03-11 23:11:50 +08:00
|
|
|
# sudo apt install haskell-platform -y
|
|
|
|
# sudo apt-get install cabal-install -y
|
|
|
|
#wget https://golang.org/dl/go1.16.3.linux-amd64.tar.gz
|
|
|
|
#sudo sh -c "rm -rf /usr/local/go && tar -C /usr/local -xzf go1.16.3.linux-amd64.tar.gz"
|
|
|
|
#export PATH=$PATH:/usr/local/go/bin
|
|
|
|
#go version
|
|
|
|
|
2023-03-14 02:45:33 +08:00
|
|
|
# Configs nginx
|
2023-03-11 23:11:50 +08:00
|
|
|
cp ./graphql.nginx /usr/share/bigbluebutton/nginx
|
|
|
|
systemctl restart nginx
|
2023-03-08 23:23:45 +08:00
|
|
|
|
2023-03-14 02:45:33 +08:00
|
|
|
# Install Hasura graphql as service
|
2023-04-12 22:07:54 +08:00
|
|
|
#wget https://graphql-engine-cdn.hasura.io/server/latest/linux-amd64 -O /usr/local/bin/hasura-graphql-engine
|
|
|
|
#chmod +x /usr/local/bin/hasura-graphql-engine
|
|
|
|
|
2023-07-19 02:03:37 +08:00
|
|
|
#Hasura 2.29+ requires Ubuntu 22
|
2023-12-13 21:31:33 +08:00
|
|
|
git clone --branch v2.36.0 https://github.com/iMDT/hasura-graphql-engine.git
|
2023-04-12 22:07:54 +08:00
|
|
|
cat hasura-graphql-engine/hasura-graphql.part-a* > hasura-graphql
|
|
|
|
rm -rf hasura-graphql-engine/
|
|
|
|
chmod +x hasura-graphql
|
|
|
|
mv hasura-graphql /usr/local/bin/hasura-graphql-engine
|
|
|
|
|
2023-07-19 20:57:51 +08:00
|
|
|
apt-get install -y gnupg2 curl apt-transport-https ca-certificates libkrb5-3 libpq5 libnuma1 unixodbc-dev
|
2023-03-08 23:23:45 +08:00
|
|
|
cp ./hasura-config.env /etc/default/bbb-graphql-server
|
2023-05-02 21:00:51 +08:00
|
|
|
#Enable Console --Desenv only!!
|
|
|
|
sudo sed -i 's/HASURA_GRAPHQL_ENABLE_CONSOLE=false/HASURA_GRAPHQL_ENABLE_CONSOLE=true/' /etc/default/bbb-graphql-server
|
|
|
|
|
2023-03-08 23:23:45 +08:00
|
|
|
cp ./bbb-graphql-server.service /lib/systemd/system/bbb-graphql-server.service
|
2023-03-11 23:11:50 +08:00
|
|
|
systemctl enable bbb-graphql-server
|
|
|
|
systemctl start bbb-graphql-server
|
2023-03-08 23:23:45 +08:00
|
|
|
|
|
|
|
# Install Hasura CLI
|
|
|
|
curl -L https://github.com/hasura/graphql-engine/raw/stable/cli/get.sh | bash
|
|
|
|
|
|
|
|
# Apply BBB metadata in Hasura
|
2023-09-27 01:24:36 +08:00
|
|
|
hasura metadata apply --skip-update-check
|
2023-03-08 23:23:45 +08:00
|
|
|
|
|
|
|
echo ""
|
|
|
|
echo ""
|
|
|
|
echo "Bbb-graphql-server Installed!"
|
2023-03-21 21:36:11 +08:00
|
|
|
echo "http://$(hostname -f):8080/console"
|