forked from TheDhm/EasyTP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.md.bak
291 lines (214 loc) · 10.8 KB
/
README.md.bak
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
# EasyTP
<!--
>EasyTP is a web based solution that aims to facilitate and >customize cluster management by automating
>deployement for different Tools/software used in students labs allowing user >management ~~~ (microservices, fully distributed in LAN, NFS , >worker nodes ...)
-->
![GitHub contributors](https://img.shields.io/github/contributors/TheDhm/container-manager-app) ![GitHub commit activity (branch)](https://img.shields.io/github/commit-activity/y/TheDhm/container-manager-app) ![GitHub last commit](https://img.shields.io/github/last-commit/TheDhm/container-manager-app) ![GitHub language count](https://img.shields.io/github/languages/count/TheDhm/container-manager-app) ![GitHub top language](https://img.shields.io/github/languages/top/TheDhm/container-manager-app)
## About
The present project consisted of developing and deploying a solution that would allow
students of the school to access the software that they use in practical labs without worrying about installation, compatibility and lack of resources often encountered, using containerization using Docker and deployment using Kubernetes.
The proposed solution consists of containerizing two chosen applications (based on usage frequency) and implementing a custom onsite Kubernetes cluster architecture to deploy and manage students/teachers access and activity to these applications through a common web plateform named **EasyTP**.
## Built with
* [![Django][Django]][django-url]
* [![Docker][Docker]][docker-url]
* [![Kubernetes][Kubernetes]][kubernetes-url]
* [![PostG][PostG]][postg-url]
<!--## Project motivation
This project is a semester long project for 2CS Computer Systems speciality (SIQ) at ESI Algiers.
-->
## Chosen applications
- Gns3
- Logisim
## How did we dockerize them
To dockerize and remotely access GUI applications, the container contains the following stack described in ``./Dockerfiles/\<appname>/Dockerfile``.
<img src="./screenshots/stack.png" height="400">
* Debian as the base image.
* Supervisord (insures/restrict application/user access inside container) described through supervisord.conf.
* Application and its dependencies
* Openbox (Windows manager) described through menu.xml file.
* x11 provided by TigerVNC
* VNC server provided by TigerVNC
* Websocket to view VNC content through browser provided by easy-novnc.
## Kubernetes Cluster
<img src="./screenshots/cluster.png" height="400">
* Storage through NFS technology
* Networking through proxy / ingress.
* Deployement: the solution is ready to be deployed locally through LAN distributed cluster, VMs or through cloud (soon).
## EasyTP
EasyTP is a web application developed with Django that aims to
facilitate and customize cluster management according to our specific needs. It serves, in the first place,
authenticate the different users of the system, then communicates with the control plane to create pods and services associated with the applications requested by the users.
System users are : students, teachers and administrator.
Here are the functional and technical specifications of the EasyTP application in detail.
### Features
- The application starts a new pod and kubernetes service for each
application/user.
- The system allows all users to access the application from the
browser.
- The system allows all users of the application to authenticate themselves.
- The system allows to save the user's session for future use.
- The system allows to send an email to new users containing their usernames and passwords.
- The system should delete the pod/container after the user logs out.
We count 3 types of users:
#### 1. Administrator
- The system allows an "administrator" user to consult the dashboard.
- The system allows an "administrator" user to add a list of users from a CSV file.
- The administrator must be able to create, update and delete applications.
- The administrator must be able to assign applications to students.
- The administrator must be able to manage access and privileges.
#### 2. Teacher
- The system allows a "teacher" user to view all student pods.
- The system allows a "teacher" user to access any student's pod.
- The system allows a teacher user to access student storage spaces.
- The system allows a "teacher" user to launch applications.
- The system allows a teacher user to upload files related to the course to his/her own storage space to be shared with students.
#### 3. Student
- The system allows a "student" user to launch applications (Lab environement).
- The system allows a student user to upload files from his own local machine or from the space shared with the teacher to his allocated space.
- The system allows a students to collaborate in the same project .
### Screenshots
1. Authentication (only @esi.dz emails are allowed)
![](./screenshots/not_connected.png)
![](./screenshots/connexion.png)
_Login page_
2. Student
![](./screenshots/student_dashboard.png)
_student dashboard_
![](./screenshots/file_manager__.png)
_file manager page_
![](./screenshots/applications.png)
_Lab applications dashboard_
![](./screenshots/logisim.png)
_Logisim application preview_
![](./screenshots/gns3_usage.png)
_Gns3 application preview_
3. Teacher
![](./screenshots/teacher_dashboard.png)
_Teacher dashboard_
![](./screenshots/file_manager_.png)
_Teacher file manager page_
![](./screenshots/browse_students.png)
_student list page_
4. Admin
![](./screenshots/admin_instances.png)
_DB instances_
![](./screenshots/add_users.png)
_Add users via CSV file_
![](./screenshots/admin_users.png)
_Users dashboard_
![](./screenshots/email_credentials.png)
_Login credentials via email_
## Usage
- Connect to the web plateforme hosted locally (http://server_IP:31313/login).
- Authenticate, then choose an application to launch, you will be directed to a new tab to access the lab.
- Enter VNC password and connect to your lab !
## Getting started
These instructions will get you a copy of this project up running on your local environement.
### Prerequisites
* Docker
* cri-dockerd *(you can get it from [here](https://github.com/Mirantis/cri-dockerd))*
* Kubernetes (you can follow this [tutorial](https://phoenixnap.com/kb/install-kubernetes-on-ubuntu) to install kubeadm, kubelet and kubectl)
[//]: # (* Python 3 *(you can get it from [here](https://www.python.org/downloads/))*)
[//]: # (* virtualenv)
[//]: # (```sh)
[//]: # (pip install virtualenv)
[//]: # (```)
[//]: # (### Create a virtual environement)
[//]: # ()
[//]: # (```sh)
[//]: # (virtualenv "Your virtualenv name" )
[//]: # (cd "Your virtualenv name")
[//]: # (Scripts\activate)
[//]: # (```)
### Installation
1. Create your cluster
```sh
swapoff -a
sudo kubeadm init --pod-network-cidr=10.244.0.0/16 --cri-socket=unix:///var/run/cri-dockerd.sock --apiserver-advertise-address=<your ip>
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
# install flannel: network plugin
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml
# enable scheduling on master
kubectl taint node --all node-role.kubernetes.io/master:NoSchedule-
kubectl taint node --all node-role.kubernetes.io/control-plane:NoSchedule-
```
2. Clone the repo
```sh
git clone https://github.com/TheDhm/container-manager-app.git
```
3. Create NFS storage (you can follow this [tutorial](https://www.tecmint.com/install-nfs-server-on-ubuntu/))
* create DB folder in your nfs server (for postgres DB)
* create USERDATA folder ( users storage space )
* create READONLY folder
* make sure to change nfs server IP in:
* postgres-pv.yaml
* django-deployment.yaml
* persistentVolume.yaml
4. Build the web app image
```sh
cd container-manager-app
docker build --rm -t django-app:latest .
```
5. Before you start the project make sur you have docker images locally :
[//]: # (* [Gns3](https://hub.docker.com/r/younes46/gns))
[//]: # (```sh )
[//]: # (docker pull younes46/gns)
[//]: # (docker tag younes46/gns gns3)
[//]: # (```)
[//]: # (* [Logisim](https://hub.docker.com/repository/docker/anii76/logisim))
[//]: # (```sh )
[//]: # (docker pull anii76/logisim)
[//]: # (docker tag anii76/logisim logisim)
[//]: # (```)
[//]: # (### Or)
you can build the images using dockerfiles in `Dockerfiles` (Logisim & GNS3)
```sh
docker build -t <ImageName> <DockerfilePath>
```
6. Deploy on Kubernetes cluster
```sh
cd container-manager-app
sh deploy-all.sh
```
7. Migrate
```sh
kubectl -n django-space exec -it <django pod> -- python manage.py migrate
```
8. Create superuser
```sh
kubectl -n django-space exec -it <django pod> -- python manage.py createsuperuser
```
9. Add Users, Apps and AccessGroups using Django Admin.
10. Congrats, You can now start your journey!
## Acknowledgment
Special thanks to M. BELHADI Zohir for helping us through this project.
## Ressources
The below space, a list of the most helpful resources that we would like to give credit to.
* [Delivering Desktop Apps in Containers.](https://youtu.be/L4nqky8qGm8)
* [How to create and run GUI application in a Docker container. ](https://www.digitalocean.com/community/tutorials/how-to-remotely-access-gui-applications-using-docker-and-caddy-on-debian-9)
* [VNC vs RDP: which remote desktop tool is the best?](https://www.realvnc.com/en/blog/vnc-vs-rdp-which-remote-desktop-tool-is-best/#:~:text=Both%20protocols%20provide%20access%20to,what%20the%20remote%20user%20sees)
* [Kubernetes tutorial](https://kubernetes.io/docs/tutorials/)
* [FIX: Pod IP address is out of range specified in --pod-network-cidr ](https://serverfault.com/questions/1101838/kubernetes-pod-ip-address-is-out-of-range-specified-in-pod-network-cidr)
## Contact
Contact KubeLeads Team:
> - Anfal Bourouina : [email protected]
> - Abderrahmane Melek : [email protected]
> - Mohamed Branki Regani : [email protected]
> - Mohamed Elghazali Kimeche : [email protected]
> - Younes Otmani : [email protected]
> - Kenza Makhloufi : [email protected]
## License
![GitHub](https://img.shields.io/github/license/TheDhm/container-manager-app?style=flat-square)
The source code for this project is licensed under the MIT license, which you can find in the [LICENSE](./LICENSE) file.
<!-- MARKDOWN LINKS & IMAGES -->
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
[Django]: https://img.shields.io/badge/Django-092E20?style=for-the-badge&logo=django&logoColor=white
[django-url]: https://www.djangoproject.com/
[Kubernetes]: https://img.shields.io/badge/kubernetes-%23326ce5.svg?style=for-the-badge&logo=kubernetes&logoColor=white
[kubernetes-url]: https://kubernetes.io/
[Docker]: https://img.shields.io/badge/docker-%230db7ed.svg?style=for-the-badge&logo=docker&logoColor=white
[docker-url]: https://www.docker.com/
[PostG]: https://img.shields.io/badge/postgres-%23316192.svg?style=for-the-badge&logo=postgresql&logoColor=white
[postG-url]: https://www.postgresql.org/