Semaphore: Move from BoltDB to SQLite (#12624)

* Fix

* start

* Apply suggestion from @tremor021
This commit is contained in:
Slaviša Arežina
2026-03-06 21:53:47 +01:00
committed by GitHub
parent be803ced6f
commit 9ff1d088c5
3 changed files with 33 additions and 4 deletions

View File

@@ -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

View File

@@ -33,7 +33,7 @@
},
"notes": [
{
"text": "This instance uses BoltDB",
"text": "This instance uses SQLite",
"type": "info"
},
{

View File

@@ -30,11 +30,12 @@ SEM_KEY=$(openssl rand -base64 32)
SEM_PW=$(openssl rand -base64 12)
cat <<EOF >/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}"
}