Replies: 2 comments
-
|
Previously, I used git to reset |
Beta Was this translation helpful? Give feedback.
-
|
this is a great idea and we'll add this to our roadmap. I'm still weighing the different options. do you prefer this approach to something like packaging the server as a electron/tauri app that can run in the background from your system tray? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Overview
When installing sudocode, the package can create service files to allow the server to run in the background. I already created such service files for macOS and Linux and they appear to be functional. These services can be launched with user-level permissions, but the install script can also ask the user if these services should be enabled first, or prompt the user with relevant commands printed to the console.
Proposed implementation
npm packages have a
postinstallscript. This script can detected what OS the user is running, then copy the relevant service file to the appropriate directory. This script can accept a simple [Y/n] to enable the service on install. This service would still allow future development like a dedicated frontend client or IDE extensions, since the server still provides the same APIs.postinstall skeleton
postinstall.js:package.json:{ "scripts": { "postinstall": "node postinstall.js" }, "files": [ "postinstall.js", "systemd/sudocode-server.service", "LaunchAgents/com.sudocode.server.plist" ] }cli updates
sudocode-server serviceto manage the servicestart/stopenable/disablelogssudocode import/syncnow detects whether the service is running and performs any action as neededPossible issues
I'm not fully familiar with sudocode-server enough to know all blockers, but already I can think of:
.sudocode/*.jsonlfiles can desync, especially after git operations. I have experienced this myself. I can fix this issue withsudocode import/synccommands, but I never ran them while the server was still running. I don't know if having the serverService files
For each environment, replace
$USERwith your username. Replace$SUDOCODE-SERVERwith the output ofwhich sudocode-server.Linux systemd
~/.config/systemd/user/sudocode-server.service:To enable, run:
systemctl --user daemon-reloadsystemctl --user enable --now sudocode-server.serviceTo access logs, run:
journalctl --user -t sudocode-server -fmacOS LaunchAgent
~/Library/LaunchAgents/com.sudocode.server.plist:Then run:
launchctl load ~/Library/LaunchAgents/com.sudocode.server.plistlaunchctl start com.sudocode.serverTo access logs, run:
tail -f /tmp/sudocode-server.logWindows
I don't have a Windows machine, so I can't test. Cursory searching shows npm install can call a powershell script, which can call
ScheduleTaskand create the service. Alternatively,wsl2supports systemd, but not by default.Beta Was this translation helpful? Give feedback.
All reactions