adding example on readme
This commit is contained in:
parent
021fe3b7b5
commit
b8d5c1dca1
1 changed files with 118 additions and 1 deletions
119
README.md
119
README.md
|
@ -71,10 +71,127 @@ Prepare our environment
|
|||
# result at
|
||||
ls docs/build/
|
||||
|
||||
# Debian package :
|
||||
# Debian package:
|
||||
|
||||
cd opennel-pymanager
|
||||
make builddeb
|
||||
# result at
|
||||
ls ../python3-opennel-pymanager_*_all.deb
|
||||
|
||||
Example:
|
||||
=======================
|
||||
|
||||
# Clone
|
||||
|
||||
``` sh
|
||||
git clone https://git.khaganat.net/khaganat/mmorpg_khanat/opennel-pymanager.git
|
||||
cd opennel-pymanager
|
||||
git checkout develop
|
||||
```
|
||||
|
||||
# Create workdir
|
||||
|
||||
``` sh
|
||||
mkdir temp
|
||||
cd temp
|
||||
```
|
||||
|
||||
# Create certificat
|
||||
|
||||
``` sh
|
||||
../pymanager/certificate.py
|
||||
```
|
||||
|
||||
# Server Configuration
|
||||
|
||||
Example configuration with TLS1.2.
|
||||
We have two program (one command:sleep -> stop after 10s, command:simulate -> daemon (emulate khanat process)
|
||||
|
||||
``` sh
|
||||
cat << EOF > server.cfg
|
||||
[config:server]
|
||||
port = 8000
|
||||
keyfile = ca/appli/private/serverkey.pem
|
||||
certfile = ca/appli/certs/servercert.pem
|
||||
ca_cert = ca/appli/certs/cachaincert.pem
|
||||
authentification = no
|
||||
[command:sleep]
|
||||
command = sleep 10
|
||||
[command:simulate]
|
||||
command = ../tests/simulate_program.py
|
||||
EOF
|
||||
```
|
||||
|
||||
# Client Configuration
|
||||
``` sh
|
||||
cat << EOF > client.cfg
|
||||
[config:client]
|
||||
port = 8000
|
||||
keyfile = ca/appli/private/clientkey.pem
|
||||
certfile = ca/appli/certs/clientcert.pem
|
||||
ca_cert = ca/appli/certs/cachaincert.pem
|
||||
address = localhost
|
||||
EOF
|
||||
```
|
||||
|
||||
# Start Manager
|
||||
``` sh
|
||||
../pymanager/manager.py -c server.cfg --log DEBUG
|
||||
```
|
||||
if you want, you can launch like deamon
|
||||
|
||||
``` sh
|
||||
nohup ../pymanager/manager.py -c server.cfg --log DEBUG &
|
||||
```
|
||||
|
||||
# Launch command (with client)
|
||||
|
||||
## STATUS
|
||||
``` sh
|
||||
../pymanager/client.py -c client.cfg --log DEBUG --program 'command:simulate' --command STATUS
|
||||
```
|
||||
## START
|
||||
``` sh
|
||||
../pymanager/client.py -c client.cfg --log DEBUG --program 'command:simulate' --command START
|
||||
```
|
||||
## STATUS
|
||||
``` sh
|
||||
../pymanager/client.py -c client.cfg --log DEBUG --program 'command:simulate' --command STATUS
|
||||
```
|
||||
## STDIN
|
||||
Send command
|
||||
``` sh
|
||||
../pymanager/client.py -c client.cfg --log DEBUG --program 'command:simulate' --command STDIN --stdin="help all"
|
||||
```
|
||||
## STDOUT
|
||||
Read output
|
||||
``` sh
|
||||
../pymanager/client.py -c client.cfg --log DEBUG --program 'command:simulate' --command STDOUT
|
||||
```
|
||||
## STOP
|
||||
``` sh
|
||||
../pymanager/client.py -c client.cfg --log DEBUG --program 'command:simulate' --command STOP
|
||||
```
|
||||
## STARTALL
|
||||
``` sh
|
||||
../pymanager/client.py -c client.cfg --log DEBUG --program 'command:simulate' --command STARTALL
|
||||
```
|
||||
## STATUSALL
|
||||
``` sh
|
||||
../pymanager/client.py -c client.cfg --log DEBUG --program 'command:simulate' --command STATUSALL
|
||||
```
|
||||
## STOPALL
|
||||
``` sh
|
||||
../pymanager/client.py -c client.cfg --log DEBUG --program 'command:simulate' --command STOPALL
|
||||
```
|
||||
## WITH CURL
|
||||
```sh
|
||||
curl -k --tlsv1.2 --cacert ca/appli/certs/cachaincert.pem --cert ca/appli/certs/clientcert.pem --key ca/appli/private/clientkey.pem -XGET "https://localhost:8000/STATUSALL"
|
||||
```
|
||||
```sh
|
||||
curl -k --tlsv1.2 --cacert ca/appli/certs/cachaincert.pem --cert ca/appli/certs/clientcert.pem --key ca/appli/private/clientkey.pem --header "content-type: application/json" -d '{"name": "command:simulate"}' -XGET "https://localhost:8000/STATUS"
|
||||
```
|
||||
## SHUTDOWN
|
||||
``` sh
|
||||
../pymanager/client.py -c client.cfg --log DEBUG --program 'command:simulate' --command SHUTDOWN
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue