mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-03-09 18:49:14 +01:00
Semaphore: Move from BoltDB to SQLite (#12624)
* Fix * start * Apply suggestion from @tremor021
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
},
|
||||
"notes": [
|
||||
{
|
||||
"text": "This instance uses BoltDB",
|
||||
"text": "This instance uses SQLite",
|
||||
"type": "info"
|
||||
},
|
||||
{
|
||||
|
||||
@@ -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}"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user