SE4 Virtualisation TP Wasilewski
Déroulé du TP
Target: discover technologies and use a web server
1. Create VM
- Create a virtual machine on Proxmox (server is accessible through: this link) by cloning the template. The virtual machine must be named
team-XX
with XX being your team number assigned at the beginning of the tutorial. - Manual configure virtual machine's network to be persistent. Your VM's IP must be
10.99.XX.1/16
with the gateway being10.99.99.253
. - Update
/etc/hostname
to reflect the VM's name to the hostname - Update
/etc/hosts
with the two previous updates - Ensure it can ping google.
- Reboot the VM and validate it.
2. First web server
- Install nginx. (Hint: if it fails, do not forget to configure your VM's DNS).
- Setup a custom/cool static page.
3. First load balancer
- Install HAProxy 2.8 (Hint: Search "debian haproxy" on your favorite search engine)
- Redirect port 8888 to the previously installed nginx.
4. Docker time
- Install docker.
- Pull nginx image.
- Copy your custom static page into the container.
- Reconfigure HAProxy to use port 8889 onto the container.
Target: discover technologies and use a web server
5. First Docker image
- Create a Docker image based on
nginx:latest
that use your previously created static page. This image will be namedtXX-web
and will use semantic versioning. - Publish this new image on the common registry, located at
registry.se4-virt.fr
.
6. Nomad installation
- Install nomad as a Debian package. See the official documentation
- Have Nomad running as client and server. Validate it through its interface which should be accessible through
http://10.99.XX.1:4646
. (Check it withcurl
)
7. Access Nomad UI from Zabeth
- Add a route on your Zabeth to view Nomad UI from it (Hint: Nomad network is
10.99.0.0/16
and hop is172.26.145.200
) - Add a route on your VM to allow traffic back to Zabeth (Hint: Zabeth network is
172.26.145.0/24
and hop is10.99.99.254
)
8. First Nomad deployment
- Create a nomad job definition with
nomad job init
command. - Adapt it to deploy the container you created on step 5.
9. Scale and load-balance
- Increase job definition count to run 3 container.
- Install Consul locally. (Hint: its Debian package should already be available as you should have installed the Hashicorp repositories for the Nomad install).
- Configure Nomad to use the newly installed Consul.
- Configure HAProxy to redirect port 8890 to those containers through service discovery.
Target: setup a distributed service + deploy from CI
10. Your Nomad joins the common cluster
- Reconfigure Nomad to only be a client.
- Use the common nomad by setting its settings to use the common consul (located at
consul.se4-virt.fr:8500
). (Hint, this example should help you). - You should see your Nomad instance on the common Nomad server and Consul.
11. Starting the "DevOps" way
- Create an account on Gitlab
https://git.se4-virt.fr
[1] - Create a group named
teamXX
- Create a repository named
web
under yourteamXX
group - Under this new repository, store your Dockerfile, your job definition and your static page
12. Automating deployments
This step will make all previous work deployable automatically from Gitlab. Sub steps will be detailed to help you.
- Edit your
project.nomad
file- Set job name to
teamXX-web
- Set memory requirement to 128 Mo
- Set CPU requirement to 250 MHz
- Set count to 4
- Set docker image to
registry.se4-virt.fr/tXX-web:${CI_COMMIT_SHORT_SHA}
- Set service name to
tXX-web
- Set service tag and port to
web
- Commit and push your changes
- Set job name to
- Copy and adapt the
.gitlab-ci.yml
available here (SE4 Virtualisation TP Wasilewski - Gitlab CI file)
Update job definition in repo / setup CI / deploy new configuration to global nomad
13. Releasing your website to the wild
Update global HAProxy configuration to redirect to the the newly deployed web service.
Your website should now be accessible through http://tXX.se4v.plil.info
Target: build and deploy more complex services
14. Creation of DHCP server
Create new repo as the web repo to build and push a dockerized DHCP server
15. Creation of TFTP server
Create a new repo as the web repo to build and push a dockerized TFTP server with ipxe
16. Creation of your custom Debian image
Create a new repo to build and push on S3 a debootstrap image of latest debian version
Target: boot an OS from the network
17. Host iPXE configuration
Update web server to host an ipxe configuration file boot this new OS
18. Create a remote block disk and use it
Mount `/home/xxx` as rbd volume from Ceph
Now the new OS boots and use remote storage for users.
Target: build a custom OS
19. Your first kernel
Build a kernel (Bonus: less than 50 Mo + boot time < 2s)
20. Your first init
Build an init that displays your team ID on the terminal (Bonus: pimped init banner)
21. Your second init
Build an init that starts network interfaces
Target: create a logging service
22. Even further with init
Create a script / service that request user credentials, checks its validity against /etc/passwd, then mount dynamically user's home from rbd
23. Finally, a working UI
Improve script and update initrd to have a window manager starting after logging