You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In previous articles of this series dedicated to the [open sourcing of our Workshops-on-Demand project](https://developer.hpe.com/blog/willing-to-build-up-your-own-workshops-on-demand-infrastructure/), I covered the reasons why we open sourced the project and how we did it. I also explained in details how you could install your own Workshops-on-Demand backend server. I also took the time to detail the automation that was hosted on this backend server. I also described to you the management of this backend server. This is what is often referred to as Day2 operations. I plan now to explain how to deploy and manage the API-DB server.
10
21
11
22
The following image is describing the different interactions existing between the different components of the wod architecture.
@@ -62,7 +73,10 @@ Here's a quick look at what can be found in each:
62
73
63
74
It provides:
64
75
76
+
* An Installer allowing you to install either Backend, Api-DB server, or Frontend using a single line of command.
65
77
* A complete JupyterHub server with some addons (additional Jupyterhub kernels, Ansible galaxies, and PowerShell libraries) on your system, ready to host Workshops-on-Demand that you can find here.
78
+
* An api-db Server to host Workshops data and provide an API server to retrieve relevant workshops data
79
+
* A frontend server to provide registration process
66
80
* A postfix server used for the procmail API
67
81
* An Ansible engine to allow automation
68
82
* A fail2ban service
@@ -80,4 +94,144 @@ Before cloning the install repository, you will need to prepare the server th
80
94
81
95
##### Prerequesites:
82
96
83
-
In order to setup the api-db server, you will need:
97
+
In order to setup the api-db server, you will need:
98
+
99
+
* A fresh OS install on physical / virtualized server running Ubuntu 24.04 or Centos 7.9 leveraging any deployment mechanism of your choice.(e.g. iLO, vagrant, etc.). You may even use this vagrant file to automatically generate a complete setup leveraging vagrant, libvirt and QEMU/KVM.
100
+
* A Linux account with sudo priviledges on your Linux distro. Name it `install`
101
+
* Git installed on the machine
102
+
103
+
Our current setup leverages the following specs for our api-db server
104
+
105
+
* 2 cpus or more machine
106
+
* 16 GB of RAM
107
+
* 80 GB of storage
108
+
109
+
We are currently using a virtual machine on AWS for our different production sites.
110
+
111
+
When done with OS installation and preparation
112
+
113
+
* From the WoD-api-db server, as the install user, you will need to clone the wod-install repo first.
* The installation is based on a common install script [install.sh ](https://github.com/Workshops-on-Demand/wod-backend/blob/main/install/install.sh)that allows the deployment of the different parts of the solution. It can be called as follows:
* Creates an admin user as defined upper (default is `wodadmin`) with sudo rights
135
+
* Calls the `install-system-common.sh` script that performs the following tasks:
136
+
137
+
* Cleanup
138
+
* Github repos cloning (leveraging install.repo file) : public Backend and public Private repos
139
+
* Create ssh keys for wodadmin
140
+
* Creates GROUPNAME variables
141
+
* Creates Ansible inventory files
142
+
* Calls the `install_system.sh` script with the type (api-db, backend, or frontend) that performs the following tasks:
143
+
144
+
* Install the necessary stack based on selected type
145
+
* Create a `wod.sh` script in `wod-backend` directory to be used by all other scripts
146
+
* Source the `wod.sh` file
147
+
* Setup Ansible-galaxies (`community.general` and `posix`)
148
+
* Setup Ansible and call the playbook `install_<type>.yml` followed by the `ansible\_check\_<type>.yml`
149
+
150
+
At the end of the api-db installation process:
151
+
152
+
* you will have a postgres database running in a docker container and populated with the data coming from the different workshops yaml files.
153
+
* You will have a postgres adminer running
154
+
* You will get a api server running along with his swagger description.
155
+
156
+
Please note that this setup phase can be concurrent with the public setup phase. Indeed, the install script should detect the presence of the private repository owing to the presence of the install.priv file. It will automatically adjust the different scripts and variables to add the relevant content. It will actually overload some of the variables with private ones.
157
+
158
+
You now have a working Workshops-on-Demand api-db server in place.
159
+
160
+
161
+
162
+
163
+
164
+
165
+
166
+
167
+
168
+
169
+
170
+
171
+
172
+
Congratulations! The next article in the series will help you better understand the lifecycle of the backend server. How does a workshop registration work from the backend server 's side? How do you manage this server on a daily basis? How and when do you need to update it ? All these questions will be answered in the next article. And from there, we will move to the frontend side of things and finally to a workshop's creation process.
173
+
174
+
If you need support for this installation process, use our dedicated [slack channel](https://hpedev.slack.com/archives/C01B60X8SSD).
175
+
176
+
Please be sure to check back [HPE Developer blog site](https://developer.hpe.com/blog) to read all the articles in this series. Also, check out the Hack Shack for new [workshops](https://developer.hpe.com/hackshack/workshops)[Data Visualization 101](https://developer.hpe.com/hackshack/replays/42) is now available! Stay tuned for additional Workshops-on-Demand in our catalog.
177
+
178
+
179
+
180
+
## How to manage your own api-db server...
181
+
182
+
The main component of the api-db server is database. there are two ways of managing the data content :
183
+
184
+
Postgres adminer:
185
+
186
+
in order to access the postgres adminer console: browse to either the internal or external (if any) IP Address on port 8083
187
+
188
+

189
+
190
+
Using teh console, the admin can update the relevant tables manually. However, we now recommand you leverage our scripts that will take care of updating the relevant data automatically.
191
+
192
+
Let's start with a simple example:
193
+
194
+
### You want to add a new workshop to your catalog. How should you proceed?
195
+
196
+
* Start by developing a new workshop (a future blog will help you understand how to achieve this).
197
+
* As part of the workshop development, you will have to create a simple yaml file that will describe the workshop.
198
+
* Once the workshop content is ready, you will create a pull request to the wod-notebooks repository to update its content.
199
+
* From the api-db server, as the install user, launch now the seeders script to update the database. The script will parse the different yaml files and proceed with the necessary updates to the database.
200
+
201
+
Take a look at the folowing example:
202
+
203
+
```
204
+
%YAML 1.1
205
+
# Meta data for the API101 Workshop to populate seeder
206
+
---
207
+
name: 'API 101 - API basics and the value they provide'
208
+
description: 'You may know that application programming interfaces (APIs) allow applications to talk to other apps, but have you ever used them? Today, APIs are available for most products and solutions. You can take advantage of them when writing automation scripts, integrating code, or defining infrastructure-as-code, as long as you understand the mechanisms used to consume an API. In this hands-on workshop, we’ll review all the jargon and technology used by REST APIs.'
As you can see, it contains many information, from the name of the workshop, its description, whether it should be active in the databse, its capacity and much more...
230
+
231
+
Every single filed in this file with be leverage to add a workshop in the workshop table form the database. Using a seeding script, every single yaml file present in each workshop folder of the wod-notebook repositories (public and private) get imported in the databse as part of the api-db server install process.
232
+
233
+
Leveraging the very same mechanism, one can add, update a workshop.
234
+
235
+
### You want to add a new filed in the workshop table. How should you proceed?
236
+
237
+
In order to achieve this, you will need to update the workshops.js file in the model directory within the wod-api-db folder on the api-db server.
0 commit comments