<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Infrastructure &amp; Reliability on Pablo Seminario</title><link>https://seminar.io/categories/infrastructure--reliability/</link><description>Recent content in Infrastructure &amp; Reliability on Pablo Seminario</description><generator>Hugo</generator><language>en</language><lastBuildDate>Mon, 03 Sep 2018 18:48:00 +0000</lastBuildDate><atom:link href="https://seminar.io/categories/infrastructure--reliability/index.xml" rel="self" type="application/rss+xml"/><item><title>Building a serverless Telegram bot</title><link>https://seminar.io/posts/building-serverless-telegram-bot/</link><pubDate>Mon, 03 Sep 2018 18:48:00 +0000</pubDate><guid>https://seminar.io/posts/building-serverless-telegram-bot/</guid><description>&lt;p&gt;With the arrival of &lt;a href="https://en.wikipedia.org/wiki/Function_as_a_service"&gt;FaaS&lt;/a&gt; and all the serverless infrastructure providers (AWS, Google Cloud, Azure, etc) now is easy to deploy our own Telegram bot.&lt;/p&gt;&#10;&lt;p&gt;A Webhook-based bot it&amp;rsquo;s the perfect use case for serverless computing, using for example Google Cloud Functions we&amp;rsquo;ll have all these advantages:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Our function will be associated to a public endpoint (IPv4 and IPv6) over HTTPS (using a valid certificate provided by Google)&lt;/li&gt;&#10;&lt;li&gt;Pay only for function invocations and its compute resources consumption, so it could be cheaper than paying for a server powered on all the time&lt;/li&gt;&#10;&lt;li&gt;No server management&lt;/li&gt;&#10;&lt;li&gt;Scales automatically&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h4 id="requirements"&gt;Requirements&lt;/h4&gt;&#10;&lt;p&gt;Before start building your bot you&amp;rsquo;ll need to:&lt;/p&gt;&#10;&lt;ul&gt;&#10;&lt;li&gt;Register a new bot following these instructions &lt;a href="https://core.telegram.org/bots#3-how-do-i-create-a-bot"&gt;core.telegram.org/bots&lt;/a&gt; in order to get an API token&lt;/li&gt;&#10;&lt;li&gt;Using a Google Cloud account, register a new project, enable the Cloud Functions API and install the Cloud SDK following &lt;a href="https://cloud.google.com/functions/docs/quickstart"&gt;the official quickstart&lt;/a&gt;&lt;/li&gt;&#10;&lt;/ul&gt;&#10;&lt;h4 id="code"&gt;Code&lt;/h4&gt;&#10;&lt;p&gt;In a few lines of Python you can code a simple echo bot that will reply with the same message that it receives:&lt;/p&gt;&#10;&#10;&#10;&#10;&#10;&lt;div class="code-block"&gt;&#10; &lt;div class="code-block__bar"&gt;&#10; &lt;span&gt;text&lt;/span&gt;&#10; &lt;span&gt;text&lt;/span&gt;&#10; &lt;/div&gt;&#10; &lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# main.py&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;import os&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;import telegram&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;def webhook(request):&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; bot = telegram.Bot(token=os.environ[&amp;#34;TELEGRAM_TOKEN&amp;#34;])&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; if request.method == &amp;#34;POST&amp;#34;:&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; update = telegram.Update.de_json(request.get_json(force=True), bot)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; chat_id = update.message.chat.id&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; # Reply with the same message&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; bot.sendMessage(chat_id=chat_id, text=update.message.text)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; return &amp;#34;ok&amp;#34;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;The only dependency needed is the amazing &lt;a href="https://python-telegram-bot.org/"&gt;python-telegram-bot&lt;/a&gt; library:&lt;/p&gt;&#10;&#10;&#10;&#10;&#10;&lt;div class="code-block"&gt;&#10; &lt;div class="code-block__bar"&gt;&#10; &lt;span&gt;text&lt;/span&gt;&#10; &lt;span&gt;text&lt;/span&gt;&#10; &lt;/div&gt;&#10; &lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;# requirements.txt &#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;python-telegram-bot==11.1.0&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#10;&lt;/div&gt;</description></item><item><title>Notes about Android and IPsec on Linux</title><link>https://seminar.io/posts/notes-about-android-and-ipsec-on-linux/</link><pubDate>Sat, 23 Apr 2016 21:35:00 +0000</pubDate><guid>https://seminar.io/posts/notes-about-android-and-ipsec-on-linux/</guid><description>&lt;p&gt;Here&amp;rsquo;s some personal notes about the excellent Jeff Sharkey&amp;rsquo;s article &lt;a href="http://jsharkey.org/blog/2012/09/22/deploying-a-pure-ipsec-pki-vpn-server-for-android-devices/"&gt;Deploying a pure-IPsec PKI VPN server for Android devices&lt;/a&gt;&lt;/p&gt;&#10;&lt;p&gt;My setup is a little bit different to that of Jeff, I have a 1Gbps fiber plan, a Linux server natted behind my ISP&amp;rsquo;s router and my IPsec VPN server is running on a Linux container (LXC), so this container doesn&amp;rsquo;t have a public IP address. The OS used in all the servers is Ubuntu Trusty 14.04.&#10;On the VPN client side I&amp;rsquo;m using Android 6.0 Mashmallow.&lt;/p&gt;</description></item><item><title>You Build It, You Run It</title><link>https://seminar.io/links/you-build-it-you-run-it/</link><pubDate>Sun, 05 Apr 2015 20:38:00 +0000</pubDate><guid>https://seminar.io/links/you-build-it-you-run-it/</guid><description>&lt;blockquote&gt;&#10;&lt;p&gt;Giving developers operational responsibilities has greatly enhanced the quality of the services, both from a customer and a technology point of view. The traditional model is that you take your software to the wall that separates development and operations, and throw it over and then forget about it. Not at Amazon. You build it, you run it. This brings developers into contact with the day-to-day operation of their software. It also brings them into day-to-day contact with the customer. This customer feedback loop is essential for improving the quality of the service.&lt;/p&gt;</description></item><item><title>DNS resolution for LXC in Ubuntu 14.04</title><link>https://seminar.io/posts/dns-resolution-for-lxc-in-ubuntu-trusty/</link><pubDate>Sun, 27 Jul 2014 15:28:00 +0000</pubDate><guid>https://seminar.io/posts/dns-resolution-for-lxc-in-ubuntu-trusty/</guid><description>&lt;p&gt;Working with &lt;a href="https://linuxcontainers.org/"&gt;LXC&lt;/a&gt; (Linux containers) in Ubuntu&#10;is very easy but by default you need to know the IP address of new containers&#10;to connect to services (ssh, database, webserver, etc.) running on them.&lt;/p&gt;&#10;&lt;p&gt;With some minor configuration you can connect to your containers using a domain&#10;name like that&lt;/p&gt;&#10;&#10;&#10;&#10;&#10;&lt;div class="code-block code-block--term"&gt;&#10; &lt;div class="code-block__bar"&gt;&#10; &lt;span&gt;terminal&lt;/span&gt;&#10; &lt;span&gt;bash&lt;/span&gt;&#10; &lt;/div&gt;&#10; &lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$ sudo lxc-create --name container1&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$ sudo lxc-start --name container1 --daemon&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;$ ssh ubuntu@container1.lxc&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;In Ubuntu 14.04 Trusty Tahr, &lt;code&gt;lxc-create&lt;/code&gt; use by default the Ubuntu template&#10;and it will create a user called &lt;code&gt;ubuntu&lt;/code&gt;, to change it take a look at the&#10;template options with &lt;code&gt;lxc-create -t ubuntu -h&lt;/code&gt;.&lt;/p&gt;</description></item><item><title>Do not program defensively</title><link>https://seminar.io/links/do-not-program-defensively/</link><pubDate>Thu, 19 Dec 2013 08:49:00 +0000</pubDate><guid>https://seminar.io/links/do-not-program-defensively/</guid><description>&lt;blockquote&gt;&#10;&lt;p&gt;Most of the code in the system should be written with the assumption that the input data to the function in question is correct. Only a small part of the code should actually perform any checking of the data. This is usually done when data &lt;strong&gt;enters&lt;/strong&gt; the system for the first time, once data has been checked as it enters the system it should thereafter be assumed correct.&lt;/p&gt;&#10;&lt;/blockquote&gt;&#10;&lt;p&gt;&lt;em&gt;source: Program Development Using Erlang&lt;/em&gt;&lt;/p&gt;</description></item><item><title>The value of breaking the law</title><link>https://seminar.io/links/the-value-of-breaking-the-law/</link><pubDate>Wed, 17 Jul 2013 08:20:00 +0000</pubDate><guid>https://seminar.io/links/the-value-of-breaking-the-law/</guid><description>&lt;p&gt;Interesting post and essay about the value and the ability to break the law.&lt;/p&gt;&#10;&lt;p&gt;&lt;em&gt;source: &lt;a href="http://www.schneier.com/"&gt;Bruce Schneier&amp;rsquo;s blog&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;</description></item><item><title>Running Scrapy on Amazon EC2</title><link>https://seminar.io/posts/running-scrapy-on-amazon-ec2/</link><pubDate>Tue, 26 Mar 2013 16:21:00 +0000</pubDate><guid>https://seminar.io/posts/running-scrapy-on-amazon-ec2/</guid><description>&lt;p&gt;Sometimes can be useful to crawl sites with &lt;a href="http://scrapy.org/"&gt;Scrapy&lt;/a&gt; using temporary&#10;resources on the cloud, and Amazon EC2 is perfect for this task.&#10;You can launch an Ubuntu OS instance and schedule your spiders using the Scrapyd API.&#10;With &lt;a href="http://boto.readthedocs.org/"&gt;boto&lt;/a&gt;, a python interface to Amazon Web Services,&#10;you can launch instances and install the scrapy daemon using the user data feature to run a script on boot.&lt;/p&gt;&#10;&lt;p&gt;First, you need an AWS account with your access keys, a EC2 security group&#10;accepting TCP connections on port 6800 and a key pair for the selected region.&#10;After that you must choose an Ubuntu EC2 image, here you can find a list&#10;of &lt;a href="http://cloud-images.ubuntu.com/locator/ec2/"&gt;Ubuntu AMIs&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>World IPv6 day</title><link>https://seminar.io/posts/world-ipv6-day/</link><pubDate>Wed, 06 Jun 2012 21:53:00 +0000</pubDate><guid>https://seminar.io/posts/world-ipv6-day/</guid><description>&lt;p&gt;To celebrate the &lt;a href="http://www.worldipv6launch.org/"&gt;world IPv6 day&lt;/a&gt;&#10;I decided to activate IPv6 on this blog.&#10;Now you can visit my site with native IPv6 connectivity.&lt;/p&gt;&#10;&lt;p&gt;If you want to know more about IPv6 you can start reading this&#10;&lt;a href="http://www.google.com/intl/en/ipv6/"&gt;overview&lt;/a&gt;.&lt;/p&gt;</description></item><item><title>Installing Solr on Debian 6.0</title><link>https://seminar.io/posts/installing-solr-on-debian-6-0/</link><pubDate>Tue, 22 Feb 2011 19:29:00 +0000</pubDate><guid>https://seminar.io/posts/installing-solr-on-debian-6-0/</guid><description>&lt;blockquote&gt;&#10;&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; this is an old blog post, Solr is now included in Debian since 7.0, it can be installed through apt-get by calling &lt;code&gt;apt-get install solr-tomcat&lt;/code&gt;.&lt;/p&gt;&#10;&lt;/blockquote&gt;&#10;&lt;p&gt;Recently I&amp;rsquo;ve been working on a Django project that uses the&#10;&lt;a href="http://haystacksearch.org/"&gt;Haystack&lt;/a&gt; search API and the&#10;&lt;a href="http://lucene.apache.org/solr/"&gt;Solr&lt;/a&gt; search engine to perform full text&#10;searching on indexed data.&lt;/p&gt;&#10;&lt;p&gt;This project was initially deployed on a Debian 5.0 (Lenny) server with some&#10;issues with Tomcat, but using the latest stable release of Debian (code named&#10;&lt;a href="http://www.debian.org/releases/squeeze/"&gt;Squeeze&lt;/a&gt;) install Tomcat 6 and Solr is&#10;very easy.&lt;/p&gt;</description></item><item><title>ext4 support in Ubuntu Intrepid 8.10</title><link>https://seminar.io/posts/ext4-support-in-ubuntu-intrepid-8-10/</link><pubDate>Wed, 01 Jul 2009 01:34:00 +0000</pubDate><guid>https://seminar.io/posts/ext4-support-in-ubuntu-intrepid-8-10/</guid><description>&lt;p&gt;This is just a simple tip to use ext4 filesystems in Ubuntu Intrepid Ibex 8.10.&#10;On Ubuntu Jaunty ext4 filesystems is fully supported but in Intrepid was on development.&#10;To use it we must load the module &lt;code&gt;ext4dev&lt;/code&gt;&lt;/p&gt;&#10;&#10;&#10;&#10;&#10;&lt;div class="code-block code-block--term"&gt;&#10; &lt;div class="code-block__bar"&gt;&#10; &lt;span&gt;terminal&lt;/span&gt;&#10; &lt;span&gt;bash&lt;/span&gt;&#10; &lt;/div&gt;&#10; &lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;sudo modprobe ext4dev&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;to check the filesystems supported by the kernel we can do&lt;/p&gt;&#10;&#10;&#10;&#10;&#10;&lt;div class="code-block code-block--term"&gt;&#10; &lt;div class="code-block__bar"&gt;&#10; &lt;span&gt;terminal&lt;/span&gt;&#10; &lt;span&gt;bash&lt;/span&gt;&#10; &lt;/div&gt;&#10; &lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;cat /proc/filesystems&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#10;&lt;/div&gt;&#10;&lt;p&gt;there should be a line with &lt;code&gt;ext4dev&lt;/code&gt;.&#10;Now, if we try to mount a formatted partition as ext4, we will see that it&amp;rsquo;s not possible&lt;/p&gt;</description></item><item><title>Mi clave GPG comprometida</title><link>https://seminar.io/posts/mi-clave-gpg-comprometida/</link><pubDate>Mon, 22 Sep 2008 14:53:00 +0000</pubDate><guid>https://seminar.io/posts/mi-clave-gpg-comprometida/</guid><description>&lt;p&gt;Con el robo de &lt;span style="font-style: italic;"&gt;amidala&lt;/span&gt; (mi laptop) mi clave GPG privada que iba dentro quedo comprometida. Pero con la copia de la clave privada y del certificado de revocación que tenía revoké mi clave en pks.lugmen.org.ar&lt;br /&gt;&lt;/p&gt;&#10;&lt;div class="code"&gt;&lt;pre&gt;&#10;gpg --import revoke-cert.asc&#10;gpg --keyserver pks.lugmen.org.ar --send-keys 555B6773&#10;&lt;/pre&gt;&lt;/div&gt;&#10;Con esto no se borra mi clave en el servidor pero ya aparece como revocada.</description></item><item><title>Keysigning Party @LUGMen</title><link>https://seminar.io/posts/keysigning-party-lugmen/</link><pubDate>Fri, 13 Jun 2008 02:36:00 +0000</pubDate><guid>https://seminar.io/posts/keysigning-party-lugmen/</guid><description>&lt;p&gt;&lt;a href="http://picasaweb.google.com/pabluk/KeysigningPartyLUGMen" target="_blank"&gt;&lt;img alt="" src="http://lh6.ggpht.com/pabluk/SFHdHSeHjOI/AAAAAAAAELg/8ZOUshkAkko/s144/dscn5492.jpg" style="float: left; margin: 0 10px 0 0;" /&gt;&lt;/a&gt;&#10;Como algunos sabrán y para los que no también, en la reunión pasada de &lt;a href="http://www.lugmen.org.ar/" target="_blank"&gt;LUGMen&lt;/a&gt; se hizo una &lt;a href="http://www.cryptnet.net/fdp/crypto/keysigning_party/en/keysigning_party.html" target="_blank"&gt;keysigning party&lt;/a&gt;, hace casi una semana, pero por los efectos del alcohol olvidé mi cámara con las fotos de la reunión en la casa de unos amigos :P&#10;Pero acá están. Solo faltaron 2 de los 15 que confirmaron su presencia. Se habló sobre criptografía, nos reímos de los nombres reales y las fotos de los documentos de cada uno, y como siempre hubo tortitas y &lt;span style="font-style: italic;"&gt;Coca-Cola&lt;/span&gt;®.&#10;Así quedo actualmente mi anillo de confianza&lt;/p&gt;</description></item><item><title>Instalando una TDM400P sobre Etch</title><link>https://seminar.io/posts/instalando-una-tdm400p-sobre-etch/</link><pubDate>Wed, 22 Nov 2006 12:23:00 +0000</pubDate><guid>https://seminar.io/posts/instalando-una-tdm400p-sobre-etch/</guid><description>&lt;h3 id="introducción"&gt;Introducción&lt;/h3&gt;&#10;&lt;p&gt;Para que &lt;a href="http://www.asterisk.org/"&gt;Asterisk&lt;/a&gt; pueda hacer uso de la red telefónica conmutada (PSTN) es necesario contar con una interfaz, la misma la proveen los módulos de hardware FXS o FXO, que permiten la interconexión directamente a teléfonos o a las líneas telefónicas. En mi caso tengo una TDM400P que tiene integrados dos módulos FXO y dos módulos FXS. Todo esto lo haremos funcionar sobre un Debian GNU/Linux Etch con kernel 2.6.17.&lt;/p&gt;</description></item></channel></rss>