Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Travis-CI build & simplify Makefile & fix README #33

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
874632a
Makefile: simplify & standardize
hoijui Mar 23, 2019
fd7aa5f
Travis-CI: define the import path [fix]
hoijui Mar 23, 2019
c29dd1a
Travis-CI: fetch dependencies [fix]
hoijui Mar 23, 2019
897a1e1
README: use Travis-CI for build stati
hoijui Mar 25, 2019
e7a89a1
switch from syscall.Dup2 to syscall.Dup3 to fix aarch64 build
ericvh Apr 1, 2019
fd758a5
Merge remote-tracking branch 'ericvh/master'
hoijui Apr 20, 2019
2ccf482
README: use relative links to images
hoijui Apr 20, 2019
f3cf4e2
use `syscall.Dup3` on "!windows,arm" and Dup2 on other archs [fix]
hoijui Apr 21, 2019
eb42e2d
`syscall.Dup*`: also support ARM64 [fix]
hoijui Apr 21, 2019
06345d0
Travis-CI: compile on Linux, OSX & Cross-compile for Windows (on Linux)
hoijui May 17, 2019
fae3da1
README: fix typo in link
hoijui Apr 27, 2020
3dd1296
change project URL from gocircuit to hoijui
hoijui Apr 27, 2020
c33f807
update to new version of dependency "github.com/urfave/cli" [fix]
hoijui Apr 27, 2020
e3cf465
convert into a go _module_ (and use modules (style) imports)
hoijui May 1, 2020
e8a7832
remove the Makefile (use `go install -v ./cmd/circuit/` instead)
hoijui May 1, 2020
b8a4f78
move packages from repo root to pkg
hoijui May 1, 2020
4230f31
add a TODO (make internal dependencies external)
hoijui May 2, 2020
201074a
lots of fixes, found through unit tests [fix]
hoijui May 3, 2020
9fee2e2
update git ignores
hoijui May 3, 2020
4f32bd1
CI: use GitHub actions instead of Travis-CI
hoijui May 3, 2020
d63834d
remove copied-in dependencies, and rely on the module systems deps
hoijui May 3, 2020
75d90c8
CI: fix documentation glob
hoijui May 3, 2020
c1f43ff
homepage: modernize bagdes
hoijui May 3, 2020
f68f3e7
CI: remove homepage/tutorial; it is part of the homepage, not a bin […
hoijui May 3, 2020
c4557e4
homepage: add go.dev badge
hoijui May 3, 2020
cad06e9
apply "go fmt ./..."
hoijui May 3, 2020
79bcaac
apply automatic, minor tweaks with "golangci-lint run --enable-all --…
hoijui May 3, 2020
ff50226
CI: ... running the tutorials is not that easy! [fix]
hoijui May 3, 2020
b72ebd3
CI: deploy no needs to build
hoijui May 3, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
53 changes: 53 additions & 0 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Build & Test

on: [push, pull_request]

jobs:

build:
name: Build, Test & Run Tutorials
env:
MAIN_SRC_DIR: ./cmd/circuit/
runs-on: ubuntu-latest
steps:

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ^1.13.1
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Get Go dependencies
run: go get -v -t -d ./...

- name: Create the bin directory (will ocntain the built binaries)
run: mkdir -p bin

- name: Build from Go sources
run: go build -v -o bin/circuit "$MAIN_SRC_DIR"

- name: Install the main executable into PATH
run: go install -v "$MAIN_SRC_DIR"

- name: Run Go Tests
run: go test ./...

- name: Build the Tutorials
run: |
go build -v -o bin/tutorial-nodejs-using-mysql ./tutorial/nodejs-using-mysql/start-app/
go build -v -o bin/tutorial-wait-all ./tutorial/wait-all/
go build -v -o bin/tutorial-wait-first ./tutorial/wait-first/
go build -v -o bin/tutorial-watchbot ./tutorial/watchbot/
go build -v -o bin/tutorial-watchbot-with-chan ./tutorial/watchbot-with-chan/

- name: Run GoLang-CI Linter
run: |
# install it into ./bin/
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.25.1
# NOTE the " || true" chould possibly be removed from the below, once we reach 0 warnings
# NOTE " --enable-all" chould possibly be added to the below, to get more warnings
./bin/golangci-lint run || true

50 changes: 50 additions & 0 deletions .github/workflows/deploy-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Deploy Pages

on:
push:
branches: [ master ]
paths:
- 'gocircuit.org/**'

jobs:

build:
name: Build & Deploy Pages
env:
MAIN_SRC_DIR: ./cmd/circuit/
runs-on: ubuntu-latest
steps:

- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ^1.13.1
id: go

- name: Check out code into the Go module directory
uses: actions/checkout@v2

- name: Get Go dependencies
run: go get -v -t -d ./...

- name: Create the bin directory (will ocntain the built binaries)
run: mkdir -p bin

- name: Install the main executable into PATH
run: go install -v "$MAIN_SRC_DIR"

- name: Build the homepage
run: |
go build -v -o bin/build-homepage ./gocircuit.org/build
mkdir -p public
cd public
cp -r ../gocircuit.org/build/* ./
../bin/build-homepage
cd ..

- name: Deploy to the gh-pages branch
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public

5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
.hg
.vagrant
bin
/bin/
/public/
4 changes: 0 additions & 4 deletions .travis.yml

This file was deleted.

9 changes: 0 additions & 9 deletions Makefile

This file was deleted.

39 changes: 20 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Circuit

[![Build Status](https://drone.io/github.com/gocircuit/circuit/status.png)](https://drone.io/github.com/gocircuit/circuit/latest) [![GoDoc](https://godoc.org/github.com/gocircuit/circuit/client?status.png)](https://godoc.org/github.com/gocircuit/circuit/client)
[![Build Status](https://travis-ci.org/hoijui/circuit.svg?branch=master)](https://travis-ci.org/hoijui/circuit)
[![GoDoc](https://godoc.org/github.com/hoijui/circuit?status.png)](https://godoc.org/github.com/hoijui/circuit)

![Engineering role separation.](https://raw.githubusercontent.com/gocircuit/circuit/master/misc/img/3.png)
![Engineering role separation.](img/3.png)

**The CIRCUIT is a new way of thinking. It is deceptively similar to existing software,
while being quite different.**
Expand All @@ -15,7 +16,7 @@ Circuit was designed to enable clear, accountable and safe interface between the
roles in a technology enterprise, ultimately increasing productivity. Engineering role separation
in a typical circuit-based architecture is illustrated above.

![A circuit-managed cloud.](https://raw.githubusercontent.com/gocircuit/circuit/master/misc/img/header.png)
![A circuit-managed cloud.](img/header.png)

Users of circuit are

Expand Down Expand Up @@ -61,7 +62,7 @@ programs in the [CSP](http://en.wikipedia.org/wiki/Communicating_sequential_proc
which allows engineers to encode complex dynamic response behavior, spanning multiple data centers.

Find comparisons to other technologies—like Zookeeper, etcd, CoreOS, raft, Consul, Puppet, Chef, and
so forth—in [the wiki](https://github.com/gocircuit/circuit/wiki).
so forth—in [the wiki](https://github.com/hoijui/circuit/wiki).

## Incomparable but related works

Expand Down Expand Up @@ -99,7 +100,7 @@ Since this video was recorded, the API-via-file-system approach was abandoned
in favor of a simpler command-line tool and a Go client library.

Also take a look at the [faux animated illustration](https://docs.google.com/presentation/d/1nazPJAmYeIvJam9oiA-6euEz3Bo9flRLqsgRU7QAlr0/edit?usp=sharing)
of the [Advanced Tutorial: Watchbot with a back channel](https://github.com/gocircuit/circuit/tree/master/tutorial/watchbot-with-chan).
of the [Advanced Tutorial: Watchbot with a back channel](https://github.com/hoijui/circuit/tree/master/tutorial/watchbot-with-chan).

The circuit is a tool for executing and synchronizing UNIX processes across entire clusters
by means of a command-line tool and a client library.
Expand All @@ -114,7 +115,7 @@ The Circuit comprises one small binary. It can be built for Linux and Darwin.
Given that the [Go Language](http://golang.org) compiler is [installed](http://golang.org/doc/install),
you can build and install the circuit binary with one line:

go get github.com/gocircuit/circuit/cmd/circuit
go get github.com/hoijui/circuit/cmd/circuit

## Run the servers

Expand Down Expand Up @@ -154,7 +155,7 @@ This time, use the `-j` option to tell the new server to join the first one:
You now have two mutually-aware circuit servers, running on two different
hosts in your cluster.

![A circuit system of two hosts.](https://raw.githubusercontent.com/gocircuit/circuit/master/misc/img/servers.png)
![A circuit system of two hosts.](img/servers.png)

You can join any number of additional hosts to the circuit environment in a
similar fashion, even billions. The circuit uses a modern [expander
Expand Down Expand Up @@ -205,14 +206,14 @@ their anchor.

Once the circuit servers are started, you can create, observe and control
circuit elements (i) interactively—using the circuit binary which doubles as a command-line client—as
well as (ii) programmatically—using the circuit Go client package `github.com/gocircuit/circuit/client`.
well as (ii) programmatically—using the circuit Go client package `github.com/hoijui/circuit/client`.
In fact, the circuit command-line tool is simply a front-end for the Go client library.

Clients (the tool or your own) _dial into_ a circuit server in order to
interact with the entire system. All servers are equal citizens in every respect and,
in particular, any one can be used as a choice for dial-in.

![Circuit client connected to a server](https://raw.githubusercontent.com/gocircuit/circuit/master/misc/img/client.png)
![Circuit client connected to a server](img/client.png)

The tool (described in more detail later) is essentially a set of commands that
allow you to traverse the global hierarchical namespace of circuit elements,
Expand All @@ -230,7 +231,7 @@ So, you might get something like this in response

The two root-level anchors correspond to the two circuit servers.

![Circuit servers correspond to root-level anchors](https://raw.githubusercontent.com/gocircuit/circuit/master/misc/img/serveranchor.png)
![Circuit servers correspond to root-level anchors](img/serveranchor.png)

### Pointing the tool to your circuit cluster ###

Expand Down Expand Up @@ -266,7 +267,7 @@ A list of available tool commands is shown on the help screen
circuit help

A more detailed explanation of their meaning and function can be found
in the documentation of the client package, `github.com/gocircuit/client`.
in the documentation of the client package, `github.com/hoijui/circuit/client`.

### Example: Make a process ###

Expand All @@ -286,7 +287,7 @@ Run a new `ls` process:
}
EOF

![Process elements execute OS processes on behalf of the user](https://raw.githubusercontent.com/gocircuit/circuit/master/misc/img/mkproc.png)
![Process elements execute OS processes on behalf of the user](img/mkproc.png)

See what happened:

Expand Down Expand Up @@ -334,7 +335,7 @@ To create and execute a new docker container, using the tool:
Most of these fields can be omitted analogously to their command-line option counterparts
of the `docker` command-line tool.

![Docker elements are like processes](https://raw.githubusercontent.com/gocircuit/circuit/master/misc/img/mkdkr.png)
![Docker elements are like processes](img/mkdkr.png)

The remaining docker element commands are identical to those for processes:
`stdin`, `stdout`, `stderr`, `peek` and `wait`. In one exception, `peek` will return
Expand All @@ -356,7 +357,7 @@ let's create a channel on `X88550014d4c82e4d`:
The last argument of this line is the channel buffer capacity,
analogously to the way channels are created in Go.

![Channel elements reside in the memory of a circuit server](https://raw.githubusercontent.com/gocircuit/circuit/master/misc/img/mkchan.png)
![Channel elements reside in the memory of a circuit server](img/mkchan.png)

Verify the channel was created:

Expand Down Expand Up @@ -477,11 +478,11 @@ Take a look, for instance, at the two “watchbot” tutorials which demonstrate
how to implement a semi-resilient self-sustained mechanism within
a cluster. Find the simpler one here

https://github.com/gocircuit/circuit/tree/master/tutorial/watchbot
https://github.com/hoijui/circuit/tree/master/tutorial/watchbot

And the more elaborate one, which demonstrate use of channels, here

https://github.com/gocircuit/circuit/tree/master/tutorial/watchbot-with-chan
https://github.com/hoijui/circuit/tree/master/tutorial/watchbot-with-chan

## Security ##

Expand Down Expand Up @@ -522,20 +523,20 @@ Ask questions to [The Circuit User Group](https://groups.google.com/forum/#!foru

The Go client for writing circuit apps is package

github.com/gocircuit/circuit/client
github.com/hoijui/circuit/client

The public interface of this package is self-contained. Other
packages in the circuit repo are internal.

Tutorials can be found within the client package directory

github.com/gocircuit/circuit/client/tutorial
github.com/hoijui/circuit/client/tutorial

Additionally, the circuit binary directory contains the implementation
of the circuit tool, which is itself built using the client and is another
comprehensive example of a circuit app. It can be found in

github.com/gocircuit/circuit/cmd/circuit
github.com/hoijui/circuit/cmd/circuit

To stay up to date with new developments, documentation and articles, follow
The Circuit Project on Twitter [@gocircuit](https://twitter.com/gocircuit) or
Expand Down
1 change: 1 addition & 0 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ test coverage
job scheduler ala mesos
add mutex element
tty element; interactive shell
use external dependencies instead of local ./github.com/... and ./gocircuit.org/...
18 changes: 9 additions & 9 deletions cmd/circuit/chan.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import (
"os"
"strconv"

"github.com/gocircuit/circuit/client"
"github.com/hoijui/circuit/pkg/client"
"github.com/pkg/errors"

"github.com/urfave/cli"
"github.com/urfave/cli/v2"
)

// circuit mkchan /X1234/hola/charlie 0
Expand All @@ -29,12 +29,12 @@ func mkchan(x *cli.Context) (err error) {

c := dial(x)
args := x.Args()
if len(args) != 2 {
if x.NArg() != 2 {
return errors.New("mkchan needs an anchor and a capacity arguments")
}
w, _ := parseGlob(args[0])
w, _ := parseGlob(args.Get(0))
a := c.Walk(w)
n, err := strconv.Atoi(args[1])
n, err := strconv.Atoi(args.Get(1))
if err != nil || n < 0 {
return errors.New("second argument to mkchan must be a non-negative integral capacity")
}
Expand All @@ -53,10 +53,10 @@ func send(x *cli.Context) (err error) {

c := dial(x)
args := x.Args()
if len(args) != 1 {
if x.NArg() != 1 {
return errors.New("send needs one anchor argument")
}
w, _ := parseGlob(args[0])
w, _ := parseGlob(args.Get(0))
u, ok := c.Walk(w).Get().(client.Chan)
if !ok {
return errors.New("not a channel")
Expand All @@ -74,10 +74,10 @@ func send(x *cli.Context) (err error) {
func clos(x *cli.Context) (err error) {
c := dial(x)
args := x.Args()
if len(args) != 1 {
if x.NArg() != 1 {
return errors.New("close needs one anchor argument")
}
w, _ := parseGlob(args[0])
w, _ := parseGlob(args.Get(0))
u, ok := c.Walk(w).Get().(client.Chan)
if !ok {
return errors.New("not a channel")
Expand Down
Loading