Skip to content

Commit 2af149d

Browse files
committed
Add sandbox to README
1 parent f045a0d commit 2af149d

File tree

1 file changed

+42
-7
lines changed

1 file changed

+42
-7
lines changed

README.md

Lines changed: 42 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,31 +90,66 @@ For setting up a local test enviorment with database support, please refer to th
9090
You can start using our examples:
9191

9292
* [Clone this repository](#clone-this-repository)
93+
* [Use our sandbox in your browser (Docker required)](#use-our-sandbox-in-your-browser-docker-required)
9394

9495

95-
## Prerequisites
96+
## Clone this repository
97+
Clone this repository and import it in your favourite IDE.
98+
99+
### Prerequisites
96100

97101
* Python installed
98102
* Please check **requirements.txt**
99103
* Working Docker environment for local TourOptimizer instance
100104

101105

102-
## Clone this repository
103-
Clone this repository and import it in your favourite IDE.
104-
105-
106-
## Install necessary files
106+
### Install necessary files
107107
You can call (from the main folder):
108108

109109
```bash
110110
python setup.py install
111111
```
112112

113-
## Run the examples
113+
### Run the examples
114114

115115
Run a file from the **examples** subfolders.
116116

117117

118+
## Use our sandbox in your browser (Docker required)
119+
If you want to get started without the hassle of installing Java, Maven and an IDE, we provide a sandbox. The sandbox is based on [code-server](https://github.com/cdr/code-server) and can be used inside your browser, and the interface itself is based on Visual Code. The sandbox is available via DockerHub ([here](https://hub.docker.com/r/dnaevolutions/jopt_py_example_server)). You have to host the sandbox in your Docker environment (Please provide at least 2-4Gb of Ram and 2 Cores). You can pull the sandbox from our DockerHub account (The Dockerfile for creating the sandbox is included in this repository). The latest version of our examples is cloned by default on launching the Docker container, and you can start testing JOpt-REST right away.
120+
121+
122+
### Starting the sandbox and persist your changes
123+
You must mount a volume to which the examples of this project are downloaded on the container's startup. After re-launching the container, the latest version of our examples is only cloned if the folder is not already existing, keeping your files safe from being overridden.
124+
125+
Launching a sandbox and mount your current directory ('$PWD') or any other directory you want:
126+
127+
```
128+
docker run -it -d --name jopt-py-rest-examples -p 127.0.0.1:8033:8080 -v "$PWD/:/home/coder/project" dnaevolutions/jopt_py_example_server:latest
129+
```
130+
131+
### Using the sandbox
132+
133+
After starting the container, you can open [http://localhost:8043/](http://localhost:8033) with your browser and login with the password:
134+
135+
```
136+
jopt
137+
```
138+
139+
### Common problems: ###
140+
141+
- If you see the an error like this:
142+
143+
```
144+
urllib3.exceptions.MaxRetryError: HTTPConnectionPool(host='localhost', port=8081): Max retries exceeded with url: /healthStatus (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fc7c86ac1d0>: Failed to establish a new connection: [Errno 111] Connection refused'))
145+
```
146+
147+
You are trying to connect to a local JOpt server but have not adjusted the endpoint. Remember, the sandbox is a docker container and you need to connect to it via the endpoint `http://host.docker.internal:8081` instead of ~`http://localhost:8081`~. You can run `tour_optimizer_example_from_docker.py` from the package `examples.optimize` where `Endpoints.LOCAL_SWAGGER_TOUROPTIMIZER_FROM_DOCKER_URL` is used instead of `Endpoints.LOCAL_SWAGGER_TOUROPTIMIZER_URL`.
148+
149+
150+
---
151+
152+
118153
## Why use JOpt products from DNA Evolutions?
119154
JOpt is a flexible routing optimization engine written in Java, allowing to solve tour-optimization problems that are highly restricted. For example, regarding time windows, skills, and even mandatory constraints can be applied.
120155

0 commit comments

Comments
 (0)