mirror of
https://github.com/avatao-content/test-tutorial-framework
synced 2024-11-14 16:07:18 +00:00
Remove lies from docs and update info
This commit is contained in:
parent
98f297cff2
commit
c9439f547b
28
README.md
28
README.md
@ -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 repository of a tutorial-framework based challenge is quite similar to a regular challenge.
|
||||||
The project root should look something like this:
|
The project root should look something like this:
|
||||||
|
|
||||||
```text
|
```
|
||||||
your_repo
|
your_repo
|
||||||
├── solvable
|
├── solvable
|
||||||
│ └── [TFW based Docker image]
|
│ └── [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`:
|
Let us take a closer look on `solvable`:
|
||||||
|
|
||||||
```text
|
```
|
||||||
solvable
|
solvable
|
||||||
├── Dockerfile
|
├── Dockerfile
|
||||||
├── nginx webserver configurations
|
├── 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.
|
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`.
|
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:
|
This is really easy: just create a config file in `solvable/nginx/` similar to this one:
|
||||||
```text
|
```
|
||||||
location /yoururl {
|
location /yoururl {
|
||||||
proxy_pass http://127.0.0.1:3333;
|
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:
|
To run your own webservice for instance you need to create a config file in `solvable/supervisor/` similar to this one:
|
||||||
|
|
||||||
```text
|
```
|
||||||
[program:yourprogram]
|
[program:yourprogram]
|
||||||
user=user
|
user=user
|
||||||
directory=/home/user/example/
|
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.
|
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.
|
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
|
|
||||||
```
|
```
|
||||||
|
solvable/src
|
||||||
The core of the framework is the `TFWServer` class, which is instanciated in `tfw_server.py`.
|
├── event_handler_main.py event handlers implemented in python
|
||||||
This class handles the forwarding of the messages from the frontend to the event handlers connecting to it via ZMQ.
|
├── test_fsm.py example FSM in python
|
||||||
It also manages the FSM.
|
└── test_fsm.yml example FSM in yaml
|
||||||
As you can see this file is set up to start with the container in `solvable/supervisor/tfw_server.conf`.
|
```
|
||||||
|
|
||||||
`event_handler_main.py` contains example usage of our pre-defined event handlers written in Python3.
|
`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`).
|
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.
|
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`.
|
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.
|
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
|
## 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:
|
When creating your own challenge the process should be the following:
|
||||||
1. Use our install script to bootstrap your dev environment
|
1. Use our install script to bootstrap your dev environment
|
||||||
2. Create an FSM that describes your challenge
|
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:
|
3. Create a `TFWServer` instance and set it up to run:
|
||||||
- Create a server app: `solvable/src/tfw_server.py`
|
- Create a server app: `solvable/src/tfw_server.py`
|
||||||
- Set it up to run: `solvable/supervisor/tfw_server.conf`
|
- Set it up to run: `solvable/supervisor/tfw_server.conf`
|
||||||
|
Loading…
Reference in New Issue
Block a user