User:AvitalB/thesis prototyping: Difference between revisions

From XPUB & Lens-Based wiki
No edit summary
 
(27 intermediate revisions by the same user not shown)
Line 61: Line 61:


'''notebook server'''- can be interactive to one user and not a shared interface, but we can copy generated html pages for example.
'''notebook server'''- can be interactive to one user and not a shared interface, but we can copy generated html pages for example.


==Making a bot==
==Making a bot==
Line 73: Line 72:


[https://whoosh.readthedocs.io/en/latest/intro.html '''Whooshe''']- a preexisting library we can use to make the bot
[https://whoosh.readthedocs.io/en/latest/intro.html '''Whooshe''']- a preexisting library we can use to make the bot
'''NLTK'''- a library for handling texts


==Python==
==Python==
Line 84: Line 85:


'''the ElementTree'''- you can compare it to the inspect mode in html
'''the ElementTree'''- you can compare it to the inspect mode in html
==Install Kiwi IRC on sandbox==
[https://kiwiirc.com/ Kiwi website]
'''Apache'''- The Apache HTTP Server, colloquially called Apache, is a free and open-source cross-platform web server software, released under the terms of Apache License 2.0. Apache is developed and maintained by an open community of developers under the auspices of the Apache Software Foundation
* '''Download the package'''
  wget the ARMHF url from https://kiwiirc.com/downloads/
* '''Unzip the zip file we downloaded'''
now we have the config file.
* Kiwi is a multi client gateway between an IRC server to another server
=12/10=
==The XPUB server==
* '''XVM''' machine- virtual machine (IP 83.96.162.96)
* the machine runs a web server '''Nginx'''- set up with various virtual hosts (issue.xpub.nl, git.xpub.nl, xpub.nl)
* '''DNS''' Domain Name Service- exists for a long time have name (urls) instead of IP numbers
* '''IPv4''' the current protocol of IP addresses (192.168.x.x or 10.x.x.x which are private)
whois ''IP address'' - command to know who is this IP address
* '''Rpi / Sandbox''' is using the XVM to be public because it has a fixed IP address
* The '''hotline''' for example Ip is 85.14.245.135, uses a different machine, the one that jitsi is on
* PZI own some physical machines (still in the other PZI building), but we stopped using it because there were hardware failures and over-security issues.
==Reverse Proxy==
Any kind of redirection to another port on the same machine or another address/host completely.
* [https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/ '''Proxy_pass'''] - this is on the server configuration defines which address it will be directed to
* '''Public → Private''' - When we want to go to hub.xpub.nl/sandbox we are redirected to a private address which is the Sandbox (IP 10.0.11.1). This is being allowed by the configuration of XVM that allows access to the private address
* Sandbox is on someones home network, so the request goes through '''TINC''' which makes a direct connection from the public to the private. In theory we can move Sandbox and the IP will change and '''TINC''' will still be able to connect them
* '''TINC''' is a program that runs on both the machines you want to connect (public and private) uses tunnels and simulates a network 
==Setting up the chat==
* Switch Aphache to Nginx
* Configure the Nginx to have a reverse proxy rto the Kiwi
* '''Freenod''' - public server that we use\
apt remove apache
* '''Bag gateway'''- you have a proxy but there is nothing there
* '''Websocket''' a connection that stays open (not like http)
=26/10 Permissions=
Needs to be answered: Websocket/http (?)
Permissions are used to control how things are visible online.
<span style="background:yellow;">'''A lot of debugging has to do with permissions.'''</span>
ls -hl
This command shows what is runnable and the kind of permissions the file have.
'''chmod''' is the command and system call which is used to change the access permissions of file system objects. It is also used to change special mode flags. The request is filtered by the umask. The name is an abbreviation of change mode.
sudo chmod 777 index.html
The most access you can give to something.
Now we can edit index.html
sudo chown mmurtagh:publicweb index.html
this made Michael and the publicweb group are the owners (I can do it as well). Now Michael doesn't need to use sudo anymore.
sudo chown -R mmurtaugh:www-data index.html
Michael now own the folder as well
* first number- owner
* second number - the users group
* third number - everybody else
[[File:000.jpg|400px|thumbnail]]
=02/11=
'''VPS''' - virtual private server. Virtual- using a physical server with multiple people. You get to pick to join a server with a certain amount of users.
==Rpi==
'''SD card space''' - the Rpi 4 uses usb 3. You can plug a hard-drive into a pi but you need to mount it. So you can put all the software on the SD card but all the rest can be on the drive and then you can move it around. USB card and SD card has a limit of rewriting and it will be very slow.
'''Tinc''' -  a Virtual Private Network (VPN) daemon that uses tunnelling and encryption to create a secure private network between hosts on the Internet. tinc is Free Software and licensed under the GNU General Public License version 2 or later. Because the VPN appears to the IP level network code as a normal network device, there is no need to adapt any existing software.
==Setting Jupyter lab for all the users==
sed -i 's/old-text/new-text/g' input.txt
a command to switch text (find and replace)
[https://pad.xpub.nl/p/2020-11-02-xpub2 pad]
=09/11=
[https://pad.xpub.nl/p/2020-11-09-xpub2 pad for today]
'''.pkl file''' - format for storing live data structure and saving it ("like pickles).
started Jupyter Lab Server (avital)
Restart my lab server
=03/02/21=
https://pad.xpub.nl/p/sandbox-index
https://pad.xpub.nl/p/2021-02-03-xpub2
=CGI=
Cryptpad - interesting presentation project
CGI - common gateway interface
HTTP - the protocol of the web
The transaction with the server and a static website can be compared to a vending machine transaction. You make a request, it does it and that’s it.
CGI can be compared to a patat stand that there is someone that prepares it especially for you. That means that if many people request it it need to deal with multiple requests.
A hybrid is a combo of the two.
#! - this is the opening of the first line that defines what we are using
ex: #! /usr/bin/env python3
- command Whereis python3 to know what to hard code in the start
Form method- default is “get”
“Post” method - its like in an envelope and its not shown in the url
You need to run the cgi script in terminal to debug
If you request a page with 50 images, there will be 51 requests for the page and for the images

Latest revision as of 16:26, 13 March 2021

Infobot

Created by Kevin Lenzo

Bots can bridge between different systems (like we did in implicancies)

what's interesting about IRC is that it's like this social interface that then has the ability to have different kinds of "non-human" programs (bots) running alongside the users

it's very different from say a traditional server setup (like CGI or PHP, or a framework)

IRC doesn’t have a log- you can’t see what was written before you joined the chat, but it is more private

Config the infobot

ls conf

The main configuration file in infobot.config inside the conf folder

nano conf/infobot.config 

1. In the top of the file you can set a name for the bot (should probably be unique) Rooms in IRC are channels

2. In the file you can configure the rooms this bot will join at join_channles line

3. Setting the server- there are many IRC servers webchat.freenode.net is a "HTTP gateway" or portal that provides an HTML interface to the IRC http://irc.freenode.net:6667/ this should be the address of the sever using an irc client. probably it doesn't work because nowadays most people don't have IRC clients installed, or their systems aren't setup to handle the links. but the design of the URL was such to "bridge" these different systems, so it was supposed to work. many people still use IRC and IRC clients are alive and well. the pizza (poi chat) webchat is another software that gives a "portal" or "gateway" view of an XMPP channel in a web page

4. After we set the channel we need to run the program. In the folder we run the command ./infobot

5. When its running we see the log in terminal

DNS- domain name system

A mix between teaching the bot in the context of a chatroom, and then the fact that the bot builds a database that you could share with other.

so I used a command called update_db to update it with the techdict.facts file here: [1]

infobot says: I heard a computer was Technically, this is anything that inputs data, processes it in some way, and outputs it

what's novel about the infobot is that it's actually a read/write interface to a database that taps into chatrooms

or many of it's features now resemble what Google does with a search

or what Alexa, Siri, etc aims to do

the infobot is interesting because it's relatively simple and transparent

the database are simply files that it creates

if we quit the bot, you can see that a number of files are created

05/10

pad for the day

Notebook

With this tool we can combine markdown with code (python)

notebook server- can be interactive to one user and not a shared interface, but we can copy generated html pages for example.

Making a bot

Server-side programming-

CGI(common gateway interface) script- simplest translation of a shell script. python script translated to html pages. ex: if I write a script in python, add it to a server and trigger it by a url. This is used a lot by forms, when you submit a form it runs a script. Now with AJAX (javascript) it used to ways to send and receive stuff to and from server while inside a page rather than reloading.

IRC- Its like a parallel universe. It's a protocol which used IRC server and the you have clients (firefox, chrome, Kiwi) written in different languages. The IRC universe used just plain text (not html).

HTTP is not very sociable- it take a request and get one response (page) and then hangup.

Whooshe- a preexisting library we can use to make the bot

NLTK- a library for handling texts

Python

urlopen- like curl

parse- wrapper

libraries- this is what you work with in python

html5lib- a third party library you need to install

the ElementTree- you can compare it to the inspect mode in html

Install Kiwi IRC on sandbox

Kiwi website

Apache- The Apache HTTP Server, colloquially called Apache, is a free and open-source cross-platform web server software, released under the terms of Apache License 2.0. Apache is developed and maintained by an open community of developers under the auspices of the Apache Software Foundation


  • Download the package
 wget the ARMHF url from https://kiwiirc.com/downloads/
  • Unzip the zip file we downloaded

now we have the config file.

  • Kiwi is a multi client gateway between an IRC server to another server

12/10

The XPUB server

  • XVM machine- virtual machine (IP 83.96.162.96)
  • the machine runs a web server Nginx- set up with various virtual hosts (issue.xpub.nl, git.xpub.nl, xpub.nl)
  • DNS Domain Name Service- exists for a long time have name (urls) instead of IP numbers
  • IPv4 the current protocol of IP addresses (192.168.x.x or 10.x.x.x which are private)
whois IP address - command to know who is this IP address
  • Rpi / Sandbox is using the XVM to be public because it has a fixed IP address
  • The hotline for example Ip is 85.14.245.135, uses a different machine, the one that jitsi is on
  • PZI own some physical machines (still in the other PZI building), but we stopped using it because there were hardware failures and over-security issues.

Reverse Proxy

Any kind of redirection to another port on the same machine or another address/host completely.

  • Proxy_pass - this is on the server configuration defines which address it will be directed to
  • Public → Private - When we want to go to hub.xpub.nl/sandbox we are redirected to a private address which is the Sandbox (IP 10.0.11.1). This is being allowed by the configuration of XVM that allows access to the private address
  • Sandbox is on someones home network, so the request goes through TINC which makes a direct connection from the public to the private. In theory we can move Sandbox and the IP will change and TINC will still be able to connect them
  • TINC is a program that runs on both the machines you want to connect (public and private) uses tunnels and simulates a network

Setting up the chat

  • Switch Aphache to Nginx
  • Configure the Nginx to have a reverse proxy rto the Kiwi
  • Freenod - public server that we use\
apt remove apache
  • Bag gateway- you have a proxy but there is nothing there
  • Websocket a connection that stays open (not like http)

26/10 Permissions

Needs to be answered: Websocket/http (?)


Permissions are used to control how things are visible online.

A lot of debugging has to do with permissions.


ls -hl

This command shows what is runnable and the kind of permissions the file have.

chmod is the command and system call which is used to change the access permissions of file system objects. It is also used to change special mode flags. The request is filtered by the umask. The name is an abbreviation of change mode.


sudo chmod 777 index.html

The most access you can give to something. Now we can edit index.html


sudo chown mmurtagh:publicweb index.html

this made Michael and the publicweb group are the owners (I can do it as well). Now Michael doesn't need to use sudo anymore.


sudo chown -R mmurtaugh:www-data index.html

Michael now own the folder as well


  • first number- owner
  • second number - the users group
  • third number - everybody else
000.jpg


02/11

VPS - virtual private server. Virtual- using a physical server with multiple people. You get to pick to join a server with a certain amount of users.

Rpi

SD card space - the Rpi 4 uses usb 3. You can plug a hard-drive into a pi but you need to mount it. So you can put all the software on the SD card but all the rest can be on the drive and then you can move it around. USB card and SD card has a limit of rewriting and it will be very slow.

Tinc - a Virtual Private Network (VPN) daemon that uses tunnelling and encryption to create a secure private network between hosts on the Internet. tinc is Free Software and licensed under the GNU General Public License version 2 or later. Because the VPN appears to the IP level network code as a normal network device, there is no need to adapt any existing software.

Setting Jupyter lab for all the users

sed -i 's/old-text/new-text/g' input.txt

a command to switch text (find and replace)

pad


09/11

pad for today


.pkl file - format for storing live data structure and saving it ("like pickles).


started Jupyter Lab Server (avital)

Restart my lab server


03/02/21

https://pad.xpub.nl/p/sandbox-index

https://pad.xpub.nl/p/2021-02-03-xpub2


CGI

Cryptpad - interesting presentation project

CGI - common gateway interface HTTP - the protocol of the web The transaction with the server and a static website can be compared to a vending machine transaction. You make a request, it does it and that’s it.

CGI can be compared to a patat stand that there is someone that prepares it especially for you. That means that if many people request it it need to deal with multiple requests.

A hybrid is a combo of the two.

  1. ! - this is the opening of the first line that defines what we are using

ex: #! /usr/bin/env python3

- command Whereis python3 to know what to hard code in the start

Form method- default is “get” “Post” method - its like in an envelope and its not shown in the url

You need to run the cgi script in terminal to debug

If you request a page with 50 images, there will be 51 requests for the page and for the images