mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
Merge branch 'master' of ops:nuevo-pilosa
This commit is contained in:
commit
258c990fd1
4 changed files with 116 additions and 0 deletions
75
build.sh
Executable file
75
build.sh
Executable file
|
|
@ -0,0 +1,75 @@
|
|||
PWD=`pwd`
|
||||
NAME=${1:-pilosa}
|
||||
export GOPATH=$PWD/$NAME
|
||||
read -p "This will create a new pilosa environment at $GOPATH (DELETING IF NECESSARY!)! Continue? (y/n) " -n 1 -r
|
||||
if [[ ! $REPLY =~ ^[Yy]$ ]]
|
||||
then
|
||||
echo
|
||||
echo "Aborting!"
|
||||
exit 1
|
||||
fi
|
||||
echo Building environment \"$NAME\" at $GOPATH...
|
||||
|
||||
rm -rf $GOPATH
|
||||
mkdir -p $GOPATH/src
|
||||
git clone git@ops:nuevo-pilosa.git $GOPATH/src/pilosa
|
||||
cd $GOPATH
|
||||
ln -s src/pilosa pilosa
|
||||
|
||||
go get github.com/vube/depman
|
||||
./bin/depman -path=pilosa install
|
||||
|
||||
hg clone -u release https://code.google.com/p/gocircuit src/circuit_src
|
||||
cp -r src/circuit_src/src/circuit src
|
||||
|
||||
export GOCIRCUIT=$GOPATH/src/circuit_src
|
||||
export ZKINCLUDE=$GOCIRCUIT/misc/starter-kit-darwin/zookeeper/include
|
||||
export ZKLIB=$GOCIRCUIT/misc/starter-kit-darwin/zookeeper/lib
|
||||
|
||||
export CGO_CFLAGS="-I$ZKINCLUDE"
|
||||
export CGO_LDFLAGS="$ZKLIB/libzookeeper_mt.a"
|
||||
|
||||
go install circuit/cmd/...
|
||||
go install pilosa/...
|
||||
|
||||
cat << EOF > app.config
|
||||
{
|
||||
"Zookeeper": {
|
||||
"Workers": ["localhost:2181"],
|
||||
"Dir": "/circuit/pilosa"
|
||||
},
|
||||
"Deploy": {
|
||||
"Dir": "$GOPATH",
|
||||
"Worker": "pilosa-worker"
|
||||
},
|
||||
"Build": {
|
||||
"Host": "localhost",
|
||||
"Jail": "{{ \`HOME\` | env }}/.pilosa/build",
|
||||
"ZookeeperInclude": "$ZKINCLUDE",
|
||||
"ZookeeperLib": "$ZKLIB",
|
||||
"Tool": "$GOPATH/bin/4build",
|
||||
"PrefixPath": "",
|
||||
|
||||
"AppRepo": "{rsync}$GOPATH/src/pilosa",
|
||||
"AppSrc": "$GOPATH/src/pilosa",
|
||||
|
||||
"GoRepo": "{rsync}{{ \`GOROOT\` | env }}",
|
||||
"RebuildGo": false,
|
||||
|
||||
"CircuitRepo": "{rsync}$GOCIRCUIT",
|
||||
"CircuitSrc": "/",
|
||||
|
||||
"WorkerPkg": "pilosa/cmd/pilosa-cruncher",
|
||||
"CmdPkgs": ["pilosa/cmd/pilosa-spawn"],
|
||||
"ShipDir": "{{ \`HOME\` | env }}/.pilosa/ship"
|
||||
}
|
||||
}
|
||||
EOF
|
||||
|
||||
cat << EOF > activate
|
||||
export CIR=app.config
|
||||
export GOPATH=$GOPATH
|
||||
export PATH=$GOPATH/bin:\$PATH
|
||||
EOF
|
||||
|
||||
echo Done building environment. Run \". activate\" to set environment variables.
|
||||
21
commands/pilosa-spawn/spawn.go
Normal file
21
commands/pilosa-spawn/spawn.go
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
_ "circuit/load/cmd"
|
||||
"circuit/use/circuit"
|
||||
"pilosa/cruncher"
|
||||
"log"
|
||||
)
|
||||
|
||||
func main() {
|
||||
log.Println("Spawning...")
|
||||
|
||||
retrn, addr, err := circuit.Spawn("localhost", []string{"/cruncher"}, cruncher.App{})
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
log.Println(retrn, addr)
|
||||
|
||||
circuit.Hang()
|
||||
}
|
||||
|
||||
8
commands/pilosa-worker/worker.go
Normal file
8
commands/pilosa-worker/worker.go
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
_ "circuit/load/worker"
|
||||
_ "pilosa/cruncher"
|
||||
)
|
||||
|
||||
func main() {}
|
||||
|
|
@ -4,6 +4,8 @@ import (
|
|||
"pilosa/core"
|
||||
"pilosa/db"
|
||||
"log"
|
||||
"circuit/use/circuit"
|
||||
"time"
|
||||
)
|
||||
|
||||
type Cruncher struct {
|
||||
|
|
@ -53,3 +55,13 @@ func (c *Cruncher) HandleInbox() {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
type App struct{}
|
||||
func (App) Main() {
|
||||
log.Println("Starting cruncher!")
|
||||
time.Sleep(60*time.Second)
|
||||
}
|
||||
|
||||
func init() {
|
||||
circuit.RegisterFunc(App{})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue