diff --git a/Environment/gitbucket/DatabaseBackup.sh b/Environment/gitbucket/DatabaseBackup.sh new file mode 100755 index 0000000..dcef5e2 --- /dev/null +++ b/Environment/gitbucket/DatabaseBackup.sh @@ -0,0 +1,13 @@ +#!/bin/bash + + +DATE=`date +%d-%m-%G` + + +mysqldump --no-tablespaces --single-transaction -hlocalhost -ugitbucket -pgitbucketdbpassword gitbucket > gitbucket-export-${DATE}.sql + + +rm gitbucket-export-latest.sql +ln -s gitbucket-export-${DATE}.sql gitbucket-export-latest.sql + + diff --git a/Environment/gitbucket/DatabaseBackup.sh b/Environment/gitbucket/DatabaseBackup.sh new file mode 100755 index 0000000..dcef5e2 --- /dev/null +++ b/Environment/gitbucket/DatabaseBackup.sh @@ -0,0 +1,13 @@ +#!/bin/bash + + +DATE=`date +%d-%m-%G` + + +mysqldump --no-tablespaces --single-transaction -hlocalhost -ugitbucket -pgitbucketdbpassword gitbucket > gitbucket-export-${DATE}.sql + + +rm gitbucket-export-latest.sql +ln -s gitbucket-export-${DATE}.sql gitbucket-export-latest.sql + + diff --git a/Environment/gitbucket/DatabaseRestore.sh b/Environment/gitbucket/DatabaseRestore.sh new file mode 100755 index 0000000..4844915 --- /dev/null +++ b/Environment/gitbucket/DatabaseRestore.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +mysql -ugitbucket -pgitbucketdbpassword << EOF +drop database gitbucket; +create database gitbucket; +quit +EOF + +mysql -ugitbucket -pgitbucketdbpassword gitbucket < gitbucket-export-latest.sql + + diff --git a/Environment/gitbucket/DatabaseBackup.sh b/Environment/gitbucket/DatabaseBackup.sh new file mode 100755 index 0000000..dcef5e2 --- /dev/null +++ b/Environment/gitbucket/DatabaseBackup.sh @@ -0,0 +1,13 @@ +#!/bin/bash + + +DATE=`date +%d-%m-%G` + + +mysqldump --no-tablespaces --single-transaction -hlocalhost -ugitbucket -pgitbucketdbpassword gitbucket > gitbucket-export-${DATE}.sql + + +rm gitbucket-export-latest.sql +ln -s gitbucket-export-${DATE}.sql gitbucket-export-latest.sql + + diff --git a/Environment/gitbucket/DatabaseRestore.sh b/Environment/gitbucket/DatabaseRestore.sh new file mode 100755 index 0000000..4844915 --- /dev/null +++ b/Environment/gitbucket/DatabaseRestore.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +mysql -ugitbucket -pgitbucketdbpassword << EOF +drop database gitbucket; +create database gitbucket; +quit +EOF + +mysql -ugitbucket -pgitbucketdbpassword gitbucket < gitbucket-export-latest.sql + + diff --git a/Environment/gitbucket/DatabaseSetup.sh b/Environment/gitbucket/DatabaseSetup.sh new file mode 100755 index 0000000..b5110e7 --- /dev/null +++ b/Environment/gitbucket/DatabaseSetup.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +mysql -uroot -p -hlocalhost << EOF +create database gitbucket; +grant all privileges on \`gitbucket\`.* to gitbucket@localhost identified by 'gitbucketdbpassword'; +flush privileges; +quit +EOF + + + diff --git a/Environment/gitbucket/DatabaseBackup.sh b/Environment/gitbucket/DatabaseBackup.sh new file mode 100755 index 0000000..dcef5e2 --- /dev/null +++ b/Environment/gitbucket/DatabaseBackup.sh @@ -0,0 +1,13 @@ +#!/bin/bash + + +DATE=`date +%d-%m-%G` + + +mysqldump --no-tablespaces --single-transaction -hlocalhost -ugitbucket -pgitbucketdbpassword gitbucket > gitbucket-export-${DATE}.sql + + +rm gitbucket-export-latest.sql +ln -s gitbucket-export-${DATE}.sql gitbucket-export-latest.sql + + diff --git a/Environment/gitbucket/DatabaseRestore.sh b/Environment/gitbucket/DatabaseRestore.sh new file mode 100755 index 0000000..4844915 --- /dev/null +++ b/Environment/gitbucket/DatabaseRestore.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +mysql -ugitbucket -pgitbucketdbpassword << EOF +drop database gitbucket; +create database gitbucket; +quit +EOF + +mysql -ugitbucket -pgitbucketdbpassword gitbucket < gitbucket-export-latest.sql + + diff --git a/Environment/gitbucket/DatabaseSetup.sh b/Environment/gitbucket/DatabaseSetup.sh new file mode 100755 index 0000000..b5110e7 --- /dev/null +++ b/Environment/gitbucket/DatabaseSetup.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +mysql -uroot -p -hlocalhost << EOF +create database gitbucket; +grant all privileges on \`gitbucket\`.* to gitbucket@localhost identified by 'gitbucketdbpassword'; +flush privileges; +quit +EOF + + + diff --git a/Environment/gitbucket/InstallGitBucket.sh b/Environment/gitbucket/InstallGitBucket.sh index a252aab..8333cd4 100755 --- a/Environment/gitbucket/InstallGitBucket.sh +++ b/Environment/gitbucket/InstallGitBucket.sh @@ -5,6 +5,9 @@ wget https://github.com/gitbucket/gitbucket/releases/download/4.32.0/gitbucket.war mkdir -p /media/Data/Repositories cp gitbucket.war /media/Data/Repositories/ + cp database.conf Database*.sh /media/Data/Repositories/ + echo chown jenkins:jenkins /media/Data/Repositories/* + sudo chown jenkins:jenkins /media/Data/Repositories/* fi openssl dgst -sha256 gitbucket.war @@ -39,4 +42,6 @@ sudo systemctl restart nginx echo -e "\n127.0.0.1 gitbucket.localdomain\n" | sudo tee -a /etc/hosts +echo "Added gitbucket to /etc/hosts, should also anyway be already in the bind9/dns/named settings" + diff --git a/Environment/gitbucket/DatabaseBackup.sh b/Environment/gitbucket/DatabaseBackup.sh new file mode 100755 index 0000000..dcef5e2 --- /dev/null +++ b/Environment/gitbucket/DatabaseBackup.sh @@ -0,0 +1,13 @@ +#!/bin/bash + + +DATE=`date +%d-%m-%G` + + +mysqldump --no-tablespaces --single-transaction -hlocalhost -ugitbucket -pgitbucketdbpassword gitbucket > gitbucket-export-${DATE}.sql + + +rm gitbucket-export-latest.sql +ln -s gitbucket-export-${DATE}.sql gitbucket-export-latest.sql + + diff --git a/Environment/gitbucket/DatabaseRestore.sh b/Environment/gitbucket/DatabaseRestore.sh new file mode 100755 index 0000000..4844915 --- /dev/null +++ b/Environment/gitbucket/DatabaseRestore.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +mysql -ugitbucket -pgitbucketdbpassword << EOF +drop database gitbucket; +create database gitbucket; +quit +EOF + +mysql -ugitbucket -pgitbucketdbpassword gitbucket < gitbucket-export-latest.sql + + diff --git a/Environment/gitbucket/DatabaseSetup.sh b/Environment/gitbucket/DatabaseSetup.sh new file mode 100755 index 0000000..b5110e7 --- /dev/null +++ b/Environment/gitbucket/DatabaseSetup.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +mysql -uroot -p -hlocalhost << EOF +create database gitbucket; +grant all privileges on \`gitbucket\`.* to gitbucket@localhost identified by 'gitbucketdbpassword'; +flush privileges; +quit +EOF + + + diff --git a/Environment/gitbucket/InstallGitBucket.sh b/Environment/gitbucket/InstallGitBucket.sh index a252aab..8333cd4 100755 --- a/Environment/gitbucket/InstallGitBucket.sh +++ b/Environment/gitbucket/InstallGitBucket.sh @@ -5,6 +5,9 @@ wget https://github.com/gitbucket/gitbucket/releases/download/4.32.0/gitbucket.war mkdir -p /media/Data/Repositories cp gitbucket.war /media/Data/Repositories/ + cp database.conf Database*.sh /media/Data/Repositories/ + echo chown jenkins:jenkins /media/Data/Repositories/* + sudo chown jenkins:jenkins /media/Data/Repositories/* fi openssl dgst -sha256 gitbucket.war @@ -39,4 +42,6 @@ sudo systemctl restart nginx echo -e "\n127.0.0.1 gitbucket.localdomain\n" | sudo tee -a /etc/hosts +echo "Added gitbucket to /etc/hosts, should also anyway be already in the bind9/dns/named settings" + diff --git a/Environment/gitbucket/database.conf b/Environment/gitbucket/database.conf new file mode 100755 index 0000000..ce09ea5 --- /dev/null +++ b/Environment/gitbucket/database.conf @@ -0,0 +1,8 @@ +db { + url = "jdbc:mysql://localhost/gitbucket?useUnicode=true&characterEncoding=utf8" + user = "gitbucket" + password = "gitbucketdbpassword" +# url = "jdbc:h2:${DatabaseHome};MVCC=true" +# user = "sa" +# password = "sa" +}