diff --git a/README.md b/README.md index 3699629..216d8cb 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ git clone https://github.com/Internet-of-People/core-control -b master In 2.6.10 we made three breaking changes. -1. We only have a master branch now +1. You only have to use the `master` branch from now. The `develop` branch is for development only and contains changes that might ruin your live production. 2. You need to prepend the `ccontrol` with a `NETWORK` environment set. See in the next section. ### How to Upgrade from 2.5.19 to 2.6.10 @@ -74,7 +74,9 @@ export NETWORK=[devnet|mainnet] && ./ccontrol.sh arg1 [arg2] | `plugin` | `list`/`add`/`remove`/`update` | Manage Core Plugins | ## General -This is a Streamlined CLI-Based Core v2 Management Tool. + +This is a Streamlined CLI-Based Core v2 Management Tool. + - **Do not run as root!** - Installs fail2ban for ssh, and ufw allowing only port 22(ssh) and the cores ports. - For start/restart/stop/status/logs you can skip the 'all' argument as it's the default. @@ -104,6 +106,11 @@ The end result is that your node will start syncing from 0. ## Changelog +### 2.6.31+p3 + +- Upgraded to 4.0.1 SSI (project Morpheus, previously called DAC) +- Added 1.0.0 DNS (project Coeus) + ### 2.6.31+p2 - Upgrade to 3.1.1 DAC (project Morpheus) diff --git a/ccontrol.sh b/ccontrol.sh index c05cdc7..84cde3e 100755 --- a/ccontrol.sh +++ b/ccontrol.sh @@ -82,15 +82,15 @@ main () { cd $core > /dev/null 2>&1 git_check_core - local morpheus_plugin_installed="$(cat $config/plugins.js | grep morpheus)" + local hydra_plugin_installed="$(cat $config/plugins.js | grep hydra-plugin)" if [ ! -f "$config/app.js" ]; then cp $core/packages/core/bin/config/$network/app.js $config/app.js fi - local morpheus_appjs_installed="$(cat $config/app.js | grep morpheus)" + local hydra_appjs_installed="$(cat $config/app.js | grep hydra-plugin)" - if [ "$up2date" = "yes" ] && [ ! -z "$morpheus_plugin_installed" ] && [ ! -z "$morpheus_appjs_installed" ]; then + if [ "$up2date" = "yes" ] && [ ! -z "$hydra_plugin_installed" ] && [ ! -z "$hydra_appjs_installed" ]; then echo -e "Already up-to-date." exit 1 fi @@ -98,11 +98,9 @@ main () { git checkout . git fetch --tags 2>&1 git checkout $network 2>&1 - git submodule update --init --recursive --remote 2>&1 if [ "$?" != "0" ]; then rm yarn.lock > /dev/null 2>&1 - git submodule update --init --recursive --remote 2>&1 fi if [ "$?" != "0" ]; then diff --git a/functions.sh b/functions.sh index 7eed55e..a96b2ae 100644 --- a/functions.sh +++ b/functions.sh @@ -303,7 +303,7 @@ install_db () { install_core () { - git clone --recurse-submodules $repo $core -b $network > /dev/null 2>&1 + git clone $repo $core -b $network > /dev/null 2>&1 if [ -d $HOME/.config ]; then sudo chown -R $USER:$USER $HOME/.config > /dev/null 2>&1 @@ -330,14 +330,23 @@ update () { local fstatus=$(pm2status "${name}-forger" | awk '{print $4}') local rstatus=$(pm2status "${name}-relay" | awk '{print $4}') - # INSTALL MORPHEUS IF IT IS NOT YET THERE - if [ -z "$(cat $config/plugins.js | grep '@internet-of-people/morpheus-hydra-plugin')" ]; then + # INSTALL HYDRA IF IT IS NOT YET THERE + if [ -z "$(cat $config/plugins.js | grep '@internet-of-people/hydra-plugin')" ]; then if [ -z "$(cat $config/plugins.js | grep '@arkecosystem/core-transaction-pool')" ]; then - echo "ERROR: $config/plugins.js does not contain @arkecosystem/core-transaction-pool which is essential to have Morpheus in Hydra Core." + echo "ERROR: $config/plugins.js does not contain @arkecosystem/core-transaction-pool which is essential to have Hydra Core." exit 1; fi - node $basedir/morpheus-pluginsjs-installer.js $config/plugins.js + node $basedir/hydra-pluginsjs-installer.js $config/plugins.js + fi + + if [ -z "$(cat $config/app.js | grep '@internet-of-people/hydra-plugin')" ]; then + if [ -z "$(cat $config/app.js | grep '@arkecosystem/core-magistrate-transactions')" ]; then + echo "ERROR: $config/app.js does not contain @arkecosystem/core-magistrate-transactions which is essential to have Hydra Core." + exit 1; + fi + + node $basedir/hydra-appjs-installer.js $config/app.js fi ## CHECKING IF API RATE LIMIT INCREASE IS THERE diff --git a/hydra-appjs-installer.js b/hydra-appjs-installer.js new file mode 100644 index 0000000..32a5d45 --- /dev/null +++ b/hydra-appjs-installer.js @@ -0,0 +1,42 @@ +const fs = require('fs'); + +const appjsPath = process.argv[2]; +if(!appjsPath) { + console.error('ERROR: the Hydra installer script must have an argument passed: the path of the app.js file.'); + process.exit(1); +} + +if(!fs.existsSync(appjsPath)) { + console.error(`ERROR: file does not exist at ${appjsPath}`); + process.exit(1); +} + +console.log(`Updating ${appjsPath}...`); + +let appjs = fs.readFileSync(appjsPath).toString(); +if(appjs.indexOf('@internet-of-people/hydra-plugin')>-1) { + console.log('Plugins already contains Morpheus plugin.'); + process.exit(0); +} + +var replaceTarget, replaceTo; + +if(appjs.indexOf('@internet-of-people/morpheus-hydra-plugin')>-1) { // upgrading from 2.6.31+p2 + replaceTarget = '@internet-of-people/morpheus-hydra-plugin'; + replaceTo = '@internet-of-people/hydra-plugin'; +} +else { + replaceTarget = '"@arkecosystem/core-magistrate-transactions"'; + replaceTo = '"@arkecosystem/core-magistrate-transactions", "@internet-of-people/hydra-plugin"'; +} + +var regexp = new RegExp(replaceTarget, 'g'); + +appjs = appjs.replace( + regexp, + replaceTo +); + +fs.writeFileSync(appjsPath, appjs); + +console.log('Appjs file has been updated.'); \ No newline at end of file diff --git a/hydra-pluginsjs-installer.js b/hydra-pluginsjs-installer.js new file mode 100644 index 0000000..55e1ce4 --- /dev/null +++ b/hydra-pluginsjs-installer.js @@ -0,0 +1,37 @@ +const fs = require('fs'); + +const pluginsPath = process.argv[2]; +if(!pluginsPath) { + console.error('ERROR: the Hydra installer script must have an argument passed: the path of the plugins.js file.'); + process.exit(1); +} + +if(!fs.existsSync(pluginsPath)) { + console.error(`ERROR: file does not exist at ${pluginsPath}`); + process.exit(1); +} + +console.log(`Updating ${pluginsPath}...`); + +let plugins = fs.readFileSync(pluginsPath).toString(); +if(plugins.indexOf('@internet-of-people/hydra-plugin')>-1) { + console.log('Plugins already contains the Hydra plugin.'); + process.exit(0); +} + +var replaceTarget, replaceTo; + +if(plugins.indexOf('@internet-of-people/morpheus-hydra-plugin')>-1) { // upgrading from 2.6.31+p2 + replaceTarget = '@internet-of-people/morpheus-hydra-plugin'; + replaceTo = '@internet-of-people/hydra-plugin'; +} +else { + replaceTarget = '"@arkecosystem/core-transaction-pool"'; + replaceTo = '"@internet-of-people/hydra-plugin": {},\n "@arkecosystem/core-transaction-pool"'; +} + +plugins = plugins.replace(replaceTarget, replaceTo); + +fs.writeFileSync(pluginsPath, plugins); + +console.log('Plugins file has been updated.'); \ No newline at end of file diff --git a/morpheus-appjs-installer.js b/morpheus-appjs-installer.js deleted file mode 100644 index 42386d9..0000000 --- a/morpheus-appjs-installer.js +++ /dev/null @@ -1,32 +0,0 @@ -const fs = require('fs'); - -const appjsPath = process.argv[2]; -if(!appjsPath) { - console.error('ERROR: the Morpheus installer script must have an argument passed: the path of the app.js file.'); - process.exit(1); -} - -if(!fs.existsSync(appjsPath)) { - console.error(`ERROR: file does not exist at ${appjsPath}`); - process.exit(1); -} - -console.log(`Updating ${appjsPath}...`); - -let plugins = fs.readFileSync(appjsPath).toString(); -if(plugins.indexOf('@internet-of-people/morpheus-hydra-plugin')>-1) { - console.log('Plugins already contains Morpheus plugin.'); - process.exit(0); -} - -var find = '"@arkecosystem/core-magistrate-transactions"'; -var regexp = new RegExp(find, 'g'); - -plugins = plugins.replace( - regexp, - '"@arkecosystem/core-magistrate-transactions", "@internet-of-people/morpheus-hydra-plugin"' -); - -fs.writeFileSync(appjsPath, plugins); - -console.log('Appjs file has been updated.'); \ No newline at end of file diff --git a/morpheus-pluginsjs-installer.js b/morpheus-pluginsjs-installer.js deleted file mode 100644 index be39c39..0000000 --- a/morpheus-pluginsjs-installer.js +++ /dev/null @@ -1,26 +0,0 @@ -const fs = require('fs'); - -const pluginsPath = process.argv[2]; -if(!pluginsPath) { - console.error('ERROR: the Morpheus installer script must have an argument passed: the path of the plugins.js file.'); - process.exit(1); -} - -if(!fs.existsSync(pluginsPath)) { - console.error(`ERROR: file does not exist at ${pluginsPath}`); - process.exit(1); -} - -console.log(`Updating ${pluginsPath}...`); - -let plugins = fs.readFileSync(pluginsPath).toString(); -if(plugins.indexOf('@internet-of-people/morpheus-hydra-plugin')>-1) { - console.log('Plugins already contains Morpheus plugin.'); - process.exit(0); -} - -plugins = plugins.replace('"@arkecosystem/core-transaction-pool"','"@internet-of-people/morpheus-hydra-plugin": {},\n "@arkecosystem/core-transaction-pool"'); - -fs.writeFileSync(pluginsPath, plugins); - -console.log('Plugins file has been updated.'); \ No newline at end of file diff --git a/project.conf.common b/project.conf.common index e9869f3..fd53902 100644 --- a/project.conf.common +++ b/project.conf.common @@ -25,4 +25,4 @@ rpc_port="8080" core="$HOME/${name}-core" data="$HOME/.config/${name}-core" config="$data/$network" -version="2.6.10" +version="2.6.31+p3" diff --git a/project.conf.devnet b/project.conf.devnet index 2af6831..235f61c 100644 --- a/project.conf.devnet +++ b/project.conf.devnet @@ -1,8 +1,5 @@ #!/bin/bash -#Branch name, used for core-control itself and hydra-core as well -branch="develop" - #Network name network="devnet" diff --git a/project.conf.mainnet b/project.conf.mainnet index 33af2d6..62d19ca 100644 --- a/project.conf.mainnet +++ b/project.conf.mainnet @@ -1,8 +1,5 @@ #!/bin/bash -#Branch name, used for core-control itself and hydra-core as well -branch="master" - #Network name network="mainnet"