Skip to content

Commit 982bb5f

Browse files
authored
Merge pull request #7 from orelvis15/feature/download_installer_for_hydra
Feature/download installer for hydra
2 parents a4c9bc1 + d89469c commit 982bb5f

File tree

17 files changed

+248
-69
lines changed

17 files changed

+248
-69
lines changed

.github/workflows/action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
os: ubuntu-latest
2222
artifact_name: target/release/cvm
2323
asset_name: cvm-x86_64
24-
target: x86_64-unknown-linux-gnu
24+
target: x86_64-unknown-linux-musl
2525
- name: rpi
2626
os: ubuntu-latest
2727
artifact_name: target/release/cvm

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## cvm v0.3.0
2+
- add download cardano bins for hydra
3+
14
## cvm v0.2.0
25
- add versionate remote config
36

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cvm"
3-
version = "0.2.1"
3+
version = "0.3.0"
44
edition = "2021"
55
authors = ["Orelvis Lago Vasallo"]
66
description = "CLI for version control in cardano pools"

README.md

Lines changed: 86 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,19 @@ This CLI is implemented based on the scripts generated by the community, with th
99
[Documentation to get started in the tool](https://orelvis15.github.io/cvm/)
1010

1111
## Support
12+
- Compiled download support is provided by IOK, the download is done from the hydra.iohk.io pages themselves, they only provide support for (Ubuntu 18.04 LTS, 20.04 LTS; Mint 19.3, 20; Debian 10.3).
13+
- Compilation support is provided by CVM, compilation is done on the local server, we are working on supporting RedHat based versions.
1214

13-
| OS | BASH | ZSH | FISH |
14-
|:-------:|:----------:|:-----------:|:-----------:|
15-
| Ubuntu | Yes | Coming Soon | Coming Soon |
16-
| Debian | Yes | Coming Soon | Coming Soon |
17-
| centos | not tested | Coming Soon | Coming Soon |
18-
| RedHat | not tested | Coming Soon | Coming Soon |
19-
| Fedora | not tested | Coming Soon | Coming Soon |
20-
| Rasbian | not tested | Coming Soon | Coming Soon |
15+
16+
| OS | Download | Build |
17+
|:-------:|:--------:|:----------:|
18+
| Ubuntu | Yes | Yes |
19+
| Debian | Yes | Yes |
20+
| Debian | Yes | Yes |
21+
| Mint | Yes | Not tested |
22+
| RedHat | - | Not tested |
23+
| Fedora | - | Not tested |
24+
| Rasbian | - | Not tested |
2125

2226
## Install CVM Release
2327

@@ -30,73 +34,113 @@ curl https://raw.githubusercontent.com/orelvis15/cvm/master/install.sh -sSf | ba
3034
```
3135
curl https://raw.githubusercontent.com/orelvis15/cvm/master/install.sh -sSf | bash -s -- debug && source "$HOME"/.cvm/env
3236
```
37+
## Starting
38+
39+
To start running the cardano node we need to decide how we want to manage the node versions.
3340

41+
#### We have two options
42+
- Download the executables published by IOK
43+
- Compile cardano locally
44+
45+
---
3446
## Prepare Pool
3547

3648
Prepare the server to be able to run cardano-node.
3749

38-
* Install all necessary dependencies.
39-
* Create the community-proposed folder structure in [prepare.sh](https://github.com/cardano-community/guild-operators/blob/alpha/scripts/cnode-helper-scripts/prereqs.sh#L427) and other extras.
40-
* Download all the configuration files depending on the network we select (mainnet by default)
41-
* Download all the [scripts](https://github.com/cardano-community/guild-operators/tree/alpha/scripts/cnode-helper-scripts) that the community offers us
50+
#### 1: Using the binary download (**Default**)
4251

43-
### Prepare pool for mainnet
52+
This is the default option, we just need to run:
4453

4554
`cvm init`
46-
or
47-
`cvm init mainnet`
4855

49-
### Prepare pool for testnet
56+
what happens now?
57+
58+
- It will be verified that the user has write permissions in the `/opt` directory
59+
- All necessary dependencies will be installed
60+
- The project folder structure will be created in `/opt/cardano`
61+
- All scripts and configuration files needed for cardano node to work will be downloaded
62+
63+
#### 2: Compiling locally
64+
65+
For this case it is only necessary to add the `-b` option
66+
67+
`cvm init -b`
5068

51-
`cvm init testnet`
69+
what happens now?
5270

71+
- Same steps as executed with `cvm init`
72+
- Ghcup, Cabal and Ghc dependency is installed
73+
- The libsecp256k1 library is installed (compiled locally)
74+
75+
#### If you want to configure the server for testnet just add `testnet` to the command
76+
77+
`cvm init testnet` | `cvm init -b testnet`
78+
79+
In this case, instead of downloading the configuration files for the mainnet, those corresponding to the testnet would be downloaded.
80+
81+
----
5382
## Install cardano node
5483

55-
Build the version of cardano node passed by parameters, by default the latest version is built.
84+
To install the cardano node binaries on the server we also have two options, it all depends on how you have prepared the server, to download the binaries or to compile them.
5685

57-
### build the x.x.x version
86+
#### 1: Using the binary download (**Default**)
5887

59-
`
60-
cvm install x.x.x
61-
`
88+
`cvm install x.x.x`
6289

63-
### build last version
90+
what happens now?
6491

65-
`
66-
cvm install
67-
`
92+
- The binaries corresponding to version x.x.x are downloaded if they exist from the page [Hydra](https://hydra.iohk.io/)
6893

94+
#### 2: Compiling locally
95+
96+
It is mandatory to prepare the server to compile cardano, otherwise this process would fail due to lack of dependencies.
97+
98+
`cvm install -b x.x.x`
99+
100+
what happens now?
101+
102+
- Changes corresponding to the x.x.x version of the [cardano-node](https://github.com/input-output-hk/cardano-node) repository are compiled locally
103+
104+
#### Extra!!
105+
If we leave the version field blank, cvm will look for the latest release published by IOK.
106+
107+
`cvm install` o `cvm install -b`
108+
109+
---
69110
## List install versions
70111

71112
List all version installed.
72113

73114
`
74-
cvm list
115+
cvm ls
75116
`
76-
or
77-
`
78-
cvm -l
79-
`
80-
117+
---
81118
## Use versions
82119

83-
Start using the version passed by parameters.
84-
This command creates the relevant services for the operation of the cardano node
120+
Point the cardano-node service to the version passed by parameters.
85121

86122
`
87123
cvm use x.x.x
88124
`
89125

126+
what happens now?
127+
- The service is created, in case it does not exist or it is updated in case there are any updates.
128+
- The new version is changed to the current folder where the cnode.services service points.
129+
- The systemctl daemon is restarted.
130+
131+
---
90132
## Remove version
91133
Delete the specified version
92134

93135
`
94136
cvm remove x.x.x
95137
`
96138

139+
---
97140
## Start or Stop node
98141

99142
To start or stop the cardano node use
143+
100144
`
101145
cvm start
102146
`
@@ -105,6 +149,11 @@ or
105149
cvm stop
106150
`
107151

152+
The start command does not set the cardano node service to start automatically, in case of a system reboot you will need to start it manually. If you want to set it to start automatically when the system boots run
153+
154+
`systemctl enable cnode.service`
155+
156+
---
108157
## Update cvm
109158
Update CLI to the latest version
110159

@@ -118,14 +167,16 @@ If you want to force the update of all configuration files and scripts
118167
cvm config update -f
119168
`
120169

170+
---
121171
## Clear cache
122172

123-
Clear cache files of cabal, ghc and cardano build
173+
Clear cache files of cabal, ghc, cardano build and .cvm/tmp
124174

125175
`
126176
cvm clean
127177
`
128178

179+
---
129180
## More info and community
130181
- [Telegram](https://t.me/cvm_cli)
131182
- [Website](https://sites.google.com/view/cvmcli/inicio)

config/config_remote.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ others_files = ["cardano-submit-api", "cardano-api", "cardano-api-test", "cardan
4545
[download_install]
4646
base_url = "https://hydra.iohk.io/build/"
4747
end_url = "/download/1/cardano-node-{version}-linux.tar.gz"
48-
versions = ["1.35.0"]
49-
build_id = ["16994721"]
48+
versions = ["1.35.0", "1.34.1", "1.34.0", "1.33.0", "1.32.1", "1.31.0"]
49+
build_id = ["16994721", "13065769", "12997298", "9941151", "9116140", "8110920"]
5050

5151
#Services items
5252

install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
if [[ $(id -u) == 0 ]] ; then echo "Rlease don't run as root" ; exit 1 ; fi
3+
if [[ $(id -u) == 0 ]] ; then echo "Please don't run as root" ; exit 1 ; fi
44

55
repo="https://api.github.com/repos/orelvis15/cvm/releases/latest"
66
env="https://raw.githubusercontent.com/orelvis15/cvm/master/env"

src/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use subcommands::subcommands_impl::install::Install;
1010
use subcommands::subcommands_impl::list::List;
1111
use subcommands::subcommands_impl::start::Start;
1212
use subcommands::subcommands_impl::stop::Stop;
13+
use crate::subcommands::commands_config::CommandsConfig;
1314
use crate::subcommands_impl::clean::Clean;
1415
use crate::subcommands_impl::config::Config;
1516
use crate::subcommands_impl::r#use::Use;
@@ -53,7 +54,7 @@ fn main() {
5354
Some(("clean", matches)) => {
5455
Clean::start(matches)
5556
}
56-
Some(("list", matches)) => {
57+
Some(("ls", matches)) => {
5758
List::start(matches)
5859
}
5960
Some(("update", matches)) => {

src/subcommands/commands_config.rs

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ pub fn command_config() -> ArgMatches {
1818
.about("Start the environment to be able to build a Cardano node")
1919
.arg(get_arg_network())
2020
.arg(get_arg_force_init())
21+
.arg(get_arg_build_init())
2122
)
2223
.subcommand(Command::new(CommandsConfig::INSTALL.to_string())
2324
.about("Build the cardano node and make it available for use")
2425
.arg(get_arg_version())
26+
.arg(get_arg_build_install())
2527
)
2628
.subcommand(Command::new(CommandsConfig::USE.to_string())
2729
.about("Change the current cardano-node to the new version")
@@ -39,7 +41,7 @@ pub fn command_config() -> ArgMatches {
3941
)
4042
.subcommand(Command::new(CommandsConfig::CLEAN.to_string())
4143
.about("Remove temporary and build files"))
42-
.subcommand(Command::new(CommandsConfig::LIST.to_string())
44+
.subcommand(Command::new(CommandsConfig::LS.to_string())
4345
.about("List all installed versions of cardano node"))
4446
.subcommand(Command::new(CommandsConfig::UPDATE.to_string())
4547
.about("Update to the new version of CVM if it exists"))
@@ -58,6 +60,20 @@ fn get_arg_network() -> Arg<'static> {
5860
Arg::new(Args::NETWORK._to_string()).default_value(Args::LATEST._to_string()).takes_value(true)
5961
}
6062

63+
fn get_arg_build_install() -> Arg<'static> {
64+
Arg::new(Args::BUILD._to_string())
65+
.short('b')
66+
.long(Args::BUILD._to_string())
67+
.help("Build cardano-node locally")
68+
}
69+
70+
fn get_arg_build_init() -> Arg<'static> {
71+
Arg::new(Args::BUILD._to_string())
72+
.short('b')
73+
.long(Args::BUILD._to_string())
74+
.help("Prepare server for build cardano-node")
75+
}
76+
6177
fn get_arg_force_init() -> Arg<'static> {
6278
Arg::new(Args::FORCE._to_string())
6379
.short('f')
@@ -77,7 +93,7 @@ pub enum CommandsConfig {
7793
INSTALL,
7894
USE,
7995
REMOVE,
80-
LIST,
96+
LS,
8197
UPDATE,
8298
START,
8399
STOP,
@@ -92,7 +108,7 @@ impl Display for CommandsConfig {
92108
CommandsConfig::INSTALL => write!(f, "install"),
93109
CommandsConfig::USE => write!(f, "use"),
94110
CommandsConfig::REMOVE => write!(f, "remove"),
95-
CommandsConfig::LIST => write!(f, "list"),
111+
CommandsConfig::LS => write!(f, "ls"),
96112
CommandsConfig::UPDATE => write!(f, "update"),
97113
CommandsConfig::START => write!(f, "start"),
98114
CommandsConfig::STOP => write!(f, "stop"),
@@ -107,6 +123,7 @@ pub enum Args {
107123
VERSION,
108124
LATEST,
109125
FORCE,
126+
BUILD,
110127
}
111128

112129
impl Args {
@@ -116,6 +133,7 @@ impl Args {
116133
Args::VERSION => { "version" }
117134
Args::LATEST => { "latest" }
118135
Args::FORCE => { "force" }
136+
Args::BUILD => { "build" }
119137
}
120138
}
121139
}
@@ -127,6 +145,7 @@ impl Display for Args {
127145
Args::VERSION => write!(f, "version"),
128146
Args::LATEST => write!(f, "latest"),
129147
Args::FORCE => write!(f, "force"),
148+
Args::BUILD => write!(f, "build"),
130149
}
131150
}
132151
}

0 commit comments

Comments
 (0)