Skip to content

Commit

Permalink
New master release 0.12 (#161)
Browse files Browse the repository at this point in the history
* Added my name (#91)

* Add new make start-offline command (#94)

* Fix bug on CLI for full name image of postgres (#98)

* full postgres image name

* Start neo-local-faucet with CLI (#100)

* Down CLI command (#102)

* New Down command

* New service for mapping container IDs to services

* Add PrivateNet container to CLI (#104)

* Finished 4 isolated consensus nodes (#92)

* add configs and wallets from privnet

* initial remove of 4 nodes

* Breaking out in 4 separate containers

* Corrected seed names

* Make nodes inter-connected

* Remove image place-holder, not needed

* Removed --build flag, because --force-recreate does the same

* ENV var and Case switch to open the correct wallet

* Corrected dnpath for node2 to 4

* Removed neo-python from node images

* Removed neo-cli.zip file that was wrongly commited

* Remove comments

* Use just one standard image for neo-cli. So now it's 4x faster in 1/4 storage space

* Use just 1 standard image for neo-cli. Now 4x faster in 1/4 storge space

* fix seed list and rpc list

* Fix SEED_SERVER variable to point to a correct consensus-node

* Update neo-python version to v0.8.1

* Update neo-cli to v2.8.0 and force --build when compose up

* Corrected config to neo-cli v2.8.0

* cleanup: space deleted

* Remove debug print

* Moved download of neo-cli to run inside the dockerfile

* New feature: Multi version neo-cli

* Config files are now version tagged

* Support for v2.7.6.1 neo-cli

* Support for v2.8.0 neo-cli

* Multi neo-cli version mixed in the same compose

* removed duplicated package

* script to help publish a neo-loca-privatenet container

* temporary compose until we have a official docker hub repo

* Changed docker repo for neo-local-privatenet official

* move to a diff folder and re-witten to commit any container choosen

* more neo-cli versions supported

* Support for neo-cli v2.9.0

* neo-cli v2.9.0 supported

* Script to change nodes version

* watch with -t to remove headers

* Corrected apt errors with cache + forced delete of any old blockchain

* Added CONTRIBUTING.md (#81)

* Update PR template (#82)

* Add CODEOWNERS file (#83)

* Update Issue Templates (#84)

* Status CLI Command (#86)

* Documentation for the 4 isolated nodes feature (#90)

* Documentation

* Word and grammatical corrections

* Added instruction to stop neo-local

* Added my name

* full postgres image name

* Changed the number of running containers tested

* Change the number of containers

* Change version

* push to 0.11.1

* Minor changes. Bad english and others

* Update docker.go

* Update postgres.go

* Naming convention neo-cli-privatenet-

Change neo-privatenet-x to neo-cli-privatenet-x

* Naming convention

change neo-privatenet- to neo-cli-privatenet-x

* Naming convention

change neo-privatenet- to neo-cli-privatenet-x

* Naming convention

change neo-privatenet- to neo-cli-privatenet-x

* Naming convention

change neo-privatenet- to neo-cli-privatenet-x

* Naming convention

change neo-privatenet- to neo-cli-privatenet-x

* Naming convention

change neo-privatenet- to neo-cli-privatenet-x

* Naming convention

change neo-privatenet- to neo-cli-privatenet-x

* Simple Policy Plugin (#105)

* Documentation

* Word and grammatical corrections

* Added instruction to stop neo-local

* Added my name

* full postgres image name

* Changed the number of running containers tested

* Change the number of containers

* Change version

* push to 0.11.1

* Minor changes. Bad english and others

* Add plugin SimplePolicy to docker images

* copy ptotocol from existing chain

* ContainerName cannot be based on ImageName (#111)

* Added the service.Name variable

* Correct lists order

* Build & Test the CLI in Travis (#120)

* CLI: fix image pulling (#114)

* fix image pulling

* Quick formating change

* Add neo-python to CLI (#109)

* Add neo-python container to CLI

* Update cli/stack/neopython.go

Co-Authored-By: nunojusto <nuno@justoweb.com>

* Update cli/stack/neopython.go

Co-Authored-By: nunojusto <nuno@justoweb.com>

* Update cli/stack/neopython.go

Co-Authored-By: nunojusto <nuno@justoweb.com>

* Correct comments

* Order correctly the Service list

* bubble up errors

* correction on the error if statement logic

* corrected container names

* corrections on errors and lists

* refactoring to make better code

* More naming refactor

* naming changes

Co-Authored-By: nunojusto <nuno@justoweb.com>

* maming changes

Co-Authored-By: nunojusto <nuno@justoweb.com>

* naming changes

* naming changes

* correct bug

* Add notifications-server to CLI (#108)

* Notifications server added to CLI

* Variable to be used to mount volume from host

* Update cli/stack/notificationsserver.go

Co-Authored-By: nunojusto <nuno@justoweb.com>

* Update cli/stack/notificationsserver.go

Co-Authored-By: nunojusto <nuno@justoweb.com>

* Update cli/stack/notificationsserver.go

Co-Authored-By: nunojusto <nuno@justoweb.com>

* Correct order of the Service list

* Correct lists order

* added container Name attribute

* bubble up err

* Bootstrap Chain (#115)

* new var to choose bootstrap chain

* rewriting documentation accordingly

* correcting grammar error

* some new blank lines

* Create cross platform Home dir and config file (#124)

* creation of home dir

* default home dir and config file

* adding viper package

* viper create file

* move all inside config package

* remove parameter from dirPath

* remove duplicated var

* remove comments and correct description

* small standardization code corrections

* Same neo-python versions and add missing service names (#136)

* Stop Command (#135)

* HealthCheck monitoring for Container/Service NEO-SCAN (#128)

* adding healthcheck for neo-faucet (#141)

Merging

* Adding support for neo-cli v2.9.3 (#147)

* support neocli 2.9.3

* change SimplePlugin version

* Add healthcheck to neo-cli nodes using docker-compose (#143)

* added dummy healthcheck to node1

* added autoheal healthcheck to neo-cli containers

* install jq on container to parse json input

* dont remove curl because its needed for healthcheck tests

* healthcheck script added

* verbose messages

* added healthcheck script to Dockerfile

* fix send contructor invocation (#145)

* rewrite to remove network_mode flag (#149)

* Add healthcheck to notifications-server using docker-compose (#142)

* add notifications-server to autoheal healthcheck

* correction end of while

* Update to neopython v0.8.3 (#152)

* fix claiming gas and neo

* add new neo-python version

* correct config to support new version

* correct config

* changed python prompt commands

* Update README.md

* pump up neopython version (#155)

* Lower block time prodution to 4 seconds (#158)

* Feat/6k blocks chain (#159)

* produce a chain with more than 6k blocks

* decrease iteration time waiting for block

* Support for neo-cli v2.9.4 (#160)

* Correct print alert for possible wait time to pull docker images

* added support for neo-cli v2.9.4

* CLI: Logic flow to add dependency between containers (#117)

* added container dependency

* correction multiple-value stack.Services()

* DependsOn: nil

Co-Authored-By: nunojusto <nuno@justoweb.com>

* DependsOn: nil

Co-Authored-By: nunojusto <nuno@justoweb.com>

* DependsOn: nil

Co-Authored-By: nunojusto <nuno@justoweb.com>

* add spaces

Co-Authored-By: nunojusto <nuno@justoweb.com>

* remove comments

Co-Authored-By: nunojusto <nuno@justoweb.com>

* remove comments

Co-Authored-By: nunojusto <nuno@justoweb.com>

* re-arranging private function

* Add neo-scan-sync to CLI (#118)

* add container neo-scan-sync

* Code identation

* dependsOn add

* Array re-orfer

* Update cli/stack/neo-scan-sync.go

Co-Authored-By: nunojusto <nuno@justoweb.com>

* Added neo-scan-api container to CLI (#119)

* Added neo-scan-api container

* code identation

* list re-ordering

* dependsOn var

* array re-order

* Update cli/stack/neo-scan-api.go

Co-Authored-By: nunojusto <nuno@justoweb.com>

* corrected neo-scan-api call

* Adding autoheal container to CLI (#134)

* adding autoheal container

* changing name of coontainer

* correct word always

Co-Authored-By: nunojusto <nuno@justoweb.com>

* Update cli/stack/autoheal.go

Co-Authored-By: nunojusto <nuno@justoweb.com>

* deleted neo-scan-sync and added autoheal

* Documentation for neo-local cli
  • Loading branch information
nunojusto authored Mar 6, 2019
1 parent 4dd4b78 commit c5f93ad
Show file tree
Hide file tree
Showing 68 changed files with 2,902 additions and 137 deletions.
14 changes: 13 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,17 @@
# https://docs.docker.com/compose/env-file/

NOTIFICATIONS_SERVER=notifications-server
SEED_SERVER=neo-nodes
SEED_SERVER=neo-cli-privatenet-1
HOST_NAME=localhost

# neo-cli version
# Other supported versions: 2.9.4, 2.9.3, 2.9.0, 2.8.0, 2.7.6.1
NODE1_NEO_CLI_VERSION=2.9.4
NODE2_NEO_CLI_VERSION=2.9.3
NODE3_NEO_CLI_VERSION=2.9.0
NODE4_NEO_CLI_VERSION=2.8.0

# neo-cli bootstrap chain
# Supported versions are: _genesis, _6kBlocks
# _genesis means starting from block zero and _6kBlocks starts with 6000 blocks
BOOTSTRAP=_6kBlocks
3 changes: 2 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
# Each line is a file pattern followed by one or more owners.

# These owners will be the default owners for everything in the repo.
* @revett
* @revett
* @nunojusto
15 changes: 12 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
language: generic
language: go

go:
- "1.11"

sudo: required

Expand All @@ -12,8 +15,14 @@ notifications:
on_success: never
on_failure: always

# Install step is skipped.
install: true
before_install:
- curl -L -s https://github.com/golang/dep/releases/download/v0.5.0/dep-linux-amd64 -o $GOPATH/bin/dep
- chmod +x $GOPATH/bin/dep

install:
- cd ./cli
- dep ensure -v
- cd ..

# Script step is run as part of a shell script as it requires a conditional.
script:
Expand Down
21 changes: 14 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ VERSION ?= $(shell cat ./VERSION)

DEFAULT: start

attach-to-neo-python-client:
@./scripts/print.sh prefix "Attaching terminal to neo-python client\n"
@./scripts/print.sh grey "Open wallet (password: 'coz'):\t wallet open neo-privnet.wallet"
@./scripts/print.sh grey "Test smart contract:\t\t sc build_run /smart-contracts/wake_up_neo.py True False False 07 05 main\n"
@docker exec -it neo-python np-prompt -p -v

# IGNORE - used to check if version has been bumped on CI.
check-version:
@echo "=> Checking if VERSION exists as Git tag..."
Expand All @@ -21,20 +27,21 @@ push-tag:
git tag ${VERSION}
git push origin ${BRANCH} --tags

setup-network:
pull-images:
@./scripts/print.sh prefix "Fetching Docker containers..."
@./scripts/print.sh prefix "The first time you run, it will take a while to pull/build neo-cli-privatenet (1 to 4) images..."
@docker-compose pull > /dev/null

setup-network:
@./scripts/print.sh prefix "Starting Docker containers..."
@docker-compose up -d --build --remove-orphans --force-recreate > /dev/null
@docker-compose up -d --build --force-recreate --remove-orphans > /dev/null
@./scripts/print.sh prefix "Waiting for network..." false
@./scripts/ping.sh
@./scripts/print.sh prefix "Network running! 🎉"

start: setup-network
@./scripts/print.sh prefix "Attaching terminal to neo-python client\n"
@./scripts/print.sh grey "Open wallet (password: 'coz'):\t open wallet ./neo-privnet.wallet"
@./scripts/print.sh grey "Test smart contract:\t\t build /smart-contracts/wake_up_neo.py test 07 05 True False main\n"
@docker exec -it neo-python np-prompt -p -v
start: pull-images setup-network attach-to-neo-python-client

start-offline: setup-network attach-to-neo-python-client

stop:
@./scripts/print.sh prefix "Stopping Docker containers..."
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ project from the [Truffle Framework](https://truffleframework.com/ganache).

## Documentation

Please visit the [wiki](https://github.com/CityOfZion/neo-local/wiki) for
Please visit the [Documentation](documentation/) for
instructions on how to install and use the project.

![image](https://user-images.githubusercontent.com/2796074/36632958-9247f8ba-198d-11e8-8055-f096141902d9.png)
25 changes: 17 additions & 8 deletions cli/Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion cli/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
VERSION = $(shell cat ../VERSION)

build:
@go build -i -ldflags "-X main.Version=${VERSION}" -o neo-local .
@go build -i -ldflags "-X main.Version=${VERSION}" -o neo-local .

test:
@go test ./... -cover
17 changes: 17 additions & 0 deletions cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<p align="center">
<img
src="http://res.cloudinary.com/vidsy/image/upload/v1503160820/CoZ_Icon_DARKBLUE_200x178px_oq0gxm.png"
width="150px"
alt="City of Zion logo">
</p>

<h1 align="center">NEO-local cli</h1>

<p align="center">
Personal blockchain for NEO dApp development!
</p>

This sub-project has the goal of building a binary in Go language, that can be platform agnostic and manage neo-local without the need of Make scripts.
<p>

<h2 align="center">THIS IS A WORK IN PROGRESS. DO NOT USE YET</h2>
79 changes: 79 additions & 0 deletions cli/commands/down.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
package commands

import (
"errors"
"log"

"github.com/CityOfZion/neo-local/cli/services"
"github.com/urfave/cli"

"github.com/docker/docker/api/types"
"github.com/docker/docker/client"
"golang.org/x/net/context"
)

type (
// Down is the CLI command for stopping and removing containers within the
// neo-local stack.
Down struct{}
)

// NewDown creates a new Down.
func NewDown() Down {
return Down{}
}

// ToCommand generates the CLI command struct.
func (d Down) ToCommand() cli.Command {
return cli.Command{
Action: d.action(),
Aliases: []string{"destroy"},
Flags: d.flags(),
Name: "down",
Usage: "Stop and destroy all containers",
}
}

func (d Down) action() func(c *cli.Context) error {
return func(c *cli.Context) error {
ctx := context.Background()
cli, err := client.NewEnvClient()
if err != nil {
return errors.New("Unable to create Docker client")
}

ok := services.CheckDockerRunning(ctx, cli)
if !ok {
return errors.New("Docker is not running")
}

log.Println("Removing containers")

containerReferences, err := services.FetchContainerReferences(ctx, cli)
if err != nil {
return err
}

options := types.ContainerRemoveOptions{
Force: true,
}

for containerName, containerID := range containerReferences {
if containerID == "" {
log.Printf("'%s' container already removed", containerName)
continue
}

log.Printf("'%s' container removed (%s)", containerName, containerID[:10])
if err := cli.ContainerRemove(ctx, containerID, options); err != nil {
return err
}
}

return nil
}
}

func (d Down) flags() []cli.Flag {
return []cli.Flag{}
}
4 changes: 4 additions & 0 deletions cli/commands/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ import (
// GenerateCommandsIndex creates a slice of all the commands that are within
// the CLI.
func GenerateCommandsIndex() []cli.Command {
down := NewDown()
start := NewStart()
status := NewStatus()
stop := NewStop()

return []cli.Command{
down.ToCommand(),
start.ToCommand(),
status.ToCommand(),
stop.ToCommand(),
}
}
Loading

1 comment on commit c5f93ad

@bpetridis
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Man I love this thing - you guys are champions for publishing it - you might want to put the PK in the readme for the stacked wallet. Had to ask around for it: KxDgvEKzgSBPPfuVfw67oPQBSjidEiqTHURKSDL1R7yGaGYAeYnr

But thanks - big big thanks for putting this up here. You guys rock!!!

Please sign in to comment.