Skip to content

Commit

Permalink
Merge pull request EOSIO#137 from enumivo/staging
Browse files Browse the repository at this point in the history
cleanup
  • Loading branch information
Enumivo authored May 18, 2018
2 parents fc3c00e + b68f856 commit a3e81ef
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 224 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ set( CMAKE_CXX_STANDARD 14 )
set( CMAKE_CXX_EXTENSIONS ON )
set( CXX_STANDARD_REQUIRED ON)

set(VERSION_MAJOR 4)
set(VERSION_MAJOR 1)
set(VERSION_MINOR 0)
set(VERSION_PATCH 0)

Expand Down
2 changes: 1 addition & 1 deletion CMakeModules/installer.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ include(InstallRequiredSystemLibraries)

#install_directory_permissions( DIRECTORY usr/${CMAKE_INSTALL_INCLUDEDIR}/enumivo )

set(CPACK_PACKAGE_CONTACT "[email protected]")
set(CPACK_PACKAGE_CONTACT "[email protected]")
set(CPACK_OUTPUT_FILE_PREFIX ${CMAKE_BINARY_DIR}/packages)
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install)
Expand Down
197 changes: 1 addition & 196 deletions Docker/README.md
Original file line number Diff line number Diff line change
@@ -1,198 +1,3 @@
# Run in docker

Simple and fast setup of Enumivo on Docker is also available.

## Install Dependencies

- [Docker](https://docs.docker.com) Docker 17.05 or higher is required
- [docker-compose](https://docs.docker.com/compose/) version >= 1.10.0

## Docker Requirement

- At least 7GB RAM (Docker -> Preferences -> Advanced -> Memory -> 7GB or above)
- If the build below fails, make sure you've adjusted Docker Memory settings and try again.

## Build eos image

```bash
git clone https://github.com/enumivo/enumivo.git --recursive --depth 1
cd eos/Docker
docker build . -t enumivo/eos
```

The above will build off the most recent commit to the master branch by default. If you would like to target a specific branch/tag, you may use a build argument. For example, if you wished to generate a docker image based off of the dawn-v4.0.0 tag, you could do the following:

```bash
docker build -t enumivo/eos:dawn-v4.0.0 --build-arg branch=dawn-v4.0.0 .
```

## Start enunode docker container only

```bash
docker run --name enunode -p 8888:8888 -p 9876:9876 -t enumivo/eos enunoded.sh arg1 arg2
```

By default, all data is persisted in a docker volume. It can be deleted if the data is outdated or corrupted:

```bash
$ docker inspect --format '{{ range .Mounts }}{{ .Name }} {{ end }}' enunode
fdc265730a4f697346fa8b078c176e315b959e79365fc9cbd11f090ea0cb5cbc
$ docker volume rm fdc265730a4f697346fa8b078c176e315b959e79365fc9cbd11f090ea0cb5cbc
```

Alternately, you can directly mount host directory into the container

```bash
docker run --name enunode -v /path-to-data-dir:/opt/enumivo/bin/data-dir -p 8888:8888 -p 9876:9876 -t enumivo/eos enunoded.sh arg1 arg2
```

## Get chain info

```bash
curl http://127.0.0.1:8888/v1/chain/get_info
```

## Start both enunode and enuwallet containers

```bash
docker volume create --name=enunode-data-volume
docker volume create --name=enuwallet-data-volume
docker-compose up -d
```

After `docker-compose up -d`, two services named `enunoded` and `enuwallet` will be started. enunode service would expose ports 8888 and 9876 to the host. enuwallet service does not expose any port to the host, it is only accessible to enucli when running enucli is running inside the enuwallet container as described in "Execute enucli commands" section.

### Execute enucli commands

You can run the `enucli` commands via a bash alias.

```bash
alias enucli='docker-compose exec enuwallet /opt/enumivo/bin/enucli -u http://enunoded:8888 --wallet-url http://localhost:8888'
enucli get info
enucli get account inita
```

Upload sample exchange contract

```bash
enucli set contract exchange contracts/exchange/exchange.wast contracts/exchange/exchange.abi
```

If you don't need enuwallet afterwards, you can stop the enuwallet service using

```bash
docker-compose stop enuwallet
```

### Develop/Build custom contracts

Due to the fact that the enumivo/eos image does not contain the required dependencies for contract development (this is by design, to keep the image size small), you will need to utilize the enumivo/eos-dev image. This image contains both the required binaries and dependencies to build contracts using enumivocpp.

You can either use the image available on [Docker Hub](https://hub.docker.com/r/enumivo/eos-dev/) or navigate into the dev folder and build the image manually.

```bash
cd dev
docker build -t enumivo/eos-dev .
```

### Change default configuration

You can use docker compose override file to change the default configurations. For example, create an alternate config file `config2.ini` and a `docker-compose.override.yml` with the following content.

```yaml
version: "2"

services:
enunode:
volumes:
- enunode-data-volume:/opt/enumivo/bin/data-dir
- ./config2.ini:/opt/enumivo/bin/data-dir/config.ini
```
Then restart your docker containers as follows:
```bash
docker-compose down
docker-compose up
```

### Clear data-dir

The data volume created by docker-compose can be deleted as follows:

```bash
docker volume rm enunode-data-volume
docker volume rm enuwallet-data-volume
```

### Docker Hub

Docker Hub image available from [docker hub](https://hub.docker.com/r/enumivo/eos/).
Create a new `docker-compose.yaml` file with the content below

```bash
version: "3"

services:
enunoded:
image: enumivo/eos:latest
command: /opt/enumivo/bin/enunoded.sh
hostname: enunoded
ports:
- 8888:8888
- 9876:9876
expose:
- "8888"
volumes:
- enunode-data-volume:/opt/enumivo/bin/data-dir

enuwallet:
image: enumivo/eos:latest
command: /opt/enumivo/bin/enuwallet
hostname: enuwallet
links:
- enunoded
volumes:
- enuwallet-data-volume:/opt/enumivo/bin/data-dir

volumes:
enunode-data-volume:
enuwallet-data-volume:

```

*NOTE:* the default version is the latest, you can change it to what you want

run `docker pull enumivo/eos:latest`

run `docker-compose up`

### Dawn 4.0 Testnet

We can easily set up a Dawn 4.0 local testnet using docker images. Just run the following commands:

Note: if you want to use the mongo db plugin, you have to enable it in your `data-dir/config.ini` first.

```
# pull images
docker pull enumivo/eos:latest
docker pull mongo:latest
# create volume
docker volume create --name=enunode-data-volume
docker volume create --name=enuwallet-data-volume
docker volume create --name=mongo-data-volume
# start containers
docker-compose -f docker-compose-dawn4.0.yaml up -d
# get chain info
curl http://127.0.0.1:8888/v1/chain/get_info
# get logs
docker-compose logs enunoded
# stop containers
docker-compose -f docker-compose-dawn4.0.yaml down
```

The `blocks` data are stored under `--data-dir` by default, and the wallet files are stored under `--wallet-dir` by default, of course you can change these as you want.

### About MongoDB Plugin

Currently, the mongodb plugin is disabled in `config.ini` by default, you have to change it manually in `config.ini` or you can mount a `config.ini` file to `/opt/enumivo/bin/data-dir/config.ini` in the docker-compose file.
Docker is not available at the moment
4 changes: 2 additions & 2 deletions Docker/docker-compose-dawn4.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ services:
- mongo-data-volume:/data/db

enunoded:
image: enumivo/eos:latest
image: enumivo/enumivo:latest
command: /opt/enumivo/bin/enunoded.sh --data-dir /opt/enumivo/bin/data-dir --resync --mongodb-uri mongodb://mongo:27017/ENU
hostname: enunoded
links:
Expand All @@ -24,7 +24,7 @@ services:
- enunode-data-volume:/opt/enumivo/bin/data-dir

enuwallet:
image: enumivo/eos:latest
image: enumivo/enumivo:latest
command: /opt/enumivo/bin/enuwallet --wallet-dir /opt/enumivo/bin/data-dir
hostname: enuwallet
links:
Expand Down
2 changes: 1 addition & 1 deletion Docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
enunoded:
build:
context: .
image: enumivo/eos
image: enumivo/enumivo
command: /opt/enumivo/bin/enunoded.sh --data-dir /opt/enumivo/bin/data-dir
hostname: enunoded
ports:
Expand Down
12 changes: 6 additions & 6 deletions enu.doxygen.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#---------------------------------------------------------------------------
DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "Enumivo"
PROJECT_NUMBER = "DAWN ${DOXY_ENU_VERSION}"
PROJECT_NUMBER = "Enumivo ${DOXY_ENU_VERSION}"
PROJECT_BRIEF =
PROJECT_LOGO = enu-logo.png
OUTPUT_DIRECTORY =
Expand Down Expand Up @@ -209,9 +209,9 @@ HTML_DYNAMIC_SECTIONS = NO
HTML_INDEX_NUM_ENTRIES = 100
GENERATE_DOCSET = NO
DOCSET_FEEDNAME = "Doxygen generated docs"
DOCSET_BUNDLE_ID = io.eos
DOCSET_PUBLISHER_ID = one.block
DOCSET_PUBLISHER_NAME = block.one
DOCSET_BUNDLE_ID =
DOCSET_PUBLISHER_ID =
DOCSET_PUBLISHER_NAME = enumivo.org
GENERATE_HTMLHELP = NO
CHM_FILE =
HHC_LOCATION =
Expand All @@ -221,14 +221,14 @@ BINARY_TOC = NO
TOC_EXPAND = NO
GENERATE_QHP = NO
QCH_FILE =
QHP_NAMESPACE = io.eos
QHP_NAMESPACE = enumivo.org
QHP_VIRTUAL_FOLDER = doc
QHP_CUST_FILTER_NAME =
QHP_CUST_FILTER_ATTRS =
QHP_SECT_FILTER_ATTRS =
QHG_LOCATION =
GENERATE_ECLIPSEHELP = NO
ECLIPSE_DOC_ID = io.eos
ECLIPSE_DOC_ID = enumivo.org
DISABLE_INDEX = NO
GENERATE_TREEVIEW = NO
ENUM_VALUES_PER_LINE = 4
Expand Down
2 changes: 1 addition & 1 deletion libraries/chain/include/enumivo/chain/asset.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <enumivo/chain/types.hpp>
#include <enumivo/chain/symbol.hpp>

/// eos with 4 digits of precision
/// enu with 4 digits of precision
#define ENU_SYMBOL_VALUE (int64_t(4) | (uint64_t('E') << 8) | (uint64_t('N') << 16) | (uint64_t('U') << 24))
static const enumivo::chain::symbol ENU_SYMBOL(ENU_SYMBOL_VALUE);

Expand Down
6 changes: 3 additions & 3 deletions programs/enucli/eosc.pot
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Localization template for eosc
# Localization template for enuclient
# see LICENSE.txt
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: Dawn 4.0\n"
"Project-Id-Version: Enumivo 1.0\n"
"Report-Msgid-Bugs-To: https://github.com/enumivo/enumivo/issues"
"POT-Creation-Date: 2017-09-28 11:40-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
Expand Down Expand Up @@ -85,7 +85,7 @@ msgid ""
"The ABI for the code on account \"${1}\" does not specify table \"${2}\".\n"
"\n"
"Please check the account and table name, and verify that the account has the expected code using:\n"
" eosc get code ${1}"
" enuclient get code ${1}"
msgstr ""

msgid "Error locating help text: ${code} ${what}"
Expand Down
12 changes: 6 additions & 6 deletions programs/enucli/main.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/**
* @file
* @copyright defined in enumivo/LICENSE.txt
* @defgroup eosclienttool Enumivo Command Line Client Reference
* @defgroup enuclienttool Enumivo Command Line Interface Client Reference
* @brief Tool for sending transactions and querying state from @ref enunode
* @ingroup eosclienttool
* @ingroup enuclienttool
*/

/**
@defgroup eosclienttool
@defgroup enuclienttool
@section intro Introduction to enucli
Expand Down Expand Up @@ -809,7 +809,7 @@ struct create_account_subcommand {
string stake_net;
string stake_cpu;
uint32_t buy_ram_bytes_in_kbytes = 8;
string buy_ram_eos;
string buy_ram_enu;
bool transfer;
bool simple;

Expand All @@ -827,7 +827,7 @@ struct create_account_subcommand {
(localized("The amount of ENU delegated for CPU bandwidth")))->required();
createAccount->add_option("--buy-ram-bytes", buy_ram_bytes_in_kbytes,
(localized("The amount of RAM bytes to purchase for the new account in kilobytes KiB, default is 8 KiB")));
createAccount->add_option("--buy-ram-ENU", buy_ram_eos,
createAccount->add_option("--buy-ram-ENU", buy_ram_enu,
(localized("The amount of RAM bytes to purchase for the new account in ENU")));
createAccount->add_flag("--transfer", transfer,
(localized("Transfer voting power and right to unstake ENU to receiver")));
Expand All @@ -847,7 +847,7 @@ struct create_account_subcommand {
} ENU_RETHROW_EXCEPTIONS(public_key_type_exception, "Invalid active public key: ${public_key}", ("public_key", active_key_str));
auto create = create_newaccount(creator, account_name, owner_key, active_key);
if (!simple) {
action buyram = !buy_ram_eos.empty() ? create_buyram(creator, account_name, to_asset(buy_ram_eos))
action buyram = !buy_ram_enu.empty() ? create_buyram(creator, account_name, to_asset(buy_ram_enu))
: create_buyrambytes(creator, account_name, buy_ram_bytes_in_kbytes * 1024);
action delegate = create_delegate( creator, account_name, to_asset(stake_net), to_asset(stake_cpu), transfer);
send_actions( { create, buyram, delegate } );
Expand Down
4 changes: 2 additions & 2 deletions testnet.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ The ssh helper fields are paths to ssh and scp, an identity if necessary, and an
"remote": true,
"ssh_identity": "",
"ssh_args": "",
"enu_root_dir": "/home/phil/blockchain/eos",
"enu_root_dir": "/home/phil/blockchain/enu",
"data_dir": "tn_data_0",
"hostname": "remoteserv",
"public_name": "remoteserv",
Expand Down Expand Up @@ -184,7 +184,7 @@ This table describes all of the key/value pairs used in the testnet.json file.
### Provisioning Distributed Servers
The ssh_helper section of the testnet.json file contains the ssh elements necessary to connect and issue commands to other servers. In addition to the ssh_helper section which provides access to global configuration settings, the per-node configuration may provide overriding identity and connection arguments.

It is also necessary to provision the server by at least copying the enudaemon executable, and the genesis.json files to their appropriate locations relative to some named Enumivo root directory. For example, I defined the Enumivo root to be `/home/phil/blockchain/eos`. When run, the launcher will run through a variety of shell commands using ssh and finally using scp to copy a config.ini file to the appropriate data directory on the remote.
It is also necessary to provision the server by at least copying the enudaemon executable, and the genesis.json files to their appropriate locations relative to some named Enumivo root directory. For example, I defined the Enumivo root to be `/home/phil/blockchain/enu`. When run, the launcher will run through a variety of shell commands using ssh and finally using scp to copy a config.ini file to the appropriate data directory on the remote.

## Runtime Artifacts
The launcher app creates a separate date and configuration directory for each node instance. This directory is named `tn_data_<n>` with n ranging from 0 to the number of nodes being launched.
Expand Down
4 changes: 2 additions & 2 deletions tests/p2p_tests/pump/run_test.pl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

my $enu_home = defined $ENV{ENU_HOME} ? $ENV{ENU_HOME} : getcwd;
my $enudaemon = $enu_home . "/programs/enudaemon/enudaemon";
my $eosc = $enu_home . "/programs/eosc/eosc";
my $enuclient = $enu_home . "/programs/enuclient/enuclient";

my $nodes = defined $ENV{ENU_TEST_RING} ? $ENV{ENU_TEST_RING} : "1";
my $pnodes = defined $ENV{ENU_TEST_PRODUCERS} ? $ENV{ENU_TEST_PRODUCERS} : "1";
Expand Down Expand Up @@ -245,7 +245,7 @@ sub perform_work {
my $stoptime = time () + $run_duration;
my $counter = 0;
while (time () < $stoptime) {
`$eosc transfer eos inita 10 >> eosc.out 2>> eosc.err`;
`$enuclient transfer enu inita 10 >> enuclient.out 2>> enuclient.err`;
$counter++;
if ($counter % 1000 == 0) {
print "$counter client iterations\n";
Expand Down
Loading

0 comments on commit a3e81ef

Please sign in to comment.