|
1 | 1 | # Tutorial |
2 | 2 |
|
3 | | -Step-by-step tutorial |
| 3 | +This document guides you through a simple tutorial that uses GitHub Actions and a free S3 data store (Minio Play). The pre-requisite for this tutorial is a GitHub account. |
4 | 4 |
|
5 | | -Tutorial workflow name: FaaSrTutorial.json |
| 5 | +## Configure your FaaSr-workflow repository |
| 6 | + |
| 7 | +This is a one-time step you go through to set up your [workflow repository] to host all your workflows, including the tutorial. |
| 8 | + |
| 9 | +- Navigate to the [FaaSr organization workflow repo](https://github.com/FaaSr/FaaSr-workflow) |
| 10 | +- Fork the repository to your own GitHub account, keeping the FaaSr-workflow name |
| 11 | +- In your forked repository, click on _Actions_ and click on _I understand my workflows, go ahead and enable them_ to allow FaaSr register/invoke actions to execute |
| 12 | + |
| 13 | +## Configure your GitHub PAT |
| 14 | + |
| 15 | +You need a personal access token in your repository secrets to run this tutorial. |
| 16 | + |
| 17 | +Follow the steps outlined in the [credentials] documentation to obtain your PAT. Copy this PAT so you can paste it as a secret in the next step |
| 18 | + |
| 19 | +## Configure your repository secrets |
| 20 | + |
| 21 | +Before you can register and invoke workflows, you need to create secrets storing credentials for the cloud providers you will use. The following assumes that you already have obtained [cloud credentials] for those. |
| 22 | + |
| 23 | +- In the _FaaSr-workflow_ repo you just forked, click on the _Settings_ tab (top of the page, to the right) |
| 24 | +- Scroll down; on the left pane, click on the pull-down _Secrets and variables_ and select _Actions_ |
| 25 | +- Click on the green _New repository secret_ to enter a new secret |
| 26 | +- Enter the proper _Name_ for each of the three secrets below (one for GitHub actions, two for Minio Play) and past the secret itself in the _Secret_ text box: |
| 27 | +- Click on _Add secret_ and add a secret named `GH_PAT`, pasting your GitHub PAT created in the previous step |
| 28 | +- Click on _Add secret_ and add a secret named `S3_ACCESSKEY`, pasting the following text: `Q3AM3UQ867SPQQA43P2F` |
| 29 | +- Click on _Add secret_ and add a secret named `S3_SECRETKEY`, pasting the following text: `zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG` |
| 30 | + |
| 31 | +## Edit the tutorial JSON file |
| 32 | + |
| 33 | +The tutorial.json file comes by default in the repository you forked; however, you still need to configure it with your GitHub account name. This can be done in either of two ways: |
| 34 | + |
| 35 | +### Option 1: Edit tutorial.json in GitHub |
| 36 | + |
| 37 | +- Edit the tutorial, json file in GitHub |
| 38 | +- Search for _myusername_, and replace that with your GitHub account name |
| 39 | +- Commit the file |
| 40 | + |
| 41 | +### Option 2: Edit tutorial.json in the Web UI |
| 42 | + |
| 43 | +- Browse to the [FaaSr Workflow Builder Web UI] |
| 44 | +- Click on Upload (top left) |
| 45 | +- To import the tutorial file from GitHub, enter in text box: `https://github.com/FaaSr/FaaSr-workflow/blob/main/tutorial.json` |
| 46 | +- Click on _Edit Compute Servers_, click on _GH_, replace the UserName with your GitHub account name |
| 47 | +- Download tutorial.json to your computer |
| 48 | +- Upload tutorial.json to your repository (replacing the original file) |
| 49 | + |
| 50 | +## Register the workflow |
| 51 | + |
| 52 | +- You first need to [register the workflow] before it can be invoked |
| 53 | +- Click on _Actions_ |
| 54 | +- Click on `(FAASR REGISTER)` (left) |
| 55 | +- Click on the `Run workflow` drop-down; enter `tutorial.json` and click on `Run workflow` |
| 56 | +- This will take a few seconds to complete; wait until the action completes before proceeding |
| 57 | + |
| 58 | +## Invoke the workflow |
| 59 | + |
| 60 | +- After register, you can [invoke the workflow] |
| 61 | +- Click on _Actions_ |
| 62 | +- Click on `(FAASR INVOKE)` (left) |
| 63 | +- Click on the `Run workflow` drop-down; enter `tutorial.json` and click on `Run workflow` |
| 64 | +- This will take a few seconds to complete; wait until the action completes before proceeding |
| 65 | + |
| 66 | +## Check outputs |
| 67 | + |
| 68 | +The workflow outputs are stored in the Minio Play S3 bucket. There are different ways you can access it, with different S3 clients (e.g. Minio client); we will use the Minio Play console in this tutorial: |
| 69 | + |
| 70 | +- Browse to [minio play web UI](https://play.min.io:9443/login) |
| 71 | +- For user name, enter `Q3AM3UQ867SPQQA43P2F` |
| 72 | +- For password, enter `zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG` |
| 73 | +- Browse to faasr/tutorial to see the output files |
| 74 | + |
| 75 | +## Another example |
| 76 | + |
| 77 | +The tutorial.json workflow is based on two R functions (start, compute_sum). Another example is found in tutorialRpy.json that uses an R function (start) followed by a Python function (compute_sum). If you'd like to test this out, repeat the edit, register, and invoke workflow steps as above for this workflow |
| 78 | + |
| 79 | + |
| 80 | +[workflow repository]: workflow_repo.md |
| 81 | +[credentials]: credentials.md |
| 82 | +[FaaSr Workflow Builder Web UI]: workflows.md |
| 83 | +[register the workflow]: register_workflow.md |
| 84 | +[invoke the workflow]: invoke_workflow.md |
0 commit comments