blob: f926693678c5c4fa53e7cbd515ac37b070c0996f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
# moon_engine
## Installation
If you want a stable version:
```bash
sudo python -m pip install moon_engine
```
If you want a development version:
```bash
ARTIFACTORY=https://artifactory-iva.si.francetelecom.fr/artifactory/api/pypi/python-virt-orange-product-devops/simple
sudo python -m pip install --pre moon_engine -i $ARTIFACTORY
```
Use it at your own risk, this is an unstable version.
If you want to be in development mode, and get the code:
```bash
git clone git@gitlab.forge.orange-labs.fr:moon/moon_utilities.git
cd moon_utilities
sudo pip install -e .
cd ..
git clone git@gitlab.forge.orange-labs.fr:moon/moon_cache.git
cd moon_cache
sudo pip install -e .
cd ..
git clone git@gitlab.forge.orange-labs.fr:moon/moon_engine.git
cd moon_engine
sudo pip install -e .
```
## Configuration
You need to create 3 configuration files.
### config.cfg::
# configuration for Gunicorn
bind = "127.0.0.1:8081"
workers = 2
# configuration for moon_engine
moon = "moon.yaml"
### moon.yaml (feel free to update the configuration file to your need...)::
type: "pipeline"
uuid:
manager_url: ""
incremental_updates: false
api_token:
data: policy.json
debug: true
management:
password: admin
url: http://127.0.0.1:8000
user: admin
token_file: moon_engine_users.json
orchestration:
driver: moon_engine.plugins.pyorchestrator
connection: local
port: 20000...20100
config_dir: /tmp
authorization:
driver: moon_engine.plugins.authz
plugins:
directory: /tmp
logging:
version: 1
formatters:
brief:
format: "%(levelname)s %(name)s %(message)-30s"
custom:
format: "%(asctime)-15s %(levelname)s %(name)s %(message)s"
handlers:
console:
class : logging.StreamHandler
formatter: custom
level : INFO
stream : ext://sys.stdout
file:
class : logging.handlers.RotatingFileHandler
formatter: custom
level : DEBUG
filename: /tmp/moon_engine.log
maxBytes: 1048576
backupCount: 3
loggers:
moon:
level: DEBUG
handlers: [console, file]
propagate: no
root:
level: ERROR
handlers: [console]
### policy.json
This file contains all data that will be imported in the Engine. As we cannot update the cache after the creation of the Engine, all data must be in this file.
Example files lie in the conf directory.
## Web server execution
Execution when library is installed:
For a development server:
```bash
hug -m moon_engine.server config.cfg
```
For a production server:
```bash
gunicorn moon_engine.server:__hug_wsgi__ -c config.cfg
```
or
```bash
moon_engine start config.cfg
```
If library is not installed:
```bash
gunicorn moon_engine/server:__hug_wsgi__ -c config.cfg
```
This will install an autonomous engine server.
If you need to connect to a Manager, you must update the `moon.yaml` accordingly.
|