1
0
mirror of https://github.com/avatao-content/test-tutorial-framework synced 2024-12-05 02:31:33 +00:00

Remove lies from docs and update info

This commit is contained in:
Kristóf Tóth 2018-07-10 17:42:08 +02:00
parent 98f297cff2
commit c9439f547b

View File

@ -93,7 +93,7 @@ To do this simply issue `BASEIMAGE_ONLY=version bash -c "$(curl -fsSL https://gi
The repository of a tutorial-framework based challenge is quite similar to a regular challenge.
The project root should look something like this:
```text
```
your_repo
├── solvable
│ └── [TFW based Docker image]
@ -112,7 +112,7 @@ From now on we are going to focus on the `solvable` image.
Let us take a closer look on `solvable`:
```text
```
solvable
├── Dockerfile
├── nginx webserver configurations
@ -134,7 +134,7 @@ This means that in order to listen on more than a single port we must use a reve
Any `.conf` files in `solvable/nginx/` will be automatically included in the nginx configuration.
In case you want to serve a website or service you must proxy it through `TFW_PUBLIC_PORT`.
This is really easy: just create a config file in `solvable/nginx/` similar to this one:
```text
```
location /yoururl {
proxy_pass http://127.0.0.1:3333;
}
@ -157,7 +157,7 @@ You can even configure your processes to start with the container by including `
To run your own webservice for instance you need to create a config file in `solvable/supervisor/` similar to this one:
```text
```
[program:yourprogram]
user=user
directory=/home/user/example/
@ -183,17 +183,12 @@ Refer to the example in this repo.
This folder contains the source code of a server running TFW and an other server running our event handlers.
Note that this is not a part of the framework by any means, these are just simple examples.
```text
solvable/src
├── tfw_server.py tutorial-framework server
├── event_handler_main.py event handlers implemented in python
└── test_fsm.py example FSM
```
The core of the framework is the `TFWServer` class, which is instanciated in `tfw_server.py`.
This class handles the forwarding of the messages from the frontend to the event handlers connecting to it via ZMQ.
It also manages the FSM.
As you can see this file is set up to start with the container in `solvable/supervisor/tfw_server.conf`.
solvable/src
├── event_handler_main.py event handlers implemented in python
├── test_fsm.py example FSM in python
└── test_fsm.yml example FSM in yaml
```
`event_handler_main.py` contains example usage of our pre-defined event handlers written in Python3.
As you can see they run in a separate process (set up in `solvable/supervisor/event_handler_main.conf`).
@ -202,6 +197,8 @@ These event handlers could be implemented in any language that has ZMQ bindings.
Note that you don't have to use all our event handlers.
Should you want to avoid using a feature, you can just delete the appropriate event handler from `event_handler_main.py`.
`test_fsm.yml` and `test_fsm.py` are the implementations of the same FSM in YAML and Python to provide you examples of creating your own machine.
It is genarally a good idea to separate these files from the rest of the stuff in `solvable`, so it is a good practice to create an `src` directory.
## Baby steps
@ -209,7 +206,8 @@ It is genarally a good idea to separate these files from the rest of the stuff i
When creating your own challenge the process should be the following:
1. Use our install script to bootstrap your dev environment
2. Create an FSM that describes your challenge
- An example is in `solvable/src/test_fsm.py`
- An example is in `solvable/src/test_fsm.yml`
- The same FSM in python is in `solvable/src/test_fsm.py`
3. Create a `TFWServer` instance and set it up to run:
- Create a server app: `solvable/src/tfw_server.py`
- Set it up to run: `solvable/supervisor/tfw_server.conf`