Skip to content

Commit 5b42fdb

Browse files
Merge pull request #9 from DeMaCS-UNICAL/hotfix/updating-readme
Updating readme
2 parents 58fe70c + fe6f99f commit 5b42fdb

File tree

1 file changed

+90
-6
lines changed

1 file changed

+90
-6
lines changed

README.md

Lines changed: 90 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/DeMaCS-UNICAL/PythonESE/master/LICENSE)
2+
[![GitHub release](https://img.shields.io/github/release/DeMaCS-UNICAL/PythonESE.svg)](https://github.com/DeMaCS-UNICAL/PythonESE/releases/latest)
3+
[![GitHub issues](https://img.shields.io/github/issues/DeMaCS-UNICAL/PythonESE.svg)](https://github.com/DeMaCS-UNICAL/PythonESE/issues)
4+
![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/DeMaCS-UNICAL/PythonESE)
15
# PythonESE
26
_PythonESE_ is a Python web app to execute logic programs with different solvers, using the [EmbASP](https://github.com/DeMaCS-UNICAL/EmbASP) framework.
37

@@ -14,26 +18,106 @@ __*It currently supports only the following formalisms and solvers:*__
1418

1519
__*We encourage any feedback, but we do NOT recommend it for production yet.*__
1620

17-
## Getting Started (Installation and Usage)
21+
# Getting Started
1822
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
1923

20-
### Prerequisites
24+
## Prerequisites
2125
It requires only [Python®](https://www.python.org) and the [Tornado](https://www.tornadoweb.org) package.
2226

23-
### Installing
27+
## Installing
2428
Download the [Latest Release](../../releases/latest) of _PythonESE_
2529

26-
Install via `pip` or
27-
30+
Go to the directory where you downloaded the release and run the following command:
2831
```
2932
python setup.py install
3033
```
3134

3235
<!-- 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. -->
3336

34-
### Running
37+
## Running
3538
Can be invoked using the WebSocket protocol, as explained in the [Wiki of _EmbASPServerExecutor_](https://github.com/DeMaCS-UNICAL/EmbASPServerExecutor/wiki/APIs)
3639

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:
52+
53+
```bash
54+
git clone https://github.com/DeMaCS-UNICAL/PythonESE.git
55+
```
56+
57+
### Building the Docker Image
58+
59+
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+
37121
## Built With
38122
- [EmbASP](https://www.mat.unical.it/calimeri/projects/embasp) - To execute logic programs with different solvers
39123
- [Tornado](https://www.tornadoweb.org) - To manage the web app

0 commit comments

Comments
 (0)