Skip to content

Refactor Actualbudget script to use new NPM package #4223

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jeffguillaume opened this issue May 5, 2025 · 13 comments
Open

Refactor Actualbudget script to use new NPM package #4223

jeffguillaume opened this issue May 5, 2025 · 13 comments
Assignees
Labels
in project pipeline Set into Projects Pipeline for new Scripts

Comments

@jeffguillaume
Copy link

jeffguillaume commented May 5, 2025

📌 Task summary

Refactor the previously removed Actual Budget install/update script to use newly available NPM package provided by project

📋 Task details

The install and update script for Actual Budget was removed a few weeks ago because of difficulty maintaining code from the project's source.

The Actual Budget project has now released & promised ongoing support for an NPM package edition:

https://actualbudget.org/docs/install/cli-tool/

The Actual sync-server is available as an NPM package. The package is designed to make running the sync-server as easy as possible and is published to the official NPM registry under https://www.npmjs.com/package/@actual-app/sync-server

From the project:

The maintainers have been discussing ways to make the process simpler for folks who just want to run actual server without docker or going through the hassle of building from source. We've developed a CLI tool that does that, which we'll support going forward.

[...] it will be as easy as installing one npm package and running it - it should be roughly around 75MB in total.

Per @MickLesk's directions here, please consider re-adding this useful open source project back to the script repository, now that maintaining it should be easier!

@jeffguillaume jeffguillaume changed the title Refactor Actualbudget script to use new precompiled NPM binary Refactor Actualbudget script to use new NPM package May 5, 2025
@MickLesk MickLesk self-assigned this May 5, 2025
@MickLesk MickLesk added the in project pipeline Set into Projects Pipeline for new Scripts label May 5, 2025
@MickLesk
Copy link
Member

MickLesk commented May 5, 2025

Need one or two testers, its hard to migrate the old state to new state. but i think it works

Please do an backup before, and test with this update statement:

bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/ct/actualbudget.sh)"

@MickLesk MickLesk mentioned this issue May 5, 2025
10 tasks
@Rustymage
Copy link

Need one or two testers, its hard to migrate the old state to new state. but i think it works

Please do an backup before, and test with this update statement:

bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/ct/actualbudget.sh)"

  ___        __              __   ____            __           __ 
   /   | _____/ /___  ______ _/ /  / __ )__  ______/ /___ ____  / /_
  / /| |/ ___/ __/ / / / __ `/ /  / __  / / / / __  / __ `/ _ \/ __/
 / ___ / /__/ /_/ /_/ / /_/ / /  / /_/ / /_/ / /_/ / /_/ /  __/ /_  
/_/  |_\___/\__/\__,_/\__,_/_/  /_____/\__,_/\__,_/\__, /\___/\__/  
                                                  /____/            

  ✔️   Node.js 22 already installed
⠙ Performing full migration to npm-based version (25.5.0).+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*.+.....+.......+...+...+..+...+..........+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*..+......+.........+..+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.+...+...........+..................+...+...+.......+..+...+...+.......+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*.........+...+......+...+..+...+......+...............+.......+...+.................+.........+.+..+..........+..+.+........+......+.+.........+.........+......+...+......+.........+.................+......+.......+.....+...+...+.+.........+.....+....+..+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*...........+.............+.........+.....................+......+........+.+.....+......+.+.................+......+....+..+.........+....+...+..
⠹ Performing full migration to npm-based version (25.5.0)++++++++++++++++++++++++++++++
-----
  ✔️   Migrated and started Actual Budget 25.5.0
  ✔️   Update done
root@actualbudget:~# 

Sync server failed.

root@actualbudget:/var/log# systemctl status actualbudget.service 
● actualbudget.service - Actual Budget Service
     Loaded: loaded (/etc/systemd/system/actualbudget.service; enabled; preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Mon 2025-05-05 13:37:02 BST; 7s ago
    Process: 699 ExecStart=/usr/bin/actual-server --config /opt/actualbudget-data/config.json (code=exited, status=1/FAILURE)
   Main PID: 699 (code=exited, status=1/FAILURE)
        CPU: 304ms

@MickLesk
Copy link
Member

MickLesk commented May 5, 2025

can you execute this manually in terminal?

/usr/bin/actual-server --config /opt/actualbudget-data/config.json

@Rustymage
Copy link

root@actualbudget:~# /usr/bin/actual-server --config /opt/actualbudget-data/config.json
Loading config from /opt/actualbudget-data/config.json
Using default data directory. You can specify a custom config with --config
Data directory: ./
Checking if there are any migrations to run for direction "up"...

/usr/lib/node_modules/@actual-app/sync-server/node_modules/better-sqlite3/lib/methods/wrappers.js:9
        this[cppdb].exec(sql);
                    ^
SqliteError: no such column: password
    at Database.exec (/usr/lib/node_modules/@actual-app/sync-server/node_modules/better-sqlite3/lib/methods/wrappers.js:9:14)
    at WrappedDatabase.exec (file:///usr/lib/node_modules/@actual-app/sync-server/src/db.js:30:20)
    at Migration.up (file:///usr/lib/node_modules/@actual-app/sync-server/migrations/1718889148000-openid.js:4:24)
    at next (/usr/lib/node_modules/@actual-app/sync-server/node_modules/migrate/lib/migrate.js:35:45)
    at /usr/lib/node_modules/@actual-app/sync-server/node_modules/migrate/lib/migrate.js:71:9
    at /usr/lib/node_modules/@actual-app/sync-server/node_modules/migrate/lib/set.js:84:5
    at FSReqCallback.oncomplete (node:fs:188:23) {
  code: 'SQLITE_ERROR'
}

Node.js v22.14.0

@MickLesk
Copy link
Member

MickLesk commented May 5, 2025

ehm... idk :D the sqlite is from actualbudget himself. Does other guys received the same issue?

(New Installation work fine?`)

@tremor021
Copy link
Member

Fresh install works fine here

@chmsant
Copy link

chmsant commented May 5, 2025

Update to existing LXC:

    ___        __              __   ____            __           __ 
   /   | _____/ /___  ______ _/ /  / __ )__  ______/ /___ ____  / /_
  / /| |/ ___/ __/ / / / __ `/ /  / __  / / / / __  / __ `/ _ \/ __/
 / ___ / /__/ /_/ /_/ / /_/ / /  / /_/ / /_/ / /_/ / /_/ /  __/ /_  
/_/  |_\___/\__/\__,_/\__,_/_/  /_____/\__,_/\__,_/\__, /\___/\__/  
                                                  /____/            

  ✔️   Node.js 22 already installed
npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: This package is no longer supported.
npm warn deprecated [email protected]: Rimraf versions prior to v4 are no longer supported

added 280 packages in 25s

46 packages are looking for funding
  run `npm fund` for details
npm notice
npm notice New major version of npm available! 10.9.2 -> 11.3.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.3.0
npm notice To update run: npm install -g [email protected]
npm notice
......+.......+...+...........+....+..+.........+...+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*.+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*......+..+.+......+......+..+.+.....+.......+
⠇ Performing full migration to npm-based version (25.5.0)......+.......+........+......+.+.........+.....+...+.+..+.......+......+......+.....+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
.................+.....+.........+.+......+.....+.+..+...+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*...+......+..........+..+....+......+........+.+.....+.++++++++++++++++++++++++++++++++++++++++++++++++++++
⠏ Performing full migration to npm-based version (25.5.0)........+..............+....+.....+......+...............+................+...+.....+...+...............+....+...+.................+....+......+...........+..........+...+..
⠋ Performing full migration to npm-based version (25.5.0)+..........+...+.........+.....+.+.....+....+...+...+..+...+......+..........+......+..+.+..+....+...+........+.........+....+..+..........+..+...............+...+....+.....
⠙ Performing full migration to npm-based version (25.5.0)...+.+........+......+.........+......+.+..................+............+.........+.........+...+.....+....+...+......+..+..................+.+......+..+......+.+......+....
⠹ Performing full migration to npm-based version (25.5.0)+++++++++++++++++++++++++++++++++++++++++++++++++++++
-----
  ✔️   Migrated and started Actual Budget 25.5.0
  ✔️   Update done

But like Rustymage, the service seems to have errored:

root@actualbudget:~# systemctl status actualbudget.service
● actualbudget.service - Actual Budget Service
     Loaded: loaded (/etc/systemd/system/actualbudget.service; enabled; preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Mon 2025-05-05 06:43:17 PDT; 1s ago
    Process: 5773 ExecStart=/usr/bin/actual-server --config /opt/actualbudget-data/config.json (code=exited, status=1/FAILURE)
   Main PID: 5773 (code=exited, status=1/FAILURE)
        CPU: 357ms
root@actualbudget:~# 

Running your next suggested command above results in the same final state as Rustymage as well

root@actualbudget:~# /usr/bin/actual-server --config /opt/actualbudget-data/config.json
Loading config from /opt/actualbudget-data/config.json
Using default data directory. You can specify a custom config with --config
Data directory: ./
Checking if there are any migrations to run for direction "up"...

/usr/lib/node_modules/@actual-app/sync-server/node_modules/better-sqlite3/lib/methods/wrappers.js:9
        this[cppdb].exec(sql);
                    ^
SqliteError: no such column: password
    at Database.exec (/usr/lib/node_modules/@actual-app/sync-server/node_modules/better-sqlite3/lib/methods/wrappers.js:9:14)
    at WrappedDatabase.exec (file:///usr/lib/node_modules/@actual-app/sync-server/src/db.js:30:20)
    at Migration.up (file:///usr/lib/node_modules/@actual-app/sync-server/migrations/1718889148000-openid.js:4:24)
    at next (/usr/lib/node_modules/@actual-app/sync-server/node_modules/migrate/lib/migrate.js:35:45)
    at /usr/lib/node_modules/@actual-app/sync-server/node_modules/migrate/lib/migrate.js:71:9
    at /usr/lib/node_modules/@actual-app/sync-server/node_modules/migrate/lib/set.js:84:5
    at FSReqCallback.oncomplete (node:fs:188:23) {
  code: 'SQLITE_ERROR'
}

Node.js v22.14.0

Fresh install works fine here

+1, another confirmation that fresh install appears to be functional

@MickLesk
Copy link
Member

MickLesk commented May 5, 2025

The question is whether we offer migration.

Does the app offer an export/import option? So would it be acceptable for you to create a new LXC?

@tremor021
Copy link
Member

I'm talking to AB people on their discord about this @MickLesk

@MickLesk
Copy link
Member

MickLesk commented May 5, 2025

ive added an testing bugfix. can anyone try again? (with new snapshot of old install)

@chmsant
Copy link

chmsant commented May 5, 2025

New error upgrading from an existing LXC running 25.4.0

    ___        __              __   ____            __           __ 
   /   | _____/ /___  ______ _/ /  / __ )__  ______/ /___ ____  / /_
  / /| |/ ___/ __/ / / / __ `/ /  / __  / / / / __  / __ `/ _ \/ __/
 / ___ / /__/ /_/ /_/ / /_/ / /  / /_/ / /_/ / /_/ / /_/ /  __/ /_  
/_/  |_\___/\__/\__,_/\__,_/_/  /_____/\__,_/\__,_/\__, /\___/\__/  
                                                  /____/            

  ✔️   Node.js 22 already installed
⠋ Performing full migration to npm-based version (25.5.0)mv: cannot move '/opt/actualbudget_bak/selfhost.key' to '/opt/actualbudget/selfhost.key': No such file or directory
⠙ Performing full migration to npm-based version (25.5.0)
[ERROR] in line 66: exit code 0: while executing command mv /opt/actualbudget_bak/selfhost.key /opt/actualbudget/selfhost.key
root@actualbudget:/opt/actualbudget_bak# ls
bin              demo.png            eslint.config.mjs  package.json  selfhost.crt            tsconfig.json
CONTRIBUTING.md  docker-compose.yml  LICENSE.txt        packages      **selfhost.key**            upcoming-release-notes
data             Dockerfile          node_modules       README.md     sync-server.Dockerfile  yarn.lock
root@actualbudget:/opt/actualbudget_bak# 

Missing the new actualbudget folder under /opt?

root@actualbudget:/opt# ls
actualbudget_bak  actualbudget-data  actualbudget_version.txt

@MickLesk
Copy link
Member

MickLesk commented May 5, 2025

No new folder, its an NPM package

Your Install is old, without certs?

@chmsant
Copy link

chmsant commented May 5, 2025

No new folder, its an NPM package

Your Install is old, without certs?

Nope, this was from a fresh LXC install back in late March, after the certs functionality was added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in project pipeline Set into Projects Pipeline for new Scripts
Projects
None yet
Development

No branches or pull requests

5 participants