-
Notifications
You must be signed in to change notification settings - Fork 3
Feature/daemons #203
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
alex-sandrk
wants to merge
40
commits into
dev
Choose a base branch
from
feature/daemons
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Feature/daemons #203
Changes from all commits
Commits
Show all changes
40 commits
Select commit
Hold shift + click to select a range
a8f4c7e
feat: macos daemons
alex-sandrk b8460cb
feat: restart proxy at initial run
alex-sandrk f43d02c
use standart name for daemons
alex-sandrk 182cc23
test Windows service
alex-sandrk b6bfba3
fix command
alex-sandrk 35ca74e
add new resource
alex-sandrk b89bb91
add new resource
alex-sandrk dcfab08
add new resource
alex-sandrk f2a8327
fix: command
alex-sandrk 4b5b998
fix: wallet uninstall
alex-sandrk 966a1ff
fix: wallet uninstall
alex-sandrk a7f8315
fix: wallet uninstall
alex-sandrk 02ede0f
fix: wallet uninstall
alex-sandrk 9e3ca08
fix: wallet uninstall
alex-sandrk 78ca091
fix: wallet uninstall
alex-sandrk 4f58cf6
cleanup code
alex-sandrk 1513c54
fix: wallet uninstall
alex-sandrk e23de74
feat: linux system service
alex-sandrk 05cc47a
fix: linux service installation
alex-sandrk 3ba955b
fix: linux service installation
alex-sandrk 28de31a
fix: escape space
alex-sandrk 737c166
fix: install script
alex-sandrk 02f9b6d
fix: install script
alex-sandrk f36a060
fix: install script
alex-sandrk fe08375
refactor daemons code
alex-sandrk a492cf5
small refactor
alex-sandrk 4dbef7e
Merge branch 'dev' of github.com:Lumerin-protocol/WalletDesktop into …
alex-sandrk ee43519
feat: prefix variables; fix bug
alex-sandrk b6ca96d
fix: edit contract
alex-sandrk 801ddbd
Merge branch 'dev' of github.com:Lumerin-protocol/WalletDesktop into …
alex-sandrk 112d6af
remove test artifacts
alex-sandrk 5e39086
fix: not defined fn
alex-sandrk 265e3de
feature release
alex-sandrk f33496f
Revert "fix: not defined fn"
alex-sandrk f840cc2
revert artifacts
alex-sandrk 5ba7e4a
fix: llinux start command
alex-sandrk 6bec705
fix
alex-sandrk 50112a1
fix env setting
alex-sandrk 3727c33
fix env setting
alex-sandrk 0ca7b03
feat: use launchagents for macos
alex-sandrk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,13 @@ | ||
| !macro customHeader | ||
| RequestExecutionLevel admin | ||
| !macroend | ||
|
|
||
| !macro customUnInstall | ||
| ExecWait "TaskKill /IM proxy-router.exe /F" | ||
| ${ifNot} ${isUpdated} | ||
| ExecWait "TaskKill /IM proxy-router.exe /F" | ||
| ExecWait "sc stop proxySeller" | ||
| ExecWait "sc stop proxyBuyer" | ||
| ExecWait "sc delete proxySeller" | ||
| ExecWait "sc delete proxyBuyer" | ||
| ${endIf} | ||
| !macroend |
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| const PROXY_ROUTER_MODE = { | ||
| Buyer: "buyer", | ||
| Seller: "seller", | ||
| }; | ||
|
|
||
| const getProxyRouterEnvs = (config, mode) => { | ||
| const modes = { | ||
| [PROXY_ROUTER_MODE.Buyer]: [ | ||
| ["PROXY_ADDRESS", `0.0.0.0:${config.buyerProxyPort}`], | ||
| ["WEB_ADDRESS", `0.0.0.0:${config.buyerWebPort}`], | ||
| ["IS_BUYER", true], | ||
| ["POOL_ADDRESS", `"${config.buyerDefaultPool}"`], | ||
| ["HASHRATE_DIFF_THRESHOLD", 0.1], | ||
| ], | ||
| [PROXY_ROUTER_MODE.Seller]: [ | ||
| ["PROXY_ADDRESS", `0.0.0.0:${config.sellerProxyPort}`], | ||
| ["WEB_ADDRESS", `0.0.0.0:${config.sellerWebPort}`], | ||
| ["IS_BUYER", false], | ||
| ["POOL_ADDRESS", `"${config.sellerDefaultPool}"`], | ||
| ["HASHRATE_DIFF_THRESHOLD", 0.03], | ||
| ], | ||
| }; | ||
| return [ | ||
| ["CLONE_FACTORY_ADDRESS", `"${config.cloneFactoryAddress}"`], | ||
| ["ETH_NODE_ADDRESS", `"${config.wsApiUrl}"`], | ||
| ["MINER_VETTING_DURATION", "1m"], | ||
| ["POOL_CONN_TIMEOUT", "15m"], | ||
| ["POOL_MAX_DURATION", "7m"], | ||
| ["POOL_MIN_DURATION", "2m"], | ||
| ["STRATUM_SOCKET_BUFFER_SIZE", 4], | ||
| ["VALIDATION_BUFFER_PERIOD", "10m"], | ||
| ["WALLET_ADDRESS", `"${config.walletAddress}"`], | ||
| ["WALLET_PRIVATE_KEY", `"${config.privateKey}"`], | ||
| ["LOG_LEVEL", "debug"], | ||
| ["MINER_SUBMIT_ERR_LIMIT", 0], | ||
| ...(modes[mode] || []), | ||
| ]; | ||
| }; | ||
|
|
||
| module.exports = { getProxyRouterEnvs, PROXY_ROUTER_MODE }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| const { getProxyRouterEnvs, PROXY_ROUTER_MODE } = require("../config"); | ||
| const { linuxInstallScript } = require("./installScript"); | ||
| const { sudo } = require("../sudoPrompt"); | ||
|
|
||
| const getInstallLinuxServiceCommand = async (daemonName, pathToExecutable) => { | ||
| const config = linuxInstallScript | ||
| .replaceAll("{serviceName}", daemonName) | ||
| .replaceAll("{pathToExecutable}", `${pathToExecutable}/proxy-router`) | ||
|
|
||
| const path = `/etc/systemd/system/${daemonName}.service`; | ||
| return `touch ${path} && echo '${config}' > ${path}`; | ||
| }; | ||
|
|
||
| const getCommandToRunDaemon = async (serviceName, envs) => { | ||
| const setEnvsCommand = envs | ||
| .map((e) => `sudo systemctl set-environment ${e[0]}=${e[1]}`) | ||
| .join(";"); | ||
alex-sandrk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| return `sudo systemctl daemon-reload; ${setEnvsCommand}; sudo service ${serviceName} restart`; | ||
| }; | ||
|
|
||
| const runLinuxDaemons = async (resourcePath, config) => { | ||
| const sellerServiceName = "proxyRouterSeller"; | ||
| const buyerServiceName = "proxyRouterBuyer"; | ||
| const installSellerCommand = await getInstallLinuxServiceCommand( | ||
| sellerServiceName, | ||
| `${resourcePath}/executables` | ||
| ); | ||
| const installBuyerCommand = await getInstallLinuxServiceCommand( | ||
| buyerServiceName, | ||
| `${resourcePath}/executables` | ||
| ); | ||
|
|
||
| const sellerRunCommand = await getCommandToRunDaemon( | ||
| sellerServiceName, | ||
| getProxyRouterEnvs(config, PROXY_ROUTER_MODE.Seller) | ||
| ); | ||
| const buyerRunCommand = await getCommandToRunDaemon( | ||
| buyerServiceName, | ||
| getProxyRouterEnvs(config, PROXY_ROUTER_MODE.Buyer) | ||
| ); | ||
|
|
||
| const commands = [ | ||
| installSellerCommand, | ||
| installBuyerCommand, | ||
| sellerRunCommand, | ||
| buyerRunCommand, | ||
| ]; | ||
|
|
||
| await sudo(commands.join(";")); | ||
| }; | ||
|
|
||
| module.exports = { | ||
| runLinuxDaemons, | ||
| }; | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.