From 755e5b105be5262134c8a09e555101c9a4d95c93 Mon Sep 17 00:00:00 2001 From: gmarton Date: Tue, 21 Jan 2020 12:27:37 -0500 Subject: [PATCH 1/7] Support both Ubuntu-18.04 and 16.04 --- scripts/setup-buildessential.sh | 17 ++++++++++++++++- scripts/setup-os-release.sh | 11 +++++++++++ scripts/setup-postgresql.sh | 6 +++++- scripts/setup-python.sh | 11 +++++++++-- setup-devel.sh | 4 +++- 5 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 scripts/setup-os-release.sh diff --git a/scripts/setup-buildessential.sh b/scripts/setup-buildessential.sh index dc1a9d1..7b24a47 100644 --- a/scripts/setup-buildessential.sh +++ b/scripts/setup-buildessential.sh @@ -1,8 +1,23 @@ if [ ! -e ~/.setup/buildessential ]; then touch ~/.setup/buildessential - apt-install-if-needed build-essential binutils-doc autoconf flex bison libjpeg-dev libfreetype6-dev zlib1g-dev libzmq3-dev libgdbm-dev libncurses5-dev automake libtool libffi-dev curl gettext cairo + if [ "$VERSION_ID" = "18.04" ]; then + apt-install-if-needed automake wget curl gettext circus \ + build-essential libgdbm-dev binutils-doc autoconf flex gunicorn \ + bison libjpeg-dev libzmq3-dev libfreetype6-dev zlib1g-dev \ + libncurses5-dev libtool libxslt1-dev libxml2-dev libffi-dev \ + libssl-dev circus + + # Utils + apt-install-if-needed git pwgen tmux + + elif [ "$VERSION_ID" = "16.04" ]; then + apt-install-if-needed build-essential binutils-doc autoconf \ + flex bison libjpeg-dev libfreetype6-dev zlib1g-dev libzmq3-dev \ + libgdbm-dev libncurses5-dev automake libtool libffi-dev curl \ + gettext cairo # Utils apt-install-if-needed git tmux + fi fi diff --git a/scripts/setup-os-release.sh b/scripts/setup-os-release.sh new file mode 100644 index 0000000..5fbd097 --- /dev/null +++ b/scripts/setup-os-release.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +source /etc/os-release +if [ "$VERSION_ID" != "18.04" ] && [ "$VERSION_ID" != "16.04" ]; then + echo "This script is not compatible with your current OS: $PRETTY_NAME" + echo "Please try to install on Ubuntu-18.04 LTS or Ubuntu-16.04 LTS" + exit 1 +else + echo "Installing taigaio on $PRETTY_NAME" +fi +sleep 3 diff --git a/scripts/setup-postgresql.sh b/scripts/setup-postgresql.sh index f431f4f..021592b 100644 --- a/scripts/setup-postgresql.sh +++ b/scripts/setup-postgresql.sh @@ -13,12 +13,16 @@ function dropdb-if-needed { } if [ ! -e ~/.setup/postgresql ]; then + if [ "$VERSION_ID" = "18.04" ]; then + apt-install-if-needed postgresql-10 postgresql-contrib \ + postgresql-doc-10 postgresql-server-dev-10 + elif [ "$VERSION_ID" = "16.04" ]; then apt-install-if-needed postgresql-9.5 postgresql-contrib-9.5 \ postgresql-doc-9.5 postgresql-server-dev-9.5 + fi sudo -u postgres createuser --superuser $USER &> /dev/null sudo -u postgres createdb $USER &> /dev/null touch ~/.setup/postgresql fi - diff --git a/scripts/setup-python.sh b/scripts/setup-python.sh index 314cf3a..8e6238d 100644 --- a/scripts/setup-python.sh +++ b/scripts/setup-python.sh @@ -1,10 +1,17 @@ #!/bin/bash -apt-install-if-needed python3 python3-pip python-dev python3-dev python-pip virtualenvwrapper libxml2-dev libxslt1-dev +if [ "$VERSION_ID" = "18.04" ]; then + # Define python version for virtualenv + PYTHON_VERSION="python3.6" + apt-install-if-needed python3 python3-pip python3-dev python3-pip virtualenvwrapper +elif [ "$VERSION_ID" = "16.04" ]; then + PYTHON_VERSION="python3.5" + apt-install-if-needed python3 python3-pip python-dev python3-dev python-pip virtualenvwrapper libxml2-dev libxslt1-dev +fi source /usr/share/virtualenvwrapper/virtualenvwrapper_lazy.sh function mkvirtualenv-if-needed { for envname in $@; do - $(lsvirtualenv | grep -q "$envname") || mkvirtualenv "$envname" -p /usr/bin/python3.5 + $(lsvirtualenv | grep -q "$envname") || mkvirtualenv "$envname" -p /usr/bin/$PYTHON_VERSION done } diff --git a/setup-devel.sh b/setup-devel.sh index f79ab22..01bb35b 100755 --- a/setup-devel.sh +++ b/setup-devel.sh @@ -6,6 +6,9 @@ mkdir -p logs mkdir -p conf popd +# System information and verification +source ./scripts/setup-os-release.sh + # Bootstrap # source ./scripts/setup-vars.sh source ./scripts/setup-config.sh @@ -23,4 +26,3 @@ source ./scripts/setup-python.sh # Setup Taiga source ./scripts/setup-frontend.sh source ./scripts/setup-backend.sh - From 226d7081efdbc958419d3ba16527653fe4ba618d Mon Sep 17 00:00:00 2001 From: gmarton Date: Tue, 21 Jan 2020 13:04:37 -0500 Subject: [PATCH 2/7] Avoid install/upgrade prompts --- scripts/setup-apt.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/setup-apt.sh b/scripts/setup-apt.sh index 346e466..f76a515 100644 --- a/scripts/setup-apt.sh +++ b/scripts/setup-apt.sh @@ -1,7 +1,7 @@ function apt-install { for pkg in $@; do echo -e "[APT-GET] Installing package $pkg..." - sudo apt-get install -yq $pkg + sudo DEBIAN_FRONTEND=noninteractive apt-get install -yq -o DPkg::options::="--force-confdef" -o DPkg::options::="--force-confold" $pkg done } @@ -20,5 +20,5 @@ function package-not-installed { } sudo apt-get -y update -sudo apt-get -y upgrade -sudo apt-get -y dist-upgrade +sudo DEBIAN_FRONTEND=noninteractive apt-get -y -o DPkg::options::="--force-confdef" -o DPkg::options::="--force-confold" upgrade +sudo DEBIAN_FRONTEND=noninteractive apt-get -y -o DPkg::options::="--force-confdef" -o DPkg::options::="--force-confold" dist-upgrade From a28c30ea93f19a8c1b6e96820a182f00c617fbf1 Mon Sep 17 00:00:00 2001 From: gmarton Date: Wed, 22 Jan 2020 14:27:07 -0500 Subject: [PATCH 3/7] Setup vars --- scripts/setup-backend.sh | 16 ++++++++------ scripts/setup-post-install.sh | 7 +++++++ scripts/setup-vars.sh | 39 +++++++++++++++++++++++++---------- setup-devel.sh | 2 +- setup-server.sh | 3 +++ 5 files changed, 49 insertions(+), 18 deletions(-) create mode 100644 scripts/setup-post-install.sh diff --git a/scripts/setup-backend.sh b/scripts/setup-backend.sh index 14a5957..de31937 100644 --- a/scripts/setup-backend.sh +++ b/scripts/setup-backend.sh @@ -7,15 +7,15 @@ pushd ~ cat > /tmp/settings.py < Date: Wed, 22 Jan 2020 19:24:15 -0500 Subject: [PATCH 4/7] Setup hostname --- scripts/setup-hostname.sh | 17 +++++++++++++++++ setup-devel.sh | 1 + 2 files changed, 18 insertions(+) create mode 100644 scripts/setup-hostname.sh diff --git a/scripts/setup-hostname.sh b/scripts/setup-hostname.sh new file mode 100644 index 0000000..2469d17 --- /dev/null +++ b/scripts/setup-hostname.sh @@ -0,0 +1,17 @@ +# setup-hostname.sh +# set up hostname and domain name in hosts file + +if [ ! -e ~/.setup/hostname ]; then + + touch ~/.setup/hostname + + if [ "$TAIGA_HOSTNAME" != "localhost" ] && [ "$TAIGA_HOSTNAME" != $(hostname) ]; then + sudo hostnamectl set-hostname $TAIGA_HOSTNAME + echo "127.0.0.1 $TAIGA_HOSTNAME" | sudo tee -a /etc/hosts + fi + + if [ "$TAIGA_DOMAIN" != "$IP_ADDRESS" ] ; then + echo "$IP_ADDRESS $TAIGA_DOMAIN" | sudo tee -a /etc/hosts + fi + +fi diff --git a/setup-devel.sh b/setup-devel.sh index c6113f1..d6f259f 100755 --- a/setup-devel.sh +++ b/setup-devel.sh @@ -11,6 +11,7 @@ source ./scripts/setup-os-release.sh # Bootstrap source ./scripts/setup-vars.sh +source ./scripts/setup-hostname.sh source ./scripts/setup-config.sh source ./scripts/setup-apt.sh From 702e9b5d01432cf599877f04caa431249404ea6a Mon Sep 17 00:00:00 2001 From: gmarton Date: Thu, 23 Jan 2020 08:51:02 -0500 Subject: [PATCH 5/7] Optinally enable https (letsencrypt.org) --- scripts/setup-certbot.sh | 17 +++++++++++++++++ scripts/setup-vars.sh | 22 +++++++++++++++++++--- setup-server.sh | 1 + 3 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 scripts/setup-certbot.sh diff --git a/scripts/setup-certbot.sh b/scripts/setup-certbot.sh new file mode 100644 index 0000000..66e469a --- /dev/null +++ b/scripts/setup-certbot.sh @@ -0,0 +1,17 @@ +# setup-certbot.sh +# install certbot and configure nginx + +if [ ! -e ~/.setup/certbot ]; then + + touch ~/.setup/certbot + + if [ "$TAIGA_ENCRYPT" == "True" ]; then + sudo apt-get install software-properties-common -y + sudo add-apt-repository universe + sudo add-apt-repository ppa:certbot/certbot -y + sudo apt-get update + sudo apt-get install certbot python-certbot-nginx -y + sudo certbot --non-interactive --nginx -d $TAIGA_DOMAIN --agree-tos --email $TAIGA_SSL_EMAIL + fi + +fi diff --git a/scripts/setup-vars.sh b/scripts/setup-vars.sh index c25452b..2ace734 100644 --- a/scripts/setup-vars.sh +++ b/scripts/setup-vars.sh @@ -4,8 +4,6 @@ if [ -e ~/.setup/data.sh ]; then # For unattended install get variables from cloud installer source ~/.setup/data.sh else - # Until https is implemented - TAIGA_SCHEME="http" # Determine active network interface and active IP Address, if not connected, use hostname NET_INTERFACE=$(ip addr show | awk '/inet.*brd/{print $NF; exit}') @@ -21,6 +19,22 @@ else read -p "Fully qualified domain name or IP address (default: $IP_ADDRESS): " TAIGA_DOMAIN TAIGA_DOMAIN=${TAIGA_DOMAIN:-$IP_ADDRESS} + if [ "$TAIGA_DOMAIN" != "$IP_ADDRESS" ] ; then + read -p "Use encryption (from letsencrypt.org + certbot) for domain '$TAIGA_DOMAIN' - requires email next step (y/N):" TAIGA_ENCRYPT + case $TAIGA_ENCRYPT in + [Yy]* ) TAIGA_ENCRYPT="True";; + * ) TAIGA_ENCRYPT="False";; + esac + + if [ "$TAIGA_ENCRYPT" == "True" ] ; then + TAIGA_SCHEME="https" + while [[ $TAIGA_SSL_EMAIL == "" ]]; do + read -p "Email to use for certificate notifications (required, cartificate will fail if invalid): " TAIGA_SSL_EMAIL + done + fi + + fi + read -p "Import Sample Projects (Y/n):" TAIGA_SAMPLE_DATA case $TAIGA_SAMPLE_DATA in [Nn]* ) TAIGA_SAMPLE_DATA="False";; @@ -32,7 +46,9 @@ else [Nn]* ) TAIGA_PUBLIC_REGISTER_ENABLED="False";; * ) TAIGA_PUBLIC_REGISTER_ENABLED="True";; esac - + + TAIGA_SCHEME=${TAIGA_SCHEME:-"http"} + fi sleep 2 diff --git a/setup-server.sh b/setup-server.sh index dc4dadc..214da2e 100755 --- a/setup-server.sh +++ b/setup-server.sh @@ -10,6 +10,7 @@ source ./setup-devel.sh # Post Setup Services source ./scripts/setup-circus.sh source ./scripts/setup-nginx.sh +source ./scripts/setup-certbot.sh # Display install info source ./scripts/setup-post-install.sh From babdb5867523f9ff134dda829fedc5835650d6e8 Mon Sep 17 00:00:00 2001 From: gmarton Date: Thu, 23 Jan 2020 11:34:01 -0500 Subject: [PATCH 6/7] Post install messages --- scripts/setup-post-install.sh | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/scripts/setup-post-install.sh b/scripts/setup-post-install.sh index 7d2a7bd..4a3f728 100644 --- a/scripts/setup-post-install.sh +++ b/scripts/setup-post-install.sh @@ -1,7 +1,18 @@ -echo "---------------------------------------------------" -echo "Installed taiga.io:" -echo "URL: $TAIGA_SCHEME://$TAIGA_DOMAIN" -echo "Hostname: $TAIGA_HOSTNAME" -echo "Import Sample Projects: $TAIGA_SAMPLE_DATA" -echo "Public Registation Enabled: $TAIGA_PUBLIC_REGISTER_ENABLED" -echo "---------------------------------------------------" +if [ ! -e ~/.setup/data.sh ]; then + + echo "---------------------------------------------------" + echo "Installed taiga.io:" + echo "" + echo "Hostname: $TAIGA_HOSTNAME" + echo "Import Sample Projects: $TAIGA_SAMPLE_DATA" + echo "Public Registation Enabled: $TAIGA_PUBLIC_REGISTER_ENABLED" + echo "" + echo "URL: $TAIGA_SCHEME://$TAIGA_DOMAIN" + echo "Username: admin" + echo "Password: 123123" + echo "(Please log in and change password)" + echo "" + echo "For more information please visit: http://taigaio.github.io/taiga-doc/dist/ " + echo "---------------------------------------------------" + +fi From 2820a44262d561cf6ffc9bda85fedc00aaa1ae5d Mon Sep 17 00:00:00 2001 From: gmarton Date: Mon, 11 May 2020 20:29:24 -0400 Subject: [PATCH 7/7] Sample data import fix --- scripts/setup-backend.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/setup-backend.sh b/scripts/setup-backend.sh index de31937..4d0005d 100644 --- a/scripts/setup-backend.sh +++ b/scripts/setup-backend.sh @@ -53,7 +53,7 @@ if [ ! -e ~/taiga-back ]; then python manage.py loaddata initial_project_templates # Import sample projects unless explicitly set to "False" in setup-vars - if [ "$TAIGA_PUBLIC_REGISTER_ENABLED" != "False" ] ; then + if [ "$TAIGA_SAMPLE_DATA" != "False" ] ; then python manage.py sample_data python manage.py rebuild_timeline --purge fi