Skip to content

Commit 9f40b25

Browse files
committed
Update Blog “open-sourcing-workshops-on-demand-part4-managing-the-backend”
1 parent 5adac02 commit 9f40b25

File tree

1 file changed

+23
-20
lines changed

1 file changed

+23
-20
lines changed

content/blog/open-sourcing-workshops-on-demand-part4-managing-the-backend.md

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,20 @@ It also hosts the `inventory` file describing the role of JupyterHub servers. Pl
5555
127.0.0.1 ansible_connection=localhost
5656
```
5757

58-
The `conf` folder hosts configuration files in a jinja format. Once expanded, the resulting files will be used by relevant workshops. I will explain in a future article all the steps and requirements to create a workshop.
58+
The `conf` folder hosts configuration files in a Jinja format. Once expanded, the resulting files will be used by relevant workshops. I will explain in a future article all the steps and requirements to create a workshop.
5959

60-
As part of the refacturing work to open source the project, we reaaranged the different scripts locations. We have created an install folder to handle the different installation scripts either from a Jupyterhub 's perpective or from an appliance 's standpoint too.
60+
As part of the refactoring work to open source the project, we reaaranged the different scripts' locations. We have created an install folder to handle the different installation scripts either from a JupyterHub's perpective or from an appliance's standpoint, too.
6161

62-
We separated the workshops related scripts from the system ones. When one creates a workshop, one needs to provide a series of notebooks and in some cases some scripts to manage the creation, setup of a related appliance along with additional scripts to manage its lifecycle in the overall workshops-on-Demand architecture (Create, Cleanup, Reset scripts at deployment or Cleanup times). These scripts need to be located in the `scripts` folder. On the other hand, the system scripts are located in the `sys` folder.
62+
We separated the workshops' related scripts from the system ones. When one creates a workshop, one needs to provide a series of notebooks and in some cases some scripts to manage the creation and setup of a related appliance along with additional scripts to manage its lifecycle in the overall Workshops-on-Demand architecture (Create, Cleanup, Reset scripts at deployment or Cleanup times). These scripts need to be located in the `scripts` folder. On the other hand, the system scripts are located in the `sys` folder.
6363

6464
![](/img/tree-wkshop2.png "Tree view of the sys directory")
6565

66-
This directory hosts important configuration files for both the system and Jupyterhub. You can see for instance `fail2ban` configuration files. Some jinja templates are present here too. These templates will be expanded trough the `deliver` mechanism allowing the creation of files customized with ansible variables. All the wod related tasks are prefixed with wod for better understanding and ease of use.
66+
This directory hosts important configuration files for both the system and JupyterHub. You can see for instance `fail2ban` configuration files. Some Jinja templates are present here, too. These templates will be expanded through the `deliver` mechanism allowing the creation of files customized with Ansible variables. All the wod related tasks are prefixed with wod for better understanding and ease of use.
6767

68-
They can refer to some Jupyterhub kernel needs like `wod-build-evcxr.sh.j2` that aims at creating a script allowing the rust kernel installation. Some other templates are related to the system and Jupyterhub. `wod-kill-processes.pl.j2` has been created after discovering the harsh reality of online mining...In a ideal world, I would not have to explain further as the script would not be needed. Unfortunately, this is not the case, when one offers access to some hardware freely online, he can expect sooner or later to see his original and pure idea to be highjacked...Let's say that you want to provide some AI/ML 101 type of workshops, you may consider providing servers with some GPUs. Any twisted minded cryptominer discovering your ressources will definitely think he hits the jackpot! This little anecdot actually happened to us and not only on GPU based servers, some regular servers got hit as well. We found out that performance on some servers became very poor and when looking into it, we found some scripts that were not supposed to run there...As a result, we implemented monitors to check load on our server and make sure that to kill any suspicious process before kicking out the misbehaving student.
68+
These Jinja templates can refer to some Jupyterhub kernel needs like `wod-build-evcxr.sh.j2` that aims at creating a script allowing the rust kernel installation. Some other templates are related to the system and JupyterHub. `wod-kill-processes.pl.j2` has been created after discovering the harsh reality of online mining. In a ideal world, I would not have to explain further as the script would not be needed. Unfortunately, this is not the case. When one offers access to some hardware freely online, sooner or later, he can expect to see his original idea to be hyjacked.
69+
70+
Let's say that you want to provide some AI/ML 101 type of workshops. As part of it,
71+
you may consider providing servers with some GPUs. Any twisted minded cryptominer discovering your resources will definitely think he's hits the jackpot! This little anecdot actually happened to us and not only on GPU based servers, some regular servers got hit as well. We found out that performance on some servers became very poor and when looking into it, we found some scripts that were not supposed to run there. As a result, we implemented monitors to check the load on our servers and made sure that to kill any suspicious processes before kicking out the misbehaving student.
6972

7073
`wod-test-action.sh.j2` is another interesting template that will create a script that we use for testing. This script mimics the procmail API and actually enables you to test the complete lifecycle of a workshop from deployment to cleanup or reset.
7174

@@ -76,7 +79,7 @@ ACTION is mandatory
7679
wodadmin@server:/usr/local/bin$
7780
```
7881

79-
It requires the verb, the workshop's name and the student id. Using the script, one does not need to provide participant id. The script is run locally on the Jupyterhub server.
82+
It requires the verb, the workshop's name and the student id. Using the script, one does not need to provide participant id. The script is run locally on the JupyterHub server.
8083

8184
```shellsession
8285
wodadmin@server:/usr/local/bin$ ./wod-test-action.sh
@@ -95,7 +98,7 @@ Sending a mail to CREATE student 121 for workshop WKSHP-API101
9598
221 2.0.0 Bye
9699
```
97100

98-
In order to retrieve the result of the script, you simply need to run a `tail` command
101+
In order to retrieve the result of the script, you simply need to run a `tail` command.
99102

100103
```shellsession
101104
wodadmin@server:~$ tail -100f .mail/from
@@ -111,15 +114,15 @@ From [email protected] Fri Mar 3 09:08:35 2023
111114

112115
The very last line of the trace will provide you with the credentials necessary to test your workshop.
113116

114-
There are two types of activities that can occur on the backend server: punctual or regular. The punctual activity is one that is performed once every now and then. The regular one is usually set up on the backend server as a cron job. Sometimes however, one of these cron tasks can be forced manually if necessary. One the main scheduled task is the `deliver` task. I will explain it later on in this chapter. I will start now by explaining an important possible punctual task, the update of the backend server.
117+
There are two types of activities that can occur on the backend server: punctual or regular. The punctual activity is one that is performed once every now and then. The regular one is usually set up on the backend server as a cron job. Sometimes however, one of these cron tasks can be forced manually if necessary. One of the most important scheduled task is the `deliver` task. I will explain it later on in this chapter. I will start now by explaining an important possible punctual task, the update of the backend server.
115118

116119
#### Update of the backend server:
117120

118-
The backend server hosts all the necessary content for delivering workshops: it implies notebooks and scripts and playbooks to deploy and personalize them. It also hosts some services that are needed by the overall architecture solution (Jupyterhub, Procmail, Fail2ban among others).
121+
The backend server hosts all the necessary content for delivering workshops: it supplies notebooks,scripts and playbooks to deploy and personalize them. It also hosts some services that are needed by the overall architecture solution (JupyterHub, Procmail, Fail2ban among others).
119122

120-
Services are installed once and for all at the installation time. These services may evolve over time. One may need to update the jupyterhub application to fix a bug or get new features. In the same fashion, you may consider bumping from one python version to a new major one. If you are willing to update these services or add new ones, you will need to update the relevant installation playbooks in `wod-backend/ansible` directory.
123+
Services are installed once and for all at the installation time. These services may evolve over time. One may need to update the JupyterHub application to fix a bug or get new features. In the same fashion, you may consider bumping from one Python version to a new major one. If you are willing to update these services or add new ones, you will need to update the relevant installation playbooks in `wod-backend/ansible` directory.
121124

122-
here is a small extract of the `install_backend.yml` playbook: Full version [here](https://github.com/Workshops-on-Demand/wod-backend/blob/main/ansible/install_backend.yml)
125+
Here is a small extract of the `install_backend.yml` playbook: Full version [here](https://github.com/Workshops-on-Demand/wod-backend/blob/main/ansible/install_backend.yml)
123126

124127
```shellsession
125128
vi install_backend
@@ -169,8 +172,8 @@ vi install_backend
169172

170173
Possible Use Cases:
171174

172-
* Upgrade to a newer version of Jupyterhub
173-
* Add a new kernel to Jupyterhub
175+
* Upgrade to a newer version of JupyterHub
176+
* Add a new kernel to JupyterHub
174177
* Add a new Ansible Galaxy collection
175178
* Add a new PowerShell library
176179
* Add a new package needed by a workshop.
@@ -184,7 +187,7 @@ For e.g:
184187

185188
You will start by moving to your public backend forked repository and apply the necessary changes before committing and push locally.
186189

187-
Then you will perform a merge request with the main repository. We plan to integrate here in a proper CICD (continuous integration continous development) pipeline to allow a vagrant based test deployment. Whenever someone performs a merge request on the main repo, the test deployment task kicks in and deploy a virtual backend server on which the new version of the installation process is automatically tested. When successful, the merge request is accepted. Once merged, you will need to move to your backend server and perform git remote update and git rebase on the wod-backend directory. Once done, you will then be able to perform the installation process.
190+
Then you will perform a merge request with the main repository. We plan to integrate here in a proper CICD (continuous integration continous development) pipeline to allow a vagrant based test deployment. Whenever someone performs a merge request on the main repo, the test deployment task kicks in and deploys a virtual backend server on which the new version of the installation process is automatically tested. When successful, the merge request is accepted. Once merged, you will need to move to your backend server and perform git remote update and git rebase on the wod-backend directory. Once done, you will then be able to perform the installation process.
188191

189192
#### Regular maintenance of the backend server:
190193

@@ -226,19 +229,19 @@ This first check includes:
226229
* Setup weekly cleanup processes task
227230
* Enable WoD service
228231
* Test private tasks YAML file
229-
* Call private tasks if available. We perform private part before users management to allow interruption of the deliver script during normal operations - waiting till end of users management can take hours for 2000 users. Potential impact: private scripts are run before users creation, so may miss some part of setup.
232+
* Call private tasks if available. It performs the private part before users management to allow interruption of the deliver script during normal operations - waiting till end of users management can take hours for 2000 users. Potential impact: private scripts are run before users creation, so may miss some part of setup.
230233
* User Management:
231234

232-
* Remove existing jupyterhub users
235+
* Remove existing JupyterHub users
233236
* Remove Linux users and their home directory
234237
* Ensure dedicated students groups exist
235238
* Ensure Linux students users exists with their home directory
236-
* Ensure jupyterhub students users exist
237-
* Setup ACL for students with jupyterhub account
238-
* Setup default ACL for students with jupyterhub account
239+
* Ensure JupyterHub students users exist
240+
* Setup ACL for students with JupyterHub account
241+
* Setup default ACL for students with JupyterHub account
239242

240243
A similar set of scripts exist for the different parts of the solution ([check_api-db.yml](https://github.com/Workshops-on-Demand/wod-backend/blob/main/ansible/check_api-db.yml) for api-db server, [check_frontend.yml ](https://github.com/Workshops-on-Demand/wod-backend/blob/main/ansible/check_frontend.yml)for frontend server for instance).
241244

242-
You should have now a better understanding of the maintenance tasks associated to the backend server. Similar actions are available for the other components of the project. Checking tasks have been created for the frontend and api-db server. Having nowostly covered all the subjects related to the backend server from an infrastructure standpoint, it is high time to discuss the content part. In my next blog, I plan to describe the workshop creation process. Time to understand how to build up some content for the jupyterhub server!
245+
You should now have a better understanding of the maintenance tasks associated to the backend server. Similar actions are available for the other components of the project. Checking tasks have been created for the frontend and api-db server. Having now mostly covered all the subjects related to the backend server from an infrastructure standpoint, it is high time to discuss the content part. In my next blog, I plan to describe the workshop creation process. Time to understand how to build up some content for the JupyterHub server!o
243246

244247
If we can be of any help in clarifying any of this, please reach out to us on [Slack](https://slack.hpedev.io/). Please be sure to drop back at [HPE DEV](https://developer.hpe.com/blog) for a follow up on this. Check out also the Hack Shack for new [workshops](https://developer.hpe.com/hackshack/workshops)! Willing to collaborate with us? Contact us and let's build together some more workshops! Stay tuned!

0 commit comments

Comments
 (0)