Skip to content
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

Patch 2. Update run.sh file for docker. #118

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

CodeAunt
Copy link
Contributor

Ensure the node id and device id could be refreshed for container user.

CodeAunt added 2 commits July 23, 2024 19:56
Refresh node_id, device_id and domain. Tested.
Remove unnecessary id difference check.
Remove init command here. For official docker, it has already been run in Dockerfile.
Use path for wasmedge command.
Copy link
Contributor

juntao commented Jul 26, 2024

Hello, I am a code review agent on flows.network. Here are my reviews of changed source code files in this PR.


docker/run.sh

Potential issues

Bug 1: The script attempts to run the command '${gaianet_base_dir}bin/gaianet init' but it is commented out with a '#' symbol in front.

Bug 2: There's no space between '${gaianet_base_dir}' and 'bin' when trying to call gaianet init, which could cause the command to fail because it's looking for a directory named '${gaianet_base_dir}bin' instead of the correct one.

Bug 3: The script generates a new device ID and saves it in 'deviceid.txt', but it doesn't update this ID anywhere else in the code, which may cause issues if the device ID needs to be used elsewhere for proper functionality.

Bug 4: If the 'gaianet info' command fails or returns an empty result, the script will set node_info as an empty value and print it out, which might mislead users into thinking there were no errors when in fact something went wrong with the command.

Bug 5: The sed command that updates the subdomain link may not work correctly if the original 'subdomain' or 'name' field doesn't exist, as awk would return an empty string, which could result in invalid configuration file modifications.

Summary of changes

  1. The script now disables SSL security checks by uncommenting the line that appends "insecure" to ~/.curlrc.
  2. It defines a variable, gaianet_base_dir, which is set as the base directory for GaiaNet.
  3. Lines that initialized and started GaiaNet are commented out.
  4. Added conditional logic to handle the sed command based on different operating systems (Linux and macOS).
  5. Clears the original configuration of Gaianet by setting nodeid.json to an empty object, then removing the existing "address" field in config.json.
  6. Regenerates a new NodeId using wasmedge and prints it out.
  7. Generates a new device ID using openssl and saves it to 'deviceid.txt'.
  8. Updates subdomain link by modifying 'frpc.toml' with the new "address" from config.json, "domain", and the newly generated device ID.
  9. Prints out node information using the command: ${gaianet_base_dir}bin/gaianet info.
  10. Initiates GaiaNet start-up by running: ${gaianet_base_dir}bin/gaianet start.
  11. Finally, it continuously monitors and displays logs from the file start-llamaedge.log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants