Differences

This shows you the differences between two versions of the page.

Link to this comparison view

ii:labs:05:tasks:02 [2022/01/16 17:25]
radu.mantu created
ii:labs:05:tasks:02 [2025/01/11 20:05] (current)
florin.stancu
Line 1: Line 1:
-==== 02. [??pThe compute engine ​====+==== 02. [25pChoosing a license ​====
  
-In this exercisewe will instantiate a virtual machine using the **gcloud compute** engine. This may not be as straightforward as you expect. The reason for this is that there are many aspects to considerFor example, in what datacenter do we want our instance to reside. Do we want public IP address assigned to it? Looking at the [[https://​cloud.google.com/​sdk/​gcloud/​reference/​compute/​instances/​create|gcloud compute instances create]] commandit may first appear intimidating. Let's take it step-by-step and discover ​what we need to create a VM. With each step, make sure to write down the parameters that you'll need later.+If you ever decide to publish code that you've writtennote that it will automatically fall under the protection of copyright law. This means that distributing copies of your code, or using it as a basis for something that may be construed ​as derivative work is prohibitedAs resultpeople will generally stay clear of your project since they don't know what your intentions are.
  
-=== [??pTask A Enabling ​the compute service ===+In the 1980s, [[https://​www.youtube.com/​watch?v=jUibaPTXSHk|Richard Stallman]] pioneered concepts known as __free software__ and __copyleft__. Free software is software distributed with a guarantee that the end user can modify and adapt it for whatever purpose, profit included. In order for this to happen, the user must have ultimate control over the software in question, which implies access to the source code. So, for a piece of software to become //"​free software"//​ it must include a public license such as the [[https://​www.gnu.org/​licenses/​gpl-3.0.html|GNU General Public License]], [[https://​opensource.org/​licenses/​MIT|MIT license]], etc. These licenses waive part of the author'​s rights and and grants them to the recipient of the software. Almost all free-software licenses contain a copyleft provision. This provision states that when modified versions of the free software are distributed,​ it must provide the same guarantees as the original, under the same license (or a more permissive one).
  
-Google Cloud offers ​number ​of servicesnone of which are enabled by default. One of them is the **compute** service (i.e.: ''​compute.googleapis.com''​) that lets us create VM instances. When running a command that requires a certain service that was not previously enabled, you get a prompt asking you if you want to enable it then and there. In this casewe'll do it manually. Note that this may take a bit of time, up to a couple of minutes.+In this exercise you will //​manually//​ add GPL license to your bot. If you want to learn more about different kinds of licenses (or licenses in general)listen to this episode ​of the Destination Linux podcastIf you want to go straight to the discussion on each individual licenseskip ahead 10m relative ​to the timestamp in the video.
  
-<code bash+<html><​center
-# get full list of available services +<iframe width="​700"​ height="​400"​ src="​https://​www.youtube.com/​embed/​dsm1SKqVsTQ?​controls=0&​amp;​start=406"​ title="​YouTube video player"​ frameborder="​0"​ allow="​accelerometer;​ autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"​ allowfullscreen></​iframe>​ 
-$ gcloud services list --available+</​center></​html>​
  
-# enable the compute service +=== [25p] Task A - Adding a GNU license ===
-$ gcloud services enable compute.googleapis.com +
-</​code>​+
  
-=== [??p] Task B Selecting ​base image ===+Following these [[https://​www.gnu.org/​licenses/​gpl-howto.en.html|indications]] on how to use GNU licenses, add GPLv3 to your project. Create a single commit with all the changes (i.e.: COPYING file, copyright notice, etc.) and push it. You don't need copyright disclaimer from the school, so don't worry about that part.
  
-First thing first. What OS do we want to run on our machine? A [[https://​www.microsoft.com/​en-us/​windows-server|Windows server]]? Maybe [[https://​www.centos.org/​|CentOS]]?​ Nay -- let's look for something familiar: Ubuntu. 
  
-<code bash> 
-# list available base VM images 
-$ gcloud compute images list 
-</​code>​ 
- 
-=== [??p] Task C - Selecting a region === 
- 
-All cloud providers worth their salt will offer you a number of physical locations (datacenters) where to deploy your instance. Locality is very important when offering web services. Normally, this is a difficult task. Can you imagine YouTube running on a single server somewhere in the US and you accessing it from SEA? Many people use [[https://​www.cloudflare.com/​learning/​cdn/​what-is-a-cdn/​|Content Delivery Networks (CDN)]] for this task. Even DigitalOcean,​ a rather important cloud provider uses CloudFlare as a proxy for their HTTP servers. 
- 
-<note important>​ 
-CDNs offer many advantages. The reason why DitigalOcean is using CloudFlare despite having the resources themselves is [[https://​www.cloudflare.com/​learning/​ddos/​what-is-a-ddos-attack/​|Distributed Denial of Service (DDoS) protection]]. This protection however, comes at a cost that is not necessarily monetary in nature. CDNs usually have access to the private communication between you and said HTTP server, even if you are using [[https://​www.cloudflare.com/​learning/​ssl/​why-is-http-not-secure/​|HTTPS]],​ all in cleartext. Why? Because they need to perform deep packet introspection in order to classify malicious traffic as such. 
-</​note>​ 
- 
-You can read up on Google'​s [[https://​cloud.google.com/​compute/​docs/​regions-zones|regions and zones]]. When working with your own funds and not with free tier accounts or education credits, you will want to consult their [[https://​cloud.google.com/​compute/​all-pricing|regional pricing model]]. Usually, US-based datacenters are much cheaper. 
- 
-<code bash> 
-# select a region and zone 
-$ gcloud compute zones list 
-</​code>​ 
- 
-=== [??p] Task D - Selecting a machine type === 
- 
-When selecting the number of Virtual CPUs (vCPU) and RAM for your VM, you will have to choose from a list of presets. These presets may vary depending on the region. 
- 
-<note important>​ 
-It is not unusual for cloud providers to limit the number of vCPUs that you may reserve, especially for personal accounts (i.e.: not organizations). AWS for example automatically imposed a 128 vCPU limit (across all VMs registered under an account) some time ago, for default users. This parameter was automatically set at account creation. So people who created AWS accounts a while back may have a 1024 vCPUs limit instead. The reason for this is to limit the losses that they may incur from a bad actor that registers a credit card with say, %%$%%5 and no intention to actually pay for their resource usage when charged. In AWS's case, this limit can be increased by contacting support. Since RAM is an inexpensive resource in comparison, it's not usually a limiting factor. 
-</​note>​ 
- 
-<code bash> 
-# show available flavors for your selected zone 
-$ gcloud compute machine-types list --zones "​${YOUR_ZONE}"​ 
-</​code>​ 
ii/labs/05/tasks/02.1642346717.txt.gz · Last modified: 2022/01/16 17:25 by radu.mantu
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0