Skip to content

Commit

Permalink
Upgrade to 2.6.31+p3
Browse files Browse the repository at this point in the history
  • Loading branch information
mudlee committed Nov 10, 2020
1 parent b013cb7 commit f3c7155
Show file tree
Hide file tree
Showing 10 changed files with 106 additions and 77 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down
8 changes: 3 additions & 5 deletions ccontrol.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,27 +82,25 @@ 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

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
Expand Down
19 changes: 14 additions & 5 deletions functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
42 changes: 42 additions & 0 deletions hydra-appjs-installer.js
Original file line number Diff line number Diff line change
@@ -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.');
37 changes: 37 additions & 0 deletions hydra-pluginsjs-installer.js
Original file line number Diff line number Diff line change
@@ -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.');
32 changes: 0 additions & 32 deletions morpheus-appjs-installer.js

This file was deleted.

26 changes: 0 additions & 26 deletions morpheus-pluginsjs-installer.js

This file was deleted.

2 changes: 1 addition & 1 deletion project.conf.common
Original file line number Diff line number Diff line change
Expand Up @@ -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"
3 changes: 0 additions & 3 deletions project.conf.devnet
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#!/bin/bash

#Branch name, used for core-control itself and hydra-core as well
branch="develop"

#Network name
network="devnet"

Expand Down
3 changes: 0 additions & 3 deletions project.conf.mainnet
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#!/bin/bash

#Branch name, used for core-control itself and hydra-core as well
branch="master"

#Network name
network="mainnet"

Expand Down

0 comments on commit f3c7155

Please sign in to comment.