deb http://repo.reverbrain.com/precise/ current/amd64/ deb http://repo.reverbrain.com/precise/ current/all/
curl -O http://repo.reverbrain.com/REVERBRAIN.GPG sudo apt-key add REVERBRAIN.GPG
apt-get update apt-cache search cocaine
sudo apt-get install elliptics=2.24.14.31 elliptics-client=2.24.14.31 mkdir /tmp/history/ && mkdir /tmp/root cp /usr/share/doc/elliptics/examples/ioserv.conf ./tst_ioserv.conf
group = 1 addr = localhost:1025:2-0 192.168.50.201:1025:2-1 // IP indexes_shard_count = 16
dnet_ioserv -c tst_ioserv.conf
sudo apt-get install cocaine-runtime libcocaine-core2 libcocaine-plugin-docker2 libcocaine-plugin-elliptics=2.24.14.31 elliptics-client=2.24.14.31
sudo apt-get install msgpack-python
sudo pip install cocaine-tools
curl -s https://get.docker.io/ubuntu/ | sudo sh
sudo service cocaine-runtime stop
{ "version": 2, "paths": { "plugins": "/usr/lib/cocaine", "runtime": "/var/run/cocaine" }, "services": { "logging": { "type": "logging" }, "storage": { "type": "storage", "args": { "backend": "core" } }, "node": { "type": "node", "args": { "runlist": "default" } } }, "storages": { "core": { "type": "files", "args": { "path": "/var/lib/cocaine" } }, "cache": { "type": "files", "args": { "path": "/var/cache/cocaine" } } }, "loggers": { "core": { "type": "syslog", "args": { "identity": "cocaine", "verbosity": "info" } } } }
"network" : { "group": "224.168.2.9" }, "services": { ... }
"storage": { "type": "elliptics" }, "storages" : { "core": { "type": "elliptics", "args": { "nodes" : { "192.168.50.201" : 1025 }, "io-thread-num" : 8, "wait-timeout" : 30, "check-timeout" : 60, "net-thread-num" : 8, "groups" : [1], "verbosity" : 2 } } }
/etc/default/cocaine-runtime
:cocaine-tool info
. The output of this command does not shake the imagination, but remember it - it will change very soon. git clone git@github.com:cocaine/cocaine-framework-python.git -b v0.11 cd cocaine-framework-python/examples/flask/
{ "slave": "main.py" }
cocaine-tool app upload --name example
sudo apt-get install python-flask
{}
. In this case, the default settings are used. cocaine-tool app start --name example --profile default
cocaine-tool info
command has changed. It shows which applications are running on this node and statistics about applications. #!/usr/bin/env python from cocaine.services import Service app = Service("example") print(app.enqueue("write", "DATA").get()) print(app.enqueue("read", "DATA").get())
sudo docker run -p 5000:5000 registry
curl "http://192.168.50.4:5000/_ping"
{ "queue-limit": 1000, "pool-limit": 10, "isolate": { "type": "docker", "args": { "memory_limit": 1000000000, "endpoint": "unix:///var/run/docker.sock", "registry": "registry.cloud.net:5000", "cpu_shares": 0 } }, "concurrency": 200 }
cocaine-tool profile upload --name docker-profile --profile=docker-profile.json
sudo cocaine-tool app upload --docker=unix:///var/run/docker.sock --registry=registry.cloud.net:5000 --manifest manifest-docker.json --name example-docker --timeout 20000
sudo apt-get install cocaine-runtime libcocaine-core2 libcocaine-plugin-ipvs2 libcocaine-plugin-elliptics=2.24.14.31 elliptics-client=2.24.14.31
"network": { "group": "224.168.2.9", "gateway": { "type": "ipvs" // adhoc } }, "services"...
sudo service cocane-runtime restart
should start the process: cocaine /usr/bin/cocaine-runtime --daemonize --configuration /etc/cocaine/cocaine-gateway.conf --pidfile /var/run/cocaine/runtime.pid
apt-get install cocaine-native-proxy
{ "endpoints": [ "0.0.0.0:8080" ], "backlog": 2048, "threads": 2, "application": { "locators": ["192.168.50.103:10053"], "service_pool": 5, "reconnect_timeout": 180, "request_timeout": 5 } }
#!/usr/bin/env python from cocaine.services import Service app = Service("example", host="192.168.50.103") print(app.enqueue("write", "DATA").get()) print(app.enqueue("read", "DATA").get())
///tail?arg=1&args=2. URL . /tail?arg=1&args=2 . .
X-Cocaine-Service, X-Cocaine-Event . nginx .
, :
curl "http://localhost:8080/read" -H "X-Cocaine-Service: example" -H "X-Cocaine-Event: http" curl "http://localhost:8080/example/http/read"
. , . , . . . , , (, 5%). . . , , .
. example , exampleGroup . example 1000 . .
service/locator: adding group 'exampleGroup'

exampleGroup . , , app.py hello:
@app.route('/') def hello(name=None): return "HELLO! I'm version #2"
, example2 .

curl "http://localhost:8080/exampleGroup/http/"
, . example2 0 , HTTP-proxy . , HTTP-proxy . , .
, , . , Cocaine , c, . .
///tail?arg=1&args=2. URL . /tail?arg=1&args=2
. .
X-Cocaine-Service, X-Cocaine-Event . nginx .
, :
curl "http://localhost:8080/read" -H "X-Cocaine-Service: example" -H "X-Cocaine-Event: http" curl "http://localhost:8080/example/http/read"
. , . , . . . , , (, 5%). . . , , .
. example , exampleGroup . example 1000 . .
service/locator: adding group 'exampleGroup'

exampleGroup . , , app.py hello:
@app.route('/') def hello(name=None): return "HELLO! I'm version #2"
, example2 .

curl "http://localhost:8080/exampleGroup/http/"
, . example2 0 , HTTP-proxy . , HTTP-proxy . , .
, , . , Cocaine , c, . .
///tail?arg=1&args=2. URL . /tail?arg=1&args=2
. .
X-Cocaine-Service, X-Cocaine-Event . nginx .
, :
curl "http://localhost:8080/read" -H "X-Cocaine-Service: example" -H "X-Cocaine-Event: http" curl "http://localhost:8080/example/http/read"
. , . , . . . , , (, 5%). . . , , .
. example , exampleGroup . example 1000 . .
service/locator: adding group 'exampleGroup'
exampleGroup . , , app.py hello:
@app.route('/') def hello(name=None): return "HELLO! I'm version #2"
, example2 .
curl "http://localhost:8080/exampleGroup/http/"
, . example2 0 , HTTP-proxy . , HTTP-proxy . , .
, , . , Cocaine , c, . .
///tail?arg=1&args=2. URL . /tail?arg=1&args=2
. .
X-Cocaine-Service, X-Cocaine-Event . nginx .
, :
curl "http://localhost:8080/read" -H "X-Cocaine-Service: example" -H "X-Cocaine-Event: http" curl "http://localhost:8080/example/http/read"
. , . , . . . , , (, 5%). . . , , .
. example , exampleGroup . example 1000 . .
service/locator: adding group 'exampleGroup'

exampleGroup . , , app.py hello:
@app.route('/') def hello(name=None): return "HELLO! I'm version #2"
, example2 .

curl "http://localhost:8080/exampleGroup/http/"
, . example2 0 , HTTP-proxy . , HTTP-proxy . , .
, , . , Cocaine , c, . .
///tail?arg=1&args=2. URL . /tail?arg=1&args=2
. .
X-Cocaine-Service, X-Cocaine-Event . nginx .
, :
curl "http://localhost:8080/read" -H "X-Cocaine-Service: example" -H "X-Cocaine-Event: http" curl "http://localhost:8080/example/http/read"
. , . , . . . , , (, 5%). . . , , .
. example , exampleGroup . example 1000 . .
service/locator: adding group 'exampleGroup'

exampleGroup . , , app.py hello:
@app.route('/') def hello(name=None): return "HELLO! I'm version #2"
, example2 .

curl "http://localhost:8080/exampleGroup/http/"
, . example2 0 , HTTP-proxy . , HTTP-proxy . , .
, , . , Cocaine , c, . .
///tail?arg=1&args=2. URL . /tail?arg=1&args=2
. .
X-Cocaine-Service, X-Cocaine-Event . nginx .
, :
curl "http://localhost:8080/read" -H "X-Cocaine-Service: example" -H "X-Cocaine-Event: http" curl "http://localhost:8080/example/http/read"
. , . , . . . , , (, 5%). . . , , .
. example , exampleGroup . example 1000 . .
service/locator: adding group 'exampleGroup'

exampleGroup . , , app.py hello:
@app.route('/') def hello(name=None): return "HELLO! I'm version #2"
, example2 .

curl "http://localhost:8080/exampleGroup/http/"
, . example2 0 , HTTP-proxy . , HTTP-proxy . , .
, , . , Cocaine , c, . .
///tail?arg=1&args=2. URL . /tail?arg=1&args=2
. .
X-Cocaine-Service, X-Cocaine-Event . nginx .
, :
curl "http://localhost:8080/read" -H "X-Cocaine-Service: example" -H "X-Cocaine-Event: http" curl "http://localhost:8080/example/http/read"
. , . , . . . , , (, 5%). . . , , .
. example , exampleGroup . example 1000 . .
service/locator: adding group 'exampleGroup'
exampleGroup . , , app.py hello:
@app.route('/') def hello(name=None): return "HELLO! I'm version #2"
, example2 .
curl "http://localhost:8080/exampleGroup/http/"
, . example2 0 , HTTP-proxy . , HTTP-proxy . , .
, , . , Cocaine , c, . .
///tail?arg=1&args=2. URL . /tail?arg=1&args=2
. .
X-Cocaine-Service, X-Cocaine-Event . nginx .
, :
curl "http://localhost:8080/read" -H "X-Cocaine-Service: example" -H "X-Cocaine-Event: http" curl "http://localhost:8080/example/http/read"
. , . , . . . , , (, 5%). . . , , .
. example , exampleGroup . example 1000 . .
service/locator: adding group 'exampleGroup'

exampleGroup . , , app.py hello:
@app.route('/') def hello(name=None): return "HELLO! I'm version #2"
, example2 .

curl "http://localhost:8080/exampleGroup/http/"
, . example2 0 , HTTP-proxy . , HTTP-proxy . , .
, , . , Cocaine , c, . .
///tail?arg=1&args=2. URL . /tail?arg=1&args=2
. .
X-Cocaine-Service, X-Cocaine-Event . nginx .
, :
curl "http://localhost:8080/read" -H "X-Cocaine-Service: example" -H "X-Cocaine-Event: http" curl "http://localhost:8080/example/http/read"
. , . , . . . , , (, 5%). . . , , .
. example , exampleGroup . example 1000 . .
service/locator: adding group 'exampleGroup'
exampleGroup . , , app.py hello:
@app.route('/') def hello(name=None): return "HELLO! I'm version #2"
, example2 .
curl "http://localhost:8080/exampleGroup/http/"
, . example2 0 , HTTP-proxy . , HTTP-proxy . , .
, , . , Cocaine , c, . .
///tail?arg=1&args=2. URL . /tail?arg=1&args=2
. .
X-Cocaine-Service, X-Cocaine-Event . nginx .
, :
curl "http://localhost:8080/read" -H "X-Cocaine-Service: example" -H "X-Cocaine-Event: http" curl "http://localhost:8080/example/http/read"
. , . , . . . , , (, 5%). . . , , .
. example , exampleGroup . example 1000 . .
service/locator: adding group 'exampleGroup'

exampleGroup . , , app.py hello:
@app.route('/') def hello(name=None): return "HELLO! I'm version #2"
, example2 .

curl "http://localhost:8080/exampleGroup/http/"
, . example2 0 , HTTP-proxy . , HTTP-proxy . , .
, , . , Cocaine , c, . .
///tail?arg=1&args=2. URL . /tail?arg=1&args=2
. .
X-Cocaine-Service, X-Cocaine-Event . nginx .
, :
curl "http://localhost:8080/read" -H "X-Cocaine-Service: example" -H "X-Cocaine-Event: http" curl "http://localhost:8080/example/http/read"
. , . , . . . , , (, 5%). . . , , .
. example , exampleGroup . example 1000 . .
service/locator: adding group 'exampleGroup'
exampleGroup . , , app.py hello:
@app.route('/') def hello(name=None): return "HELLO! I'm version #2"
, example2 .
curl "http://localhost:8080/exampleGroup/http/"
, . example2 0 , HTTP-proxy . , HTTP-proxy . , .
, , . , Cocaine , c, . .
///tail?arg=1&args=2. URL . /tail?arg=1&args=2
. .
X-Cocaine-Service, X-Cocaine-Event . nginx .
, :
curl "http://localhost:8080/read" -H "X-Cocaine-Service: example" -H "X-Cocaine-Event: http" curl "http://localhost:8080/example/http/read"
. , . , . . . , , (, 5%). . . , , .
. example , exampleGroup . example 1000 . .
service/locator: adding group 'exampleGroup'

exampleGroup . , , app.py hello:
@app.route('/') def hello(name=None): return "HELLO! I'm version #2"
, example2 .

curl "http://localhost:8080/exampleGroup/http/"
, . example2 0 , HTTP-proxy . , HTTP-proxy . , .
, , . , Cocaine , c, . .
///tail?arg=1&args=2. URL . /tail?arg=1&args=2
. .
X-Cocaine-Service, X-Cocaine-Event . nginx .
, :
curl "http://localhost:8080/read" -H "X-Cocaine-Service: example" -H "X-Cocaine-Event: http" curl "http://localhost:8080/example/http/read"
. , . , . . . , , (, 5%). . . , , .
. example , exampleGroup . example 1000 . .
service/locator: adding group 'exampleGroup'

exampleGroup . , , app.py hello:
@app.route('/') def hello(name=None): return "HELLO! I'm version #2"
, example2 .

curl "http://localhost:8080/exampleGroup/http/"
, . example2 0 , HTTP-proxy . , HTTP-proxy . , .
, , . , Cocaine , c, . .
///tail?arg=1&args=2. URL . /tail?arg=1&args=2
. .
X-Cocaine-Service, X-Cocaine-Event . nginx .
, :
curl "http://localhost:8080/read" -H "X-Cocaine-Service: example" -H "X-Cocaine-Event: http" curl "http://localhost:8080/example/http/read"
. , . , . . . , , (, 5%). . . , , .
. example , exampleGroup . example 1000 . .
service/locator: adding group 'exampleGroup'

exampleGroup . , , app.py hello:
@app.route('/') def hello(name=None): return "HELLO! I'm version #2"
, example2 .

curl "http://localhost:8080/exampleGroup/http/"
, . example2 0 , HTTP-proxy . , HTTP-proxy . , .
, , . , Cocaine , c, . .
Source: https://habr.com/ru/post/214069/
All Articles