Commit 0aed8d1f authored by Stavros-Anastasios Charismiadis's avatar Stavros-Anastasios Charismiadis
Browse files

use docker compose to deploy

parent 3c1487c2
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -17,5 +17,6 @@ app.py
invoker_sdk_config.json
requirements.txt
discoverer.pkl
invoker.pkl
invoker_info/
logs/
 No newline at end of file
+11 −4
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ A Postman collection is also provided, which can be imported directly to the Pos

## Getting started
To start the service, follow the steps below
Inside the "app" folder ...

1. Copy requirements_template.txt to requirements.txt
    ```
@@ -51,11 +52,17 @@ To start the service, follow the steps below
6. To deploy the service, run the following commands in an Ubuntu or MacOS terminal. To stop the invoker just press Ctrl+C or Command+C
```
    chmod +x start_invoker.sh
    ./start_invoker.sh -u <username given by organizers> [-n <host:ip>]"
    ./start_invoker.sh -u <username given by organizers>
```

7. To remove the files of the invoker instance (invoker_info, logs and pkl file), execute the following commands.
7. To see the logs, execute the following commands.
```
    chmod +x clean_files.sh
    ./clean_files.sh
    chmod +x logs_invoker.sh
    ./logs_invoker.sh -u <username given by organizers>
```

8. To stop the invoker service and remove the files of the invoker instance (invoker_info, logs and pkl file), execute the following commands.
```
    chmod +x stop_invoker.sh
    ./stop_invoker.sh -u <username given by organizers>
```
 No newline at end of file
+0 −0

File moved.

+25 −5
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ def onboard():
def discover():
    response_message = "Discover"
    ### Create the connection with CAPIF as an onboarded invoker
    # service_discoverer = ...

    ### Discover APIs according to the filters

@@ -60,11 +61,11 @@ def access_service():
    # resource_name = request_data['resource_name']
    # method = request_data['method']

    ### Uncomment, fill the ... with a preferred variable name and fetch the discoverer object
    ### Uncomment to fetch the discoverer object
    # if not os.path.exists(OBJ_FILE):
    #     return "No session found.", 404
    # with open(OBJ_FILE, 'rb') as f:
    #     ... = pickle.load(f)
    #     service_discoverer = pickle.load(f)

    ### Fetch the necessary information of the targeted API and add to a url parameter
    # service_path = ...
@@ -72,10 +73,11 @@ def access_service():
    # service_interface =
    # url = ...

    ### Get API token for the discovered API and add it to a header
    # jwt_token = ...
    ### Get API token for the discovered API

    ### Uncomment to add token to a header
    # headers = {
    #     'Authorization': 'Bearer {}'.format(jwt_token)
    #     'Authorization': 'Bearer {}'.format(...)
    # }

    ### Uncomment to make the request and return response text
@@ -84,6 +86,24 @@ def access_service():

    return response_message

@app.get("/offboard")
def offboard():
    response_message = "Offboard"

    ### Uncomment to fetch the invoker object
    # if not os.path.exists(OBJ_FILE):
    #     return "No session found.", 404
    # with open(OBJ_FILE_INV, 'rb') as f:
    #     invoker = pickle.load(f)

    ### Offboard invoker

    ### Uncomment to check if invoker was successfully offboarded
    # if not os.path.exists("./invoker_info/{}".format(user_name)):
    #     response_message = "Invoker offboarded successfully"

    return response_message

if __name__ == "__main__":
    port = int(os.getenv("PORT", 8001))
    app.run(host='0.0.0.0', port=port, debug=True)
 No newline at end of file
Loading