diff --git a/profiles/templates/taiga/postgresql/0-get_ver b/profiles/templates/taiga/postgresql/0-get_ver new file mode 100644 index 0000000..520431b --- /dev/null +++ b/profiles/templates/taiga/postgresql/0-get_ver @@ -0,0 +1,5 @@ +# Calculate run=/bin/bash + +ver=$(ls -d /var/db/pkg/dev-db/postgresql-*) +ver=${ver#*postgresql-} +echo ${ver%%.*} > /tmp/pgsqlver diff --git a/profiles/templates/taiga/postgresql/etc-12/.calculate_directory b/profiles/templates/taiga/postgresql/etc-12/.calculate_directory deleted file mode 100644 index 3b430ca..0000000 --- a/profiles/templates/taiga/postgresql/etc-12/.calculate_directory +++ /dev/null @@ -1 +0,0 @@ -# Calculate path=/etc name=postgresql-#-cut(1)-# diff --git a/profiles/templates/taiga/postgresql/etc/.calculate_directory b/profiles/templates/taiga/postgresql/etc/.calculate_directory new file mode 100644 index 0000000..f733fc4 --- /dev/null +++ b/profiles/templates/taiga/postgresql/etc/.calculate_directory @@ -0,0 +1 @@ +# Calculate path=/etc name=postgresql-#-load(char,/tmp/pgsqlver)-# diff --git a/profiles/templates/taiga/postgresql/etc-12/pg_hba.conf b/profiles/templates/taiga/postgresql/etc/pg_hba.conf similarity index 100% rename from profiles/templates/taiga/postgresql/etc-12/pg_hba.conf rename to profiles/templates/taiga/postgresql/etc/pg_hba.conf diff --git a/profiles/templates/taiga/postgresql/etc-12/pg_ident.conf b/profiles/templates/taiga/postgresql/etc/pg_ident.conf similarity index 100% rename from profiles/templates/taiga/postgresql/etc-12/pg_ident.conf rename to profiles/templates/taiga/postgresql/etc/pg_ident.conf diff --git a/profiles/templates/taiga/postgresql/etc-12/postgresql.conf b/profiles/templates/taiga/postgresql/etc/postgresql.conf similarity index 100% rename from profiles/templates/taiga/postgresql/etc-12/postgresql.conf rename to profiles/templates/taiga/postgresql/etc/postgresql.conf diff --git a/scripts/taiga/setup.sh b/scripts/taiga/setup.sh index df3db31..6ca46dc 100755 --- a/scripts/taiga/setup.sh +++ b/scripts/taiga/setup.sh @@ -1,22 +1,24 @@ #!/bin/bash -# Install Taiga in Production +# README: Install Taiga in Production # https://docs.taiga.io/setup-production.html#_introduction set -ueo pipefail export PATH="/lib/rc/bin:$PATH" +scriptpath=$(dirname $(readlink -f $0)) + . /var/db/repos/calculate/scripts/ini.sh echo "Taiga setup" chown taiga: /var/calculate/ini.env -su - taiga -c '/var/db/repos/container/scripts/taiga/install.sh' -/var/db/repos/container/scripts/taiga/postgresql.sh -/var/db/repos/container/scripts/taiga/rabbitmq.sh -/var/db/repos/container/scripts/taiga/config.sh -su - taiga -c '/var/db/repos/container/scripts/taiga/migrate.sh' + +for script in $scriptpath/step/*.sh; do + "$script" +done if [[ ! -e /etc/runlevels/default/taiga ]]; then cl-setup-system rc-update -u fi openrc + echo -e "\nAll is done! Open the link ${ini[taiga.protocol]}://${ini[taiga.taiga_sites_domain]} on your browser." diff --git a/scripts/taiga/install.sh b/scripts/taiga/step/1-install.sh similarity index 79% rename from scripts/taiga/install.sh rename to scripts/taiga/step/1-install.sh index 0ed37eb..288db9c 100755 --- a/scripts/taiga/install.sh +++ b/scripts/taiga/step/1-install.sh @@ -3,7 +3,8 @@ set -ueo pipefail export PATH="/lib/rc/bin:$PATH" -[[ $UID == 0 ]] && exit +SCRIPT=$(readlink -f $0) +[[ $UID == 0 ]] && exec su - taiga -c "$SCRIPT" . /var/db/repos/container/scripts/functions.sh . /var/db/repos/calculate/scripts/ini.sh @@ -22,7 +23,7 @@ set -u if [[ ! -e ~/taiga-back ]]; then cd ~ einfo 'Backend Setup: Get the code' - git clone https://github.com/kaleidos-ventures/taiga-back.git taiga-back + git clone --branch stable --depth 1 https://github.com/kaleidos-ventures/taiga-back.git taiga-back cd taiga-back git checkout stable @@ -45,7 +46,7 @@ fi if [[ ! -e ~/taiga-front-dist ]]; then cd ~ einfo 'Frontend Setup: Get the code' - git clone https://github.com/kaleidos-ventures/taiga-front-dist.git taiga-front-dist + git clone --branch stable --depth 1 https://github.com/kaleidos-ventures/taiga-front-dist.git taiga-front-dist cd taiga-front-dist git checkout stable @@ -57,7 +58,7 @@ fi if [[ ! -e ~/taiga-events ]]; then cd ~ einfo 'Events Setup: Get the code' - git clone https://github.com/kaleidos-ventures/taiga-events.git taiga-events + git clone --branch stable --depth 1 https://github.com/kaleidos-ventures/taiga-events.git taiga-events cd taiga-events git checkout stable @@ -74,7 +75,7 @@ fi if [[ ! -e ~/taiga-protected ]]; then cd ~ einfo 'Taiga protected Setup: Get the code' - git clone https://github.com/kaleidos-ventures/taiga-protected.git taiga-protected + git clone --branch stable --depth 1 https://github.com/kaleidos-ventures/taiga-protected.git taiga-protected cd taiga-protected git checkout stable diff --git a/scripts/taiga/postgresql.sh b/scripts/taiga/step/2-postgresql.sh similarity index 100% rename from scripts/taiga/postgresql.sh rename to scripts/taiga/step/2-postgresql.sh diff --git a/scripts/taiga/rabbitmq.sh b/scripts/taiga/step/3-rabbitmq.sh similarity index 100% rename from scripts/taiga/rabbitmq.sh rename to scripts/taiga/step/3-rabbitmq.sh diff --git a/scripts/taiga/config.sh b/scripts/taiga/step/4-config.sh similarity index 100% rename from scripts/taiga/config.sh rename to scripts/taiga/step/4-config.sh diff --git a/scripts/taiga/migrate.sh b/scripts/taiga/step/5-migrate.sh similarity index 92% rename from scripts/taiga/migrate.sh rename to scripts/taiga/step/5-migrate.sh index 34abb4d..e4f98d5 100755 --- a/scripts/taiga/migrate.sh +++ b/scripts/taiga/step/5-migrate.sh @@ -2,12 +2,12 @@ set -ueo pipefail export PATH="/lib/rc/bin:$PATH" +SCRIPT=$(readlink -f $0) +[[ $UID == 0 ]] && exec su - taiga -c "$SCRIPT" . /var/db/repos/container/scripts/functions.sh . /var/db/repos/calculate/scripts/ini.sh -[[ $UID == 0 ]] && exit - data=$(PGPASSWORD=${ini[postgresql.taiga_password]} psql -U ${ini[postgresql.taiga_user]} -d ${ini[postgresql.taiga_database]} -c '\dt' 2>/dev/null) if [[ -z $data ]]; then