<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Thanasis Politis on Medium]]></title>
        <description><![CDATA[Stories by Thanasis Politis on Medium]]></description>
        <link>https://medium.com/@havoc24k?source=rss-5002368748c7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*IZOcRxgwgCE0Vp0P.jpg</url>
            <title>Stories by Thanasis Politis on Medium</title>
            <link>https://medium.com/@havoc24k?source=rss-5002368748c7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 23:54:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@havoc24k/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Easy Kubernetes Deployments]]></title>
            <link>https://blog.7linternational.com/easy-kubernetes-deployments-9c9888edacde?source=rss-5002368748c7------2</link>
            <guid isPermaLink="false">https://medium.com/p/9c9888edacde</guid>
            <category><![CDATA[grpc]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[waypoints]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Thanasis Politis]]></dc:creator>
            <pubDate>Thu, 09 Jun 2022 10:29:06 GMT</pubDate>
            <atom:updated>2022-06-09T10:29:06.651Z</atom:updated>
            <content:encoded><![CDATA[<h3>Deploying a Go gRPC service in Kubernetes with Waypoint</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*Cm_YTUiz3Qh_1gXx4JM-2w.jpeg" /></figure><h3>Description</h3><p>In this tutorial we will be deploying a <strong>Go gRPC</strong> service in a <strong>Kubernetes</strong> cluster, exposed via <strong>nginx</strong> ingress, and using <strong>Waypoint</strong> by <strong>HashiCorp</strong> to build and deploy the container as well as configure the ingress controller to serve our gRPC endpoints.</p><blockquote>Waypoint allows developers to deploy, manage, and observe their applications through a consistent abstraction of underlying infrastructure. Waypoint works with Kubernetes, ECS and many other platforms. — <a href="https://www.waypointproject.io/">https://www.waypointproject.io/</a></blockquote><h3>Prerequisites</h3><ol><li>Basic knowledge of the <a href="https://go.dev/">Go</a> language.</li><li>Basic knowledge of <a href="https://developers.google.com/protocol-buffers">Protocol Buffers</a> and <a href="https://grpc.io/">gRPC</a>.</li><li>Access to a Kubernetes cluster and the .kube/config file configured.</li></ol><h3>Configuring our Kubernetes cluster</h3><p>If you don’t have access to a running Kubernetes cluster you can use a service like <a href="https://massivegrid.com/kubernetes/">MG PaaS for Kubernetes</a>. With only a few steps on the MG PaaS web console, you can have a fully running Kubernetes cluster with logging and monitoring via Prometheus and Grafana.</p><blockquote>You can visit <a href="https://massivegrid.com/kubernetes/">https://massivegrid.com/kubernetes/</a> and start your Free 14-Day Trial of the MG PaaS.</blockquote><p>1. Click New Environment and navigate to the Docker tab</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g_gfi4VhjHWLg9R92pKGsQ.png" /><figcaption>Screenshot from Jelastic UI, a division of Virtuozzo</figcaption></figure><p>2. Select “Kubernetes Cluster” from the list and click Create</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HIxT7zIC8rMaAwGYvYDb7g.png" /><figcaption>Screenshot from Jelastic UI, a division of Virtuozzo</figcaption></figure><p>3. Configure your cluster installation and define a domain name, then click install and the installation process will start.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tCMLwHCLkC5prPBDfaf6aQ.png" /><figcaption>Screenshot from Jelastic UI, a division of Virtuozzo</figcaption></figure><p>Once your cluster is up and running we will be able to access the Kubernetes API also via the access token and interact with the cluster via kubectl.</p><blockquote>Disclaimer: <a href="https://massivegrid.com/">MassiveGRID</a> is a partner of <a href="https://7linternational.com/">7L International</a>.</blockquote><h3>Waypoint setup</h3><p>First of all, go and install the <a href="https://www.waypointproject.io/downloads">Waypoint CLI</a> on your local machine.</p><p>Then I would strongly encourage you to follow the installation guide that already exists on the Waypoint website for installing the <a href="https://learn.hashicorp.com/collections/waypoint/get-started-kubernetes">Waypoint Server</a> on Kubernetes and configuring the Waypoint CLI accordingly.</p><p>After you finish that we can proceed to the next steps.</p><p>Done?</p><p>Great, let’s go!</p><h3>Go project setup</h3><p>Our project is quite minimal and you can download the full version from here</p><blockquote><a href="https://github.com/7Linternational/waypoint-grpc-k8s-tutorial">https://github.com/7Linternational/waypoint-grpc-k8s-tutorial</a></blockquote><p>For our Go gRPC code we are using the “HelloWorld” service example from the gRPC repo in <a href="https://github.com/grpc/grpc-go/tree/master/examples/helloworld/helloworld">Github</a>. Since it has the gRPC code ready to be used we are not generating the Go code from the protobuf files, we are instead using the code directly as-is from the helloworld folder.</p><p>Our main.go file creates a standard gRPC service listening on port :50051 and implements the SayHello method.</p><p>A very important step is that along with the gRPC service we also declare an HTTP service on port :8080 serving the /healthz endpoint. This is the endpoint that Kubernetes requires to check that a service has been successfully deployed. If Kubernetes cannot verify that the service is at a healthy state (aka 200 OK) then you cannot access the endpoint via the ingress controller.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f7e31afdfed899bcf737c5e83c6d7ce3/href">https://medium.com/media/f7e31afdfed899bcf737c5e83c6d7ce3/href</a></iframe><blockquote>Currently Kubernetes supports gRPC liveness probe endpoints as an optional feature and only from <a href="https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#define-a-grpc-liveness-probe">v1.23 and later</a>.</blockquote><h3>Anatomy of the waypoint.hcl file</h3><p><strong><em>The build block: </em></strong>It<strong><em> </em></strong>defines how we build our application. As you can see we do not have a Dockerfile on our project. We will instead be using the <a href="https://www.waypointproject.io/plugins/pack">Pack plugin</a>. This will allow us to build our container using buildpacks. Waypoint by default uses <a href="https://devcenter.heroku.com/articles/buildpacks">Heroku buildpacks</a>, but you can also define other sources such as <a href="https://paketo.io/docs/concepts/builders/">Paketo</a>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ee06f4a0e3196474ef11e425618bd677/href">https://medium.com/media/ee06f4a0e3196474ef11e425618bd677/href</a></iframe><p><strong><em>The deploy block: </em></strong>This<strong><em> </em></strong>is where we set the parameters for the Kubernetes deployment. We define the liveness probe endpoint and the ports that our container will be exposing.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3f151119f923ccae62d32a754aaeb5b3/href">https://medium.com/media/3f151119f923ccae62d32a754aaeb5b3/href</a></iframe><p><strong><em>The release block</em></strong> describes how we want to expose our service to the outside world. We use <strong>Nginx</strong> for our ingress controller and we want also to serve our traffic via TLS, provided by the LetsEncrypt service. By using some familiar Kubernetes configuration we are able to set the annotations needed to serve gRPC with TLS.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c379cf0e9bf13810b46002ee72670ebb/href">https://medium.com/media/c379cf0e9bf13810b46002ee72670ebb/href</a></iframe><p>With everything in place we should be ready to build and deploy our application by issuing the following command:</p><p>$ waypoint up</p><p>During the execution of the command the log output will show the following:</p><ol><li>The image is built by the Heroku buildpack and pushed to your configured container registry.</li><li>The Kubernetes deployment successfully rolled and the pods scaled.</li><li>The ingress controller is updated with the endpoint you defined in <strong>waypoint.hcl</strong>.</li></ol><p>We can verify the above by checking our cluster via the CLI</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-BCcFlzgveh2JlGVnp4yDg.png" /></figure><p>And of course, you can inspect the build and deploy process on the Waypoint web UI as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tOBqzx5FNUJZfH1OuYdyAw.png" /><figcaption>Waypoint UI Dashboard</figcaption></figure><h3>Test connectivity with gRPCurl</h3><p>As the name suggests <strong>grpcurl</strong> is a command-line tool that lets you interact with gRPC servers. It’s basically curl for gRPC (<a href="https://github.com/fullstorydev/grpcurl">https://github.com/fullstorydev/grpcurl</a>).</p><p>If everything has gone well so far when we exec $ grpcurl -vv -d &#39;{&quot;name&quot;:&quot;Thanasis&quot;}&#39; GRPC_URL:443 helloworld.Greeter/SayHello we should get a successful response.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PnpqEZn7F7ALa2PJwqWz7A.png" /><figcaption>Remember to replace GRPC_URL with your domain</figcaption></figure><blockquote>Interested in more cloud engineering solutions? Visit <a href="https://7linternational.com/services/cloud-infrastructure/">https://7linternational.com/services/cloud-infrastructure/</a> and talk to us about your cloud needs.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9c9888edacde" width="1" height="1" alt=""><hr><p><a href="https://blog.7linternational.com/easy-kubernetes-deployments-9c9888edacde">Easy Kubernetes Deployments</a> was originally published in <a href="https://blog.7linternational.com/">7L International</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Generate an SSH config file for your AWS instances]]></title>
            <link>https://blog.7linternational.com/generate-an-ssh-config-file-for-your-aws-instances-731e34cd5bd5?source=rss-5002368748c7------2</link>
            <guid isPermaLink="false">https://medium.com/p/731e34cd5bd5</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[ssh]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[ec2]]></category>
            <category><![CDATA[bash]]></category>
            <dc:creator><![CDATA[Thanasis Politis]]></dc:creator>
            <pubDate>Thu, 22 Feb 2018 10:17:47 GMT</pubDate>
            <atom:updated>2018-02-22T10:17:47.897Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AD9ZSLXKAhZ-_WomszsmPg.png" /></figure><p>When you have to support multiple clients on AWS finding the correct EC2 instance and get the IP to SSH into it can become a daunting task.</p><p>On a Linux system one of the most portable and simple ways to manage SSH connections is to use anssh config file. This is a simple text file residing in your .ssh folder and it contains the connection information for different SSH endpoints. For more information regarding that, check this very thorough article on <a href="https://www.cyberciti.biz/faq/create-ssh-config-file-on-linux-unix/"><strong>nixCraft</strong></a>.</p><p>Based on that approach we can create a simple python script that reads the EC2 information and creates a separate config file for the specific instances.</p><p>First we install the awscli command to have access to the AWS console via CLI.</p><p>$ pip3 install awscli</p><p>Then we run $ awscli configure and set our AWS security credentials as well as our default EC2 location.</p><p>Now let’s say that we have one AWS account for multiple clients and each client has multiple EC2 instances. One easy way to distinguish them in the AWS console is to add tags to them. For each EC2 we set the following tags, <em>name</em>, <em>environment</em>, and <em>client. </em>When we finish setting them up we end up with something that looks like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gUD28KVus6mlh0qjf8NTgQ.png" /></figure><p>Putting all this together we can run a python script that will generate an SSH config file. This file will contain an entry for each EC2 instance, also using the tags we set before the script will construct a unique hostname for each entry.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d8ece9eaee5f3b5a2e807dc6b2349a62/href">https://medium.com/media/d8ece9eaee5f3b5a2e807dc6b2349a62/href</a></iframe><p>After we generate the file successfully we can use it to connect to any of our EC2 instances.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8RVo2H7IdrWofF8BejP1Lw.gif" /></figure><p>Now whenever we update our AWS EC2 infrastructure, or an auto-scale event is triggered we can easily run the script again and get the latest and updated list of instances.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=731e34cd5bd5" width="1" height="1" alt=""><hr><p><a href="https://blog.7linternational.com/generate-an-ssh-config-file-for-your-aws-instances-731e34cd5bd5">Generate an SSH config file for your AWS instances</a> was originally published in <a href="https://blog.7linternational.com/">7L International</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Migrate tables from one PostgreSQL database to another using the INFORMATION_SCHEMA]]></title>
            <link>https://blog.7linternational.com/migrate-tables-from-one-postgresql-database-to-another-using-the-information-schema-def3eee2e38f?source=rss-5002368748c7------2</link>
            <guid isPermaLink="false">https://medium.com/p/def3eee2e38f</guid>
            <category><![CDATA[database]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[postgres]]></category>
            <category><![CDATA[sql]]></category>
            <dc:creator><![CDATA[Thanasis Politis]]></dc:creator>
            <pubDate>Thu, 04 Jan 2018 12:49:58 GMT</pubDate>
            <atom:updated>2018-01-04T13:25:15.127Z</atom:updated>
            <cc:license>https://creativecommons.org/publicdomain/mark/1.0/</cc:license>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xp6QflKA7OlWt6kuY9M4NA.jpeg" /></figure><blockquote><strong>“I know that I know nothing</strong>” — Socrates</blockquote><h3>The request</h3><p>Recently a client asked us to create a database migration process between two PostgreSQL databases. This would have been a very trivial process, but for the following restriction...</p><p><strong><em>We didn’t have access to the source database and the client could not provide us with the schema due to their strict data management policy.</em></strong></p><p>So in essence we had to create a script that would migrate a list of tables, schema and data, from one database to another without having to specify the exact schema for each table.</p><h3>The implementation</h3><p>Fortunately all SQL databases have the INFORMATION_SCHEMAem…schema. We read from the PostgreSQL <a href="https://www.postgresql.org/docs/9.5/static/information-schema.html">documentation</a> :</p><blockquote>The information schema consists of a set of views that contain information about the objects defined in the current database. The information schema is defined in the SQL standard and can therefore be expected to be portable and remain stable — unlike the system catalogs, which are specific to PostgreSQL and are modelled after implementation concerns.</blockquote><p>For our needs the data contained in the information schema were sufficient. All we have to do is get the columns and their properties for a specific table, this can be done by running the following SQL query.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b1caa9430a4c9d72ecc5897add5147c6/href">https://medium.com/media/b1caa9430a4c9d72ecc5897add5147c6/href</a></iframe><p><em>You can run the same query with </em><em>SELECT * to get the full list of information fields available.</em></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cde8ba93987f48a168d75a4c921987f1/href">https://medium.com/media/cde8ba93987f48a168d75a4c921987f1/href</a></iframe><p><em>Running the query for a simple table as an example we get the following results.</em></p><p>Using the information above we can construct the DROP TABLE...CREATE TABLE... query that we will run in the destination database.</p><p>Putting it all together we created a simple python script that you can find in the following link</p><blockquote><a href="https://gist.github.com/Havoc24k/d646eb54925e8777a01c45b33e4a0f68">https://gist.github.com/Havoc24k/d646eb54925e8777a01c45b33e4a0f68</a></blockquote><ol><li>Connects to the source and destination databases.</li><li>Reads a list of table names from an array.</li><li>It gets the schema data for each table using the PostgreSQL INFORMATION_SCHEMA and the table data using a simple SELECT *... query.</li><li>Dynamically creates and executes the DROP TABLE...CREATE TABLE... query.</li><li>Dynamically creates and executes the INSERT query that will insert the existing table data to the newly created table in the destination database.</li></ol><p>Before you execute the script you have to configure your database credentials and add the list of tables you want to be migrated. If anything goes wrong the script prints an error and <strong>does a rollback on all the queries</strong> that had run in the destination database. Also there is a -f flag that skips the prompt that asks the user to proceed with the import for each table.</p><p>Hope this posts helps others with similar needs. I am pretty sure that this can be done with other tools or methods but I find value in exploring the INFORMATION_SCHEMA, I consider it to be a hidden storage of information that can be used in different ways.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=def3eee2e38f" width="1" height="1" alt=""><hr><p><a href="https://blog.7linternational.com/migrate-tables-from-one-postgresql-database-to-another-using-the-information-schema-def3eee2e38f">Migrate tables from one PostgreSQL database to another using the INFORMATION_SCHEMA</a> was originally published in <a href="https://blog.7linternational.com/">7L International</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>