-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathdo-install.sh
executable file
·52 lines (52 loc) · 2.42 KB
/
do-install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/bash
# install script for mdNOSH in a DigitalOcean Ubuntu Droplet
set -e
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root. Aborting." 1>&2
exit 1
fi
if [ -x "$(command -v docker)" ]; then
echo "Docker already installed"
else
apt install -y ca-certificates curl gnupg lsb-release
mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update
apt-get install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin
fi
read -e -p "Enter your Name: " -i "" NAME
read -e -p "Enter your Root Domain Name (domain.com): " -i "" ROOT_DOMAIN
read -e -p "Enter your E-Mail address for Let's Encrypt ([email protected]): " -i "" EMAIL
read -e -p "Enter your 4-digit encryption PIN: " -i "" COUCHDB_PIN
read -e -p "Enter your CouchDB/Traefik Password for admin user: " -i "" COUCHDB_PASSWORD
read -e -p "Enter your Magic API Key for NOSH: " -i "" MAGIC_API_KEY
read -e -p "Enter your USPSTF API Key for NOSH: " -i "" USPSTF_KEY
read -e -p "Enter your UMLS API Key for NOSH: " -i "" UMLS_KEY
mkdir nosh3
cd nosh3
curl -O https://raw.githubusercontent.com/shihjay2/nosh3/main/docker-compose.yml
curl -O https://raw.githubusercontent.com/shihjay2/nosh3/main/.env
sed -i "s/[email protected]/$EMAIL/" ./docker-compose.yml
sed -i "s/example.com/$ROOT_DOMAIN/" ./docker-compose.yml
sed -i "s/example.com/$ROOT_DOMAIN/" ./.env
sed -i '/^MAGIC_API_KEY=/s/=.*/='"$MAGIC_API_KEY"'/' ./.env
sed -i '/^USPSTF_KEY=/s/=.*/='"$USPSTF_KEY"'/' ./.env
sed -i '/^UMLS_KEY=/s/=.*/='"$UMLS_KEY"'/' ./.env
sed -i '/^COUCHDB_USER=/s/=.*/='"admin"'/' ./.env
sed -i '/^COUCHDB_PASSWORD=/s/=.*/='"$COUCHDB_PASSWORD"'/' ./.env
sed -i '/^COUCHDB_ENCRYPT_PIN=/s/=.*/='"$COUCHDB_PIN"'/' ./.env
sed -i '/^INSTANCE=/s/=.*/='"docker"'/' ./.env
sed -i '/^NOSH_ROLE=/s/=.*/='"provider"'/' ./.env
sed -i '/^NOSH_EMAIL=/s/=.*/='"$EMAIL"'/' ./.env
sed -i '/^NOSH_DISPLAY=/s/=.*/='"$NAME"'/' ./.env
mkdir dbconfig
cd dbconfig
curl -O https://raw.githubusercontent.com/shihjay2/nosh3/main/docker.ini
cd ..
# start docker
/usr/bin/docker compose up -d
echo "Initializing CouchDB and NOSH..."
sleep 5
echo "Installation complete. You can now open your browser to https://$ROOT_DOMAIN/start"
exit 0