You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert

1
5
# PythonESE
2
6
_PythonESE_ is a Python web app to execute logic programs with different solvers, using the [EmbASP](https://github.com/DeMaCS-UNICAL/EmbASP) framework.
3
7
@@ -14,26 +18,106 @@ __*It currently supports only the following formalisms and solvers:*__
14
18
15
19
__*We encourage any feedback, but we do NOT recommend it for production yet.*__
16
20
17
-
##Getting Started (Installation and Usage)
21
+
# Getting Started
18
22
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
19
23
20
-
###Prerequisites
24
+
## Prerequisites
21
25
It requires only [Python®](https://www.python.org) and the [Tornado](https://www.tornadoweb.org) package.
22
26
23
-
###Installing
27
+
## Installing
24
28
Download the [Latest Release](../../releases/latest) of _PythonESE_
25
29
26
-
Install via `pip` or
27
-
30
+
Go to the directory where you downloaded the release and run the following command:
28
31
```
29
32
python setup.py install
30
33
```
31
34
32
35
<!-- Note that on Linux systems you may need to change the _Execute_ permission of the files in the [executables](https://github.com/DeMaCS-UNICAL/PythonESE/executables) folder. -->
33
36
34
-
###Running
37
+
## Running
35
38
Can be invoked using the WebSocket protocol, as explained in the [Wiki of _EmbASPServerExecutor_](https://github.com/DeMaCS-UNICAL/EmbASPServerExecutor/wiki/APIs)
36
39
40
+
# Dockerization
41
+
42
+
This repository provides also Docker containerization for PythonESE.
43
+
Docker enables the encapsulation of the PythonESE Module within a lightweight, portable container, ensuring smooth deployment across various environments.
44
+
45
+
## Getting Started
46
+
47
+
Deploying PythonESE using Docker is straightforward:
48
+
49
+
### Installation
50
+
51
+
Ensure Docker is installed on your system (refer to the [official Docker documentation](https://docs.docker.com/get-docker/) for installation instructions). Then, clone this repository using the following command:
A Docker image is a package that contains all the necessary to run application and it's used to create Docker containers. To create one navigate to the cloned repository directory and build the Docker image using the provided Dockerfile:
60
+
61
+
```bash
62
+
docker build -t python-ese .
63
+
```
64
+
65
+
### Running the Docker Container
66
+
67
+
Once the Docker image is built, you can run a Docker container using the following command:
68
+
69
+
```bash
70
+
docker run -d --network host --mount type=bind,source=[your/path/to/config],target=/app/config --privileged=true python-ese
71
+
```
72
+
73
+
The `--network host` option in the docker run command tells Docker to use the host network for the container. This means the container shares the same network stack as the host and can access network services running on the host directly.
74
+
75
+
The `--mount type=bind, source=[your/path/to/config], target=/app/config` option is used to create a bind mount. A bind mount is a type of mount that allows you to map a host file or directory to a container file or directory (for more information refer to the [official Docker documentation](https://docs.docker.com/storage/bind-mounts/)).
76
+
In this case we use mounts to provide the configuration file to the container.
77
+
78
+
The configuration file is a JSON file that contains the configuration of PythonESE. It must be placed in a directory on the host and the _full_ path to this directory must be specified in the source option of the --mount option. The JSON schema needs also to be in the same directory.
79
+
80
+
For examples on how to create or modify the configuration file refer to the ne xt section. If no configuration file is provided the default configuration will be used.
81
+
82
+
The `--privileged=true` option is used to give the container full access to the host system. This is necessary to run the logic solvers like Clingo in a safe environment using [Bubblewrap](https://github.com/containers/bubblewrap).
83
+
84
+
# Configuration
85
+
86
+
## config.json
87
+
This configuration file contains the settings for the PythonESE module.
88
+
89
+
### Paths
90
+
91
+
This section contains paths to various resources.
92
+
93
+
-`executables`: Paths to different Logic Solvers like `dlv`, `clingo`, `dlv2`, `idlv`, and a timeout script(we use [this](https://github.com/pshved/timeout)).
94
+
-`certificate`: Paths to the certificate and key files for secure communication.
95
+
96
+
### Server Properties
97
+
98
+
This section contains properties related to the server.
99
+
100
+
-`port_number`: The port number on which the server is running.
101
+
-`cors_origins`: A list of origins that are allowed to access the server resources.
102
+
103
+
### Output
104
+
105
+
This section contains properties related to the output of the logic solvers.
106
+
107
+
-`max_chars`: The maximum number of characters that the output can contain.
108
+
109
+
### Limits
110
+
111
+
This section contains limits for the execution of the logic solvers.
112
+
113
+
-`time`: The maximum amount of time (in seconds) that the solver is allowed to run.
114
+
-`memory`: The maximum amount of memory (in kilobytes) that the solver is allowed to use.
115
+
116
+
### Available Options
117
+
118
+
This section contains options that can be passed to the logic solvers. Each solver has its own set of options.
119
+
120
+
37
121
## Built With
38
122
-[EmbASP](https://www.mat.unical.it/calimeri/projects/embasp) - To execute logic programs with different solvers
39
123
-[Tornado](https://www.tornadoweb.org) - To manage the web app
0 commit comments