diff --git a/ct/semaphore.sh b/ct/semaphore.sh index 11f395126..d2d18a207 100644 --- a/ct/semaphore.sh +++ b/ct/semaphore.sh @@ -28,6 +28,34 @@ function update_script() { msg_error "No ${APP} Installation Found!" exit fi + + if [[ -f /opt/semaphore/semaphore_db.bolt ]]; then + msg_warn "WARNING: Due to bugs with BoltDB database, update script will move your application" + msg_warn "to use SQLite database instead. Unfortunately, this will reset your application and make it a fresh" + msg_warn "installation. All your data will be lost!" + echo "" + read -r -p "${TAB3}Do you want to continue? (y/N): " CONFIRM + if [[ ! "$CONFIRM" =~ ^[Yy]$ ]]; then + exit 0 + else + msg_info "Moving from BoltDB to SQLite" + systemctl stop semaphore + rm -rf /opt/semaphore/semaphore_db.bolt + sed -i \ + -e 's|"bolt": {|"sqlite": {|' \ + -e 's|/semaphore_db.bolt"|/database.sqlite"|' \ + -e '/semaphore_db.bolt/d' \ + -e '/"dialect"/d' \ + -e '/^ },$/a\ "dialect": "sqlite",' \ + /opt/semaphore/config.json + SEM_PW=$(cat ~/semaphore.creds) + systemctl start semaphore + $STD semaphore user add --admin --login admin --email admin@helper-scripts.com --name Administrator --password "${SEM_PW}" --config /opt/semaphore/config.json + + msg_ok "Moved from BoltDB to SQLite" + fi + fi + if check_for_gh_release "semaphore" "semaphoreui/semaphore"; then msg_info "Stopping Service" systemctl stop semaphore diff --git a/frontend/public/json/semaphore.json b/frontend/public/json/semaphore.json index 8afc98875..b070bce0e 100644 --- a/frontend/public/json/semaphore.json +++ b/frontend/public/json/semaphore.json @@ -33,7 +33,7 @@ }, "notes": [ { - "text": "This instance uses BoltDB", + "text": "This instance uses SQLite", "type": "info" }, { diff --git a/install/semaphore-install.sh b/install/semaphore-install.sh index 14ca6c2a2..1cf74d6f2 100644 --- a/install/semaphore-install.sh +++ b/install/semaphore-install.sh @@ -30,11 +30,12 @@ SEM_KEY=$(openssl rand -base64 32) SEM_PW=$(openssl rand -base64 12) cat </opt/semaphore/config.json { - "bolt": { - "host": "/opt/semaphore/semaphore_db.bolt" + "sqlite": { + "host": "/opt/semaphore/database.sqlite" }, + "dialect": "sqlite", "tmp_path": "/opt/semaphore/tmp", - "cookie_hash": "${SEM_HASH}", + "cookie_hash": "${SEM_HASH}", "cookie_encryption": "${SEM_ENCRYPTION}", "access_key_encryption": "${SEM_KEY}" }