ungleich-learning-circle/youngjin.han/learning-node02-2020.org

330 lines
16 KiB
Org Mode
Raw Normal View History

* 2020-05-22
2020-05-22 15:22:18 +00:00
**** DONE Lecture content
CLOSED: [2020-05-23 토 00:21]
- Same structure as "Python #2"
- Exercises 15-22
**** Lecture material
- Available on https://cloud.ungleich.ch/s/435FyfrQyEq6oF3
2020-05-20 12:42:42 +00:00
* 2020-05-20
*** Python #2:
**** DONE Lecture content
CLOSED: [2020-05-20 수 22:47]
2020-05-20 12:42:42 +00:00
- Read thoroughly & do exercises 8 to 14
- Focus on understanding
- You don't have to type everything
- But you should ensure you understand everything
- Commit all source code to ~/ungleich-learning-circle/USERNAME/python-the-hard-way
- Write down notes / what you learned in the *python.org* file
- Notify your fellow students when you solved something
- "I just solved exercise 4!"
**** Lecture material
- Available on https://cloud.ungleich.ch/s/435FyfrQyEq6oF3
* 2020-05-15
2020-05-18 15:34:11 +00:00
*** Python #1:
**** Lecture notes
- Ensure that you have python3 (at least 3.6) installed
- Use emacs for editing source files
- Commit all source code to ~/ungleich-learning-circle/USERNAME/python-the-hard-way
2020-05-20 12:42:42 +00:00
**** DONE Lecture content
CLOSED: [2020-05-19 화 23:47]
2020-05-18 15:34:11 +00:00
- Read thoroughly & do exercise 0 to 7
- Commit your source code in git
- Commit every time you have a task done
- Make a new commit in git each time you finish (part of) a task
- Do all exercises
- Notify your fellow students when you solved something
- Ask help to other students when you are stuck (but try to solve
on your own before)
2020-05-20 12:42:42 +00:00
**** Lecture material
2020-05-18 15:34:11 +00:00
- Available on https://cloud.ungleich.ch/s/435FyfrQyEq6oF3
* 2020-05-15
*** cdist #6: Glueing it together
**** Lecture content
***** Objective
- Apply learnings from the previous cdist sessions
***** DONE Steps 1: *__all_in_one* (1.25h)
CLOSED: [2020-05-15 금 23:16]
- Create a new type named *__all_in_one*
- Decide yourself whether it is a singleton or not
- Reason why in your cdist.org file
- It should work on alpine, debian and fedora
- It accepts the following parameters:
- *--with-x* (boolean)
- *--extra-packages* (optional multiple)
- On Alpine, it should install netcat-openbsd and tshark
- On Debian, it should install netcat tshark
- On Fedora, it should install nmap-ncat wireshark-cli
- On all operating systems install socat sipcalc sudo
- If the detected operating system is neither
Alpine/Debian/Fedora, output an error message and abort the
manifest with exit code 1
- Additionally install all packages specified by the *--extra-packages* parameter
2020-05-17 14:43:35 +00:00
***** TODO Steps 2: *__firewall* (1.25h)
- Create a new type *__my_firewall*
- Add a *type explorer* to find out whether nft is present on
the target system
- Add a required parameter named *file*
- If the type explorer does not detect nft on the target system,
abort with an error message
- Deploy the specified file to */etc/my-nftables*
- Add a *type explorer* that reads the current nft rules
- If the rules are different on the target host, apply the new
ruleset by generating code in *gencode-remote*
- If the filename specified by the *file* parameter is *-* (the
minus sign), then the type should read from *stdin*
2020-05-17 14:43:35 +00:00
***** TODO Step 3: manifest (0.5h)
- Create a new manifest in the folder that contains the initial manifest
- Name the new manifest *firewall*
- Source the *firewall* manifest in the *initial* manifest
- In the *firewall* manifest, match on *localhost*
- Install nftables
- Use the *__firewall* type
- Use correct *require* parameter to ensure that nftables is
installed before the *__firewall* type is run
* 2020-05-13
*** cdist #5: Generating Code & Exploring
**** Lecture content
***** Objective
- Understand how to *generate code* and when to use it
- Exploring explorers
2020-05-13 15:55:29 +00:00
***** DONE Code generation steps
CLOSED: [2020-05-14 목 00:54]
- Modify the previously created type *__my_nginx_site*
- Read about cdist messaging
- If there was a change in the nginx configuration file, reload nginx
2020-05-13 15:55:29 +00:00
***** DONE Explorer steps
CLOSED: [2020-05-14 목 00:54]
- Modify the *__my_nginx_site* type to use the *os explorer*
- Adjust your type to work on Alpine Linux and Debian (or two
other Linux distributions of your choice)
- Set the nginx configuration directory accordingly
2020-05-13 15:55:29 +00:00
***** DONE Documentation
CLOSED: [2020-05-14 목 00:54]
- Explain the following in your cdist.org file
- What is the difference between gencode-remote and the remote code?
- What is the difference between gencode-local and gencode-remote?
- Locate a type that comes with upstream cdist that uses
gencode-local - which one is it? Why does it need gencode-local?
* 2020-05-11
*** cdist #4: Requirements
**** Lecture content
***** Objective
- Understand how requirements work
***** DONE Create a new type *__my_nginx*
CLOSED: [2020-05-12 화 02:22]
- Make it a *singleton*
- Make it install nginx
- Configure a host with it
- Usually nginx is configured includes some files
- On the target host find out which directory nginx includes
- We name this directory *nginx_config_dir*
***** DONE Create a new type *__my_nginx_site*
CLOSED: [2020-05-12 화 02:22]
- Assume the *object_id* is a *domain*
- In the __my_nginx_site create a file inside the *nginx_config_dir*
- The filename is *${domain}.conf*
- When using *__file*, it should *require* the *nginx package*
- Read about cdist dependencies
- The file should be a valid nginx configuration
- The *server name* should be set to the specified domain
- The *root* directive should point to /var/www/html/DOMAIN
- (replace DOMAIN with the actual domain)
***** DONE Use both types in the initial manifest to configure the target host
CLOSED: [2020-05-15 금 21:07]
- Create at least two domains
***** DONE Configure the target host
CLOSED: [2020-05-15 금 21:08]
- Verify that the configuration files are properly created
***** DONE Delete the nginx package manually on the target host
CLOSED: [2020-05-15 금 21:08]
***** DONE Comment out *__my_nginx* from the initial manifest, keep the *__my_nginx_site*
CLOSED: [2020-05-15 금 21:08]
- Explain the error that you get (in your cdist.org file)
* 2020-05-08
*** cdist #3: type parameters
**** Lecture content
***** DONE Create a new type named *__colourful_file*
CLOSED: [2020-05-15 금 20:29]
- The objective is to create a type that creates colourful file
- The content of the file should be "colour=...", where "..." is a colour specified by a parameter
- Add an *optional parameter* named *colour*
- Use the **__file** type inside your type to create a file
- Use the *$__object_id* variable inside your type
***** DONE Extend your type to be more colourful
CLOSED: [2020-05-15 금 20:29]
- Modify the *optional parameter* to be able to be specified *multiple times*
- For each time it is specified, add a line "colour=..." to the file
***** DONE Create a new type *__my_dotfiles*
CLOSED: [2020-05-15 금 21:07]
- Objective is to manage the dotfiles in your home directory
- Make it a *singleton* type
- Create a sub directory *files* in the type
- Add your .emacs config to the files folder
- Add a *for* loop to your type to deploy .[A-z]* to your home directory
- Add a .bashrc or .zshrc to the files folder (depending on your shell)
- In the initial manifest, add __my_dotfiles when the target host is localhost
***** DONE As usual commit all changes to your ungleich-learning-circle repo
CLOSED: [2020-05-15 금 21:07]
2020-05-06 14:04:02 +00:00
* 2020-05-06
2020-05-17 14:43:35 +00:00
*** cdist #2: Your first cdist type
2020-05-06 14:04:02 +00:00
**** Lecture content
***** Objective
****** Begin to understand how cdist types function
***** Steps
2020-05-17 14:43:35 +00:00
****** Create a new type named `__my_computer`
- Mark the type as a singleton type
- Create a `manifest` file in it
- Use this type to install the following packages: zsh, mosh, emacs, nmap, sipcalc
- Edit the *initial manifest* and use **__my_computer** for **localhost**
- Match using the $__target_host variable
****** Modify your type to use a *for loop* to install the packages
****** Deploy / manage your ~/.emacs file in this type
- Ensure that permissions and ownership are correct
****** Use different *verbosity* levels when configuring
****** Ensure that all your changes are committed and pushed in your ungleich-learning-circle repository
- Use magit inside emacs for that
***** Documentation steps to be done in cdist.org
- Create a new org document named `cdist.org` in the same folder as the learning.org file
- Explain the difference between a singleton and non-singleton type
- Explain the difference between the different verbosity levels
- Document (copy&paste) some of the cdist runs in a "log" section```
2020-05-04 16:04:57 +00:00
* 2020-05-04
*** cdist #1: Introduction
**** Lecture content
***** Objective
2020-05-17 14:43:35 +00:00
- Begin to use cdist
***** Steps
2020-05-17 14:43:35 +00:00
- Checkout cdist quickstart https://www.cdi.st/manual/latest/cdist-quickstart.html
- Install cdist locally
- Create a new cdist configuration directory in ~/ungleich-learning-circle/USERNAME/dot-cdist
- Create an empty initial manifest ("use touch")
- Commit that status
- Ensure that you can login as root to localhost via ssh without a password
- Configure cdist to configures the motd of your localhost
- Ensure you have a case block matching on $__target_host
- Use the -c parameter to cdist to specify the configuration directory
- Use the -vv parameter to get more verbose output
- Search for / understand what MOTD stands for
- Configure cdist to create the file /etc/cdist-configured
- Configure cdist to setup the timezone on your local computer
- Configure cdist to ensure emacs is installed
- Ensure that in the end all changes are committed in your repository
* 2020-05-01
2020-05-01 14:32:09 +00:00
*** Organisation #5: Emacs refresher
**** Lecture content
***** Objective: get confident with emacs commands
***** Find out and document how to do the following steps
2020-05-17 14:43:35 +00:00
- Search for something forward C-s
- How to continue searching C-s C-s
- Search for something backward C-r
- Search for regular expressions instead of string (forward, backward) C-M-s C-M-r
- Go to the beginning of the line C-a
- Go to the end of the line C-e
- Delete a word in front (to the right of the cursor) M-d
- Delete a word in back (to the left of the cursor) M-BackSpace
- List all "occurences" of a word in a file M-s o
- You can copy above instructions into an emacs buffer
- And test it by showing all occurences of the word "Search"
- Search (GREP) for a word in all files in a directory RECURSIVELY M-x rgrep
- Save the CURRENT buffer C-x C-s
- Save ALL open files C-x-s
- Split the window/buffer vertically C-x 2
- Split the window/buffer horizontally C-x 3
- Switch between the different windows C-x o
- Close all buffers besides the active one C-x 1
- Don't kill it!
- Close only the active buffer C-x 0
-* Don't kill it!
- Kill the active buffer C-x k
- Describe/Explain the difference between closing and killing
- closing is that emac do not display the buffer. and the contents on the buffer are kept on behined screen.
- killing is that emac delete the buffer. and if contents are not stored, it is losted
- Switch between buffers that are not shown C-x b
- Document two very similar, but slightly different ways
- C-x b is that the selected buffer is displayed on the focused window
- C-x C-b is that all buffers is dispalayed on the new window
- C-x 4 b is that the selected buffer is displayed on the new window
2020-05-01 14:32:09 +00:00
***** Outcome
2020-05-17 14:43:35 +00:00
- Document all above commands in your learning org sheet
- Share your documentation at the end of the session (not before)
2020-05-04 16:04:57 +00:00
* 2020-04-29
*** Organisation #4: Organising yourself
**** Lecture content
***** Objective: have a todo list based on org mode
***** Steps
2020-05-17 14:43:35 +00:00
- Configure the "org-directory" to be ~/ungleich-learning-circle/USERNAME/
- This is important as it will be used by the todo function later
- Extend your function from the organisation #1 session
- Instead of opening a fixed file, we include two variable parts:
- The hostname of the machine
- The year
- Pressing F3 should open ~/ungleich-learning-circle/USERNAME/learning-$(hostname)-$(year).org
- we call this "your personal agenda"
- Configure mu4e to create a org-mode tasks from an email
- Store these tasks in ~/ungleich-learning-circle/USERNAME/todo.org
- Configure emacs to open the "org-agenda" with "C-c a"
- List all TODO entries
- List the agenda of the day
- List the agenda of the week
- Bind F8 to open the "org-todo-list"
- Create some sample tasks in it
2020-05-04 16:04:57 +00:00
***** From now on, maintaining tasks should be
2020-05-17 14:43:35 +00:00
- Pressing F3 to open your personal "logfile"
- Adding a TODO item
- Pressing F8 to see the tasks with priorities
2020-05-04 16:04:57 +00:00
***** Bonus tasks
2020-05-17 14:43:35 +00:00
- Configure mu4e to store org-mode tasks in .../todo-$(hostname)-$(year).org
2020-05-04 16:04:57 +00:00
* 2020-04-27
*** Organisation #3: Managing your emails
**** Lecture content
***** Objective
2020-05-17 14:43:35 +00:00
- Be able to manage all your mails in mu4e
2020-05-04 16:04:57 +00:00
***** Description
2020-05-17 14:43:35 +00:00
- All email is synchronised using isync/mbsync
- Email is indexed with mu (xapian backend)
- Email is viewed in mu4e
- All new emails arrive in the inbox
2020-05-04 16:04:57 +00:00
***** Steps
2020-05-17 14:43:35 +00:00
- Install mu4e
- Start mu4e in emacs
- Configure mbsync for your ungleich mail account
- Synchronise all mails into ~/Maildir/ungleich
- This structure leaves room for other mail accounts, like ~/Maildir/gmail
- Verify that mbsync synchronises the mail
- Index mails using `mu` on the command line (only first time)
- Configure mu4e to get email with mbsync -a
- Configure mu4e to "archive" emails into ~/Maildir/ungleich/YEAR/
- This gives you a good performance / organisation for the next decades
- Configure mu4e/emacs for sending emails
- Send other participants an email via mu4e
- Verify that it arrives
- "Archive" it afterwards
2020-05-04 16:04:57 +00:00
* 2020-04-24
*** Organisation #2: Creating, managing and sharing with "magit"
**** Lecture content
***** Install "magit" for emacs
***** Bind C-x g to open magit-status in ~/.emacs
***** Create a new directory ~/ungleich-learning-circle/ (with emacs)
2020-05-17 14:43:35 +00:00
- Use C-h b in dired mode to find out how to
2020-05-04 16:04:57 +00:00
***** Create a sub directory ~/ungleich-learning-circle/YOURNAME/ (with emacs)
***** Move your previously created learning.org file into ~/ungleich-learning-circle/YOURNAME/ (with emacs)
***** Initialise it with git (with magit)
***** Create the repo "ungleich-learning-circle" on code.ungleich.ch under your username
***** Add your remote on code.ungleich.ch to your local git repo with magit
***** Push your repo
***** Add a new remote of a another participant
***** Move your ~/learning.org to ~/notes
***** Commit that file with magit
***** Push the repo with magit
***** Merging the remote repo with the command line
***** End result: everyone has everything of everyone else
* 2020-04-23
*** Organisation #1: org-mode introduction
**** Lecture content
***** Install emacs
***** Install org-mode
***** Create a function that opens ~/learning.org in your ~/.emacs
***** Bind that function to "f3" (configure it in .emacs)
***** Create a new item named "2020-04-10"
2020-05-17 14:43:35 +00:00
- Create a sub item "ungleich learning circle"