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

fix: Small fixes for installer after testing #343

Merged
merged 5 commits into from
Jul 6, 2022
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions installer/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@
###############################################################
### Systemd Config ###
###############################################################
STANDALONE_SERVICE_FILE = "https://raw.githubusercontent.com/cheqd/cheqd-node/de487a0cfc095d92bd579b142c7708f64b6f1536/build-tools/node-standalone.service"
COSMOVISOR_SERVICE_FILE = "https://raw.githubusercontent.com/cheqd/cheqd-node/de487a0cfc095d92bd579b142c7708f64b6f1536/build-tools/node-cosmovisor.service"
LOGROTATE_TEMPLATE = "https://raw.githubusercontent.com/cheqd/cheqd-node/de487a0cfc095d92bd579b142c7708f64b6f1536/build-tools/logrotate.conf"
RSYSLOG_TEMPLATE = "https://raw.githubusercontent.com/cheqd/cheqd-node/de487a0cfc095d92bd579b142c7708f64b6f1536/build-tools/rsyslog.conf"
STANDALONE_SERVICE_FILE = "https://raw.githubusercontent.com/cheqd/cheqd-node/main/build-tools/node-standalone.service"
COSMOVISOR_SERVICE_FILE = "https://raw.githubusercontent.com/cheqd/cheqd-node/main/build-tools/node-cosmovisor.service"
LOGROTATE_TEMPLATE = "https://raw.githubusercontent.com/cheqd/cheqd-node/main/build-tools/logrotate.conf"
RSYSLOG_TEMPLATE = "https://raw.githubusercontent.com/cheqd/cheqd-node/main/build-tools/rsyslog.conf"
DEFAULT_STANDALONE_SERVICE_NAME = 'cheqd-noded'
DEFAULT_COSMOVISOR_SERVICE_NAME = 'cheqd-cosmovisor'
DEFAULT_STANDALONE_SERVICE_FILE_PATH = f"/lib/systemd/system/{DEFAULT_STANDALONE_SERVICE_NAME}.service"
Expand Down Expand Up @@ -247,8 +247,7 @@ def get_binary(self):
if fname.find(".tar.gz") != -1:
self.exec(f"tar -xzf {fname}")
self.remove_safe(fname)
else:
self.exec(f"mv {fname} {DEFAULT_BINARY_NAME}")
self.exec(f"chmod +x {DEFAULT_BINARY_NAME}")
except:
failure_exit("Failed to download binary")

Expand Down Expand Up @@ -489,6 +488,15 @@ def setup_cosmovisor(self):
self.log(f"Creating symlink to {self.cosmovisor_cheqd_bin_path}")
os.symlink(self.cosmovisor_cheqd_bin_path,
os.path.join(DEFAULT_INSTALL_PATH, DEFAULT_BINARY_NAME))

if self.interviewer.is_upgrade and \
os.path.exists(os.path.join(self.cheqd_data_dir, "upgrade-info.json")):

self.log(f"Copying upgrade-info.json file to cosmovisor/current/")
shutil.copy(os.path.join(self.cheqd_data_dir, "upgrade-info.json"),
os.path.join(self.cosmovisor_root_dir, "current"))
self.log(f"Changing owner to {DEFAULT_CHEQD_USER} user")
self.exec(f"chown -R {DEFAULT_CHEQD_USER}:{DEFAULT_CHEQD_USER} {self.cosmovisor_root_dir}")

self.log(f"Changing directory ownership for Cosmovisor to {DEFAULT_CHEQD_USER} user")
self.exec(f"chown -R {DEFAULT_CHEQD_USER}:{DEFAULT_CHEQD_USER} {self.cosmovisor_root_dir}")
Expand Down Expand Up @@ -803,8 +811,8 @@ def ask_for_version(self):
all_releases.insert(0, default)
for i, release in enumerate(all_releases[0: LAST_N_RELEASES]):
print(f"{i + 1}) {release.version}")
release_num = self.ask("Choose list option number above to select version of cheqd-node to install",
default=1)
release_num = int(self.ask("Choose list option number above to select version of cheqd-node to install",
default=1))
if release_num >= 1 and release_num <= len(all_releases):
self.release = all_releases[release_num - 1]
else:
Expand Down