<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: pebl</title>
    <description>The latest articles on DEV Community by pebl (@pebl).</description>
    <link>https://dev.to/pebl</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Forganization%2Fprofile_image%2F6758%2F8f59be7e-22b0-4b55-9cbf-c8a0c6179108.png</url>
      <title>DEV Community: pebl</title>
      <link>https://dev.to/pebl</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pebl"/>
    <language>en</language>
    <item>
      <title>Hosting static websites with versioning for free</title>
      <dc:creator>Jin Lee</dc:creator>
      <pubDate>Wed, 23 Aug 2023 03:58:35 +0000</pubDate>
      <link>https://dev.to/pebl/hosting-static-websites-with-versioning-for-free-1a49</link>
      <guid>https://dev.to/pebl/hosting-static-websites-with-versioning-for-free-1a49</guid>
      <description>&lt;p&gt;Pebl is a cloud computer.&lt;/p&gt;

&lt;p&gt;It is the first cloud platform that meets developers where they are the most comfortable — code. No more configs. Just embed the cloud right into your application with pebl's cloud SDK.&lt;/p&gt;

&lt;p&gt;We just released &lt;a href="https://blog.pebl.io/release-13"&gt;pebl v0.1.2&lt;/a&gt; which includes support for versioned folders. This makes it super easy to host static websites with versioning, meaning that you can quickly rollback to previous versions of your website!&lt;/p&gt;

&lt;p&gt;This should only take you about five minutes. If you run into any issues, hop on our &lt;a href="https://discord.gg/qV67JnJMZZ"&gt;discord&lt;/a&gt; to ask for help.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setup
&lt;/h2&gt;

&lt;p&gt;We will be continuing from our first guide where we &lt;a href="https://dev.to/pebl/host-your-react-angular-svelte-or-any-other-framework-for-free-with-pebl-5bl1"&gt;configured static web hosting with pebl&lt;/a&gt;. Follow the tutorial before continuing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Versioning
&lt;/h2&gt;

&lt;p&gt;The new release of pebl will automatically version your folders.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ pebl folder upload build static
 :: uploading folder as name static
 :: success! the new uploaded version is: coawer
$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And we can reference these versions directly in &lt;code&gt;mount&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;pebl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;mount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;static:coawer&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/static&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note that you can leave the version out of the name like we had done previously. In this case the latest version of the folder will be chosen.&lt;/p&gt;

&lt;h2&gt;
  
  
  Making a Change
&lt;/h2&gt;

&lt;p&gt;Go ahead and make a modification to your website. In our example, we are using the react starter. The react start page displays the react logo that rotates clockwise. We'll make a small change so that it goes the other way.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cd project-folder/my-app
$ cat src/App.css
...
@keyframes App-logo-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(-360deg); // &amp;lt;-- this line has changed
  }
}
$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now let's build and upload, just like before.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cd project-folder/my-app
$ npm run build
$ pebl folder upload build static
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then re-deploy our existing node server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cd project-folder/server
$ pebl deploy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now when you visit your website, you should see the change reflected.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rolling Back
&lt;/h2&gt;

&lt;p&gt;But sometimes we need to rollback our changes! Maybe it turns out the react logo was meant to turn clockwise after all.&lt;/p&gt;

&lt;p&gt;Here we can use the pebl cli to list the available versions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ pebl folder list static
NAME
static:coawer
static:dtzmoj
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These are sorted by time, which means we can reference &lt;code&gt;static:dtzmoj&lt;/code&gt; in order to rollback our website.&lt;/p&gt;

&lt;p&gt;Update your &lt;code&gt;index.js&lt;/code&gt; like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import express from "express";
import * as pebl from "pebl";

// reference static:dtzmoj to rollback!
await pebl.mount("static:dtzmoj", "/static");

const app = express();

app.use(express.static("/static"));
app.get('/*', function (req, res) {
  res.sendFile("/static/index.html");
});

pebl.service(app, "your-subdomain.pebl.rocks");
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And once you deploy this with &lt;code&gt;pebl deploy&lt;/code&gt;, you will see the old version!&lt;/p&gt;

&lt;h3&gt;
  
  
  Next
&lt;/h3&gt;

&lt;p&gt;We have a ton of &lt;a href="https://docs.pebl.io/category/guides"&gt;guides&lt;/a&gt; for how to use pebl. And make sure to join our &lt;a href="https://discord.gg/qV67JnJMZZ"&gt;discord&lt;/a&gt;!&lt;/p&gt;

</description>
      <category>pebl</category>
      <category>react</category>
      <category>svelte</category>
      <category>angular</category>
    </item>
    <item>
      <title>Host your React, Angular, Svelte, or any other framework for free with pebl!</title>
      <dc:creator>Jin Lee</dc:creator>
      <pubDate>Sat, 19 Aug 2023 06:17:57 +0000</pubDate>
      <link>https://dev.to/pebl/host-your-react-angular-svelte-or-any-other-framework-for-free-with-pebl-5bl1</link>
      <guid>https://dev.to/pebl/host-your-react-angular-svelte-or-any-other-framework-for-free-with-pebl-5bl1</guid>
      <description>&lt;p&gt;Pebl is a cloud computer. It gives you programmatic bindings to control the cloud right from your application. No more configs, or stringing together disparate tools in adhoc ways. Just code to define your cloud!&lt;/p&gt;

&lt;p&gt;We just released &lt;a href="https://blog.pebl.io/release-12"&gt;pebl v0.1.1&lt;/a&gt;, which includes support for &lt;code&gt;mount&lt;/code&gt;. This makes it super easy to host any static website with pebl.&lt;/p&gt;

&lt;p&gt;So let's get into it, and make sure to join our &lt;a href="https://discord.gg/qV67JnJMZZ"&gt;discord&lt;/a&gt;!&lt;/p&gt;

&lt;h2&gt;
  
  
  Setup
&lt;/h2&gt;

&lt;p&gt;We first need to configure our development environment. We've made this super fast, so it should only take you 5 minutes.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Head over to &lt;a href="https://www.pebl.io/signup"&gt;pebl.io&lt;/a&gt; to create your free account. It's very important that you claim your &lt;strong&gt;free pebl.rocks subdomain&lt;/strong&gt;! We will be using this to host your react app.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Install the pebl CLI&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; $ curl https://www.pebl.io/install | sh
&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;If you want to go through the steps manually, you can follow the &lt;a href="https://docs.pebl.io/setup"&gt;steps here&lt;/a&gt;.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Authenticate the pebl CLI by running &lt;code&gt;pebl auth&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Finally, create a project folder&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; $ mkdir project-folder
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  The Static Bundle
&lt;/h2&gt;

&lt;p&gt;Let's generate an example website. If you already have a project that you want to use, you can skip this section.&lt;/p&gt;

&lt;p&gt;We will be using &lt;a href="https://create-react-app.dev/"&gt;create-react-app&lt;/a&gt; which makes it super fast to get started:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cd project-folder
$ npx create-react-app my-app
$ cd my-app
$ npm run build
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At this point you will have a folder &lt;code&gt;~/project-folder/my-app/build&lt;/code&gt; which contains the base react app.&lt;/p&gt;

&lt;h2&gt;
  
  
  Uploading the Bundle
&lt;/h2&gt;

&lt;p&gt;Now that you have a static bundle, we can upload it into pebl's cluster. You can use pebl's CLI to do this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cd project-folder/my-app
$ pebl folder upload build static
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you have an existing project that you are using, make sure to navigate to that project and run &lt;code&gt;pebl folder upload build static&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Serving with Express
&lt;/h2&gt;

&lt;p&gt;We'll utilize Express + Node to serve this react bundle, though pebl supports Python and Go which can also be used.&lt;/p&gt;

&lt;p&gt;Let's create a folder &lt;code&gt;server&lt;/code&gt; to house the server, and initialize a node project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cd project-folder
$ mkdir server
$ cd server
$ npm init -y
$ npm pkg set type="module"
$ npm pkg set scripts.start="node index.js"
$ npm i express pebl@v0.1.1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now create an &lt;code&gt;index.js&lt;/code&gt; which will contain our express server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;express&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;express&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;pebl&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;pebl&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;pebl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;mount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;static&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/static&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;express&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;use&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;express&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;static&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/static&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/*&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;sendFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/static/index.html&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nx"&gt;pebl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;service&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;your-subdomain.pebl.rocks&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note the last line&lt;/strong&gt;! Replace &lt;code&gt;your-subdomain.pebl.rocks&lt;/code&gt; with the subdomain that you claimed while you signed up!&lt;/p&gt;

&lt;h2&gt;
  
  
  Deploy
&lt;/h2&gt;

&lt;p&gt;Now we will deploy using pebl's CLI. Run &lt;code&gt;pebl deploy&lt;/code&gt; within the &lt;code&gt;server&lt;/code&gt; folder:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cd project-folder/server
$ pebl deploy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will be available immediately! Navigate to your url using your browser and you should see this react app. Make sure to use &lt;code&gt;https&lt;/code&gt;, as all pebl deployments get TLS certificates for free.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--G17HjfSZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/879o58ck9n5uytj1pm2d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--G17HjfSZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/879o58ck9n5uytj1pm2d.png" alt="A browser window showing a successful deployment of the server" width="800" height="559"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Explore
&lt;/h2&gt;

&lt;p&gt;Now that we've got things working, let's unpack a few key things.&lt;/p&gt;

&lt;h3&gt;
  
  
  SDK
&lt;/h3&gt;

&lt;p&gt;The power of pebl comes from its SDK, which provide programmatic bindings that unlock cloud capabilities.&lt;/p&gt;

&lt;p&gt;In this example we utilized &lt;code&gt;pebl.mount&lt;/code&gt; and &lt;code&gt;pebl.service&lt;/code&gt;. You can check out the &lt;a href="https://docs.pebl.io/sdk/service"&gt;pebl reference&lt;/a&gt; to find out more information about how they work.&lt;/p&gt;

&lt;h3&gt;
  
  
  Adding APIs
&lt;/h3&gt;

&lt;p&gt;The key benefit of pebl is that you can now easily extend your server to provide API's that your frontend can rely on. It's as simple as extending the express app to have routes:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;app.get('/some/endpoint', function (req, res) {
  // your custom API logic here
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Updates
&lt;/h3&gt;

&lt;p&gt;If you want to update your website, it's super easy! Just go through the process of uploading your new bundle with &lt;code&gt;pebl folder upload&lt;/code&gt;, then re-run &lt;code&gt;pebl deploy&lt;/code&gt; within the &lt;code&gt;server/&lt;/code&gt; folder.&lt;/p&gt;

&lt;p&gt;So something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cd project-folder/my-app
$ npm run build
$ pebl folder upload build static
$ cd ../server
$ pebl deploy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Next
&lt;/h3&gt;

&lt;p&gt;We have a ton of &lt;a href="https://docs.pebl.io/category/guides"&gt;guides&lt;/a&gt; for how to use pebl. And make sure to join our &lt;a href="https://discord.gg/qV67JnJMZZ"&gt;discord&lt;/a&gt;!&lt;/p&gt;

</description>
      <category>pebl</category>
      <category>react</category>
      <category>angular</category>
      <category>vue</category>
    </item>
    <item>
      <title>Deploying Go &amp; Redis For Free With Pebl!</title>
      <dc:creator>Jin Lee</dc:creator>
      <pubDate>Sat, 22 Jul 2023 03:44:55 +0000</pubDate>
      <link>https://dev.to/pebl/deploying-go-redis-for-free-with-pebl-1jo5</link>
      <guid>https://dev.to/pebl/deploying-go-redis-for-free-with-pebl-1jo5</guid>
      <description>&lt;p&gt;In this guide we will be looking at combing a simple Go server with Redis, and deploying it all for free with &lt;a href="https://www.pebl.io/"&gt;pebl&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setup
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Make sure that you have &lt;a href="https://www.docker.com/"&gt;docker&lt;/a&gt; and &lt;a href="https://go.dev/"&gt;Go&lt;/a&gt; installed.&lt;/li&gt;
&lt;li&gt;Install the pebl cli by following the steps here: &lt;a href="https://docs.pebl.io/setup"&gt;https://docs.pebl.io/setup&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Head over to &lt;a href="https://www.pebl.io"&gt;pebl.io&lt;/a&gt; and create a free account&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After creating your account, make sure to claim your free &lt;code&gt;*.pebl.rocks&lt;/code&gt; subdomain (&lt;a href="https://www.pebl.io/signup/claim"&gt;https://www.pebl.io/signup/claim&lt;/a&gt;), as we'll be using this for the rest of the series!&lt;/p&gt;

&lt;p&gt;We will be using &lt;code&gt;hey.pebl.rocks&lt;/code&gt; to make things concrete, so make sure to replace any instances of that with your own subdomain.&lt;/p&gt;

&lt;h2&gt;
  
  
  Project Creation
&lt;/h2&gt;

&lt;p&gt;Now it's time to create our project!&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;Create a scratch folder to act as the root of the project. For this tutorial we'll be creating &lt;code&gt;pebl-tutorial&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ mkdir ~/work/pebl-tutorial
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Then initialize the project by creating a Go module:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cd ~/work/pebl-tutorial
$ go mod init pebl-tutorial
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Download the pebl Go SDK by running &lt;code&gt;go get&lt;/code&gt; inside the project folder:&lt;br&gt;
&lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cd ~/work/pebl-tutorial
$ go get github.com/peblcloud/go
&lt;/code&gt;&lt;/pre&gt;

&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Adding Redis
&lt;/h2&gt;

&lt;p&gt;Let's first install the &lt;a href="https://github.com/redis/go-redis"&gt;redis client&lt;/a&gt; that we will use:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ go get github.com/redis/go-redis/v9
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then create a &lt;code&gt;main.go&lt;/code&gt; at the root of the project, and paste the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"net/http"&lt;/span&gt;
    &lt;span class="s"&gt;"github.com/peblcloud/go"&lt;/span&gt;
    &lt;span class="s"&gt;"github.com/redis/go-redis/v9"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;redisConn&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;pebl&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Redis&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"redis-1"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;rdb&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;redis&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;NewClient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;redis&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Options&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;Addr&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;redisConn&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Addr&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;

    &lt;span class="n"&gt;svc&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;NewServeMux&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;svc&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HandleFunc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;func&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ResponseWriter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;count&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;rdb&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Background&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="s"&gt;"count"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Result&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="n"&gt;res&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Sprintf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"current count: %s"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;count&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Write&lt;/span&gt;&lt;span class="p"&gt;([]&lt;/span&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;

    &lt;span class="n"&gt;svc&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HandleFunc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/incr"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;func&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ResponseWriter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;rdb&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Incr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Background&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="s"&gt;"count"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;

    &lt;span class="n"&gt;pebl&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Service&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;svc&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"hey.pebl.rocks"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pebl is a unique cloud platform, one where everything is driven with code. There are no configurations required! Here we are utilizing &lt;code&gt;pebl.Service&lt;/code&gt; to create a service out of the standard &lt;code&gt;net/http&lt;/code&gt; Go server, which will serve at &lt;code&gt;hey.pebl.rocks&lt;/code&gt;. (Make sure to change this to your own subdomain that you claimed).&lt;/p&gt;

&lt;p&gt;In a similar fashion, we get access to redis by using &lt;code&gt;pebl.Redis&lt;/code&gt;. This method returns a struct that contains the connection information for the redis instance. This gets passed into the redis client.&lt;/p&gt;

&lt;p&gt;And finally we have two endpoints configured on the server: &lt;code&gt;/incr&lt;/code&gt; which increments the key &lt;code&gt;count&lt;/code&gt;, and the root endpoint &lt;code&gt;/&lt;/code&gt; that returns the current count.&lt;/p&gt;

&lt;h2&gt;
  
  
  Running Locally
&lt;/h2&gt;

&lt;p&gt;Let's try running this locally!&lt;/p&gt;

&lt;h3&gt;
  
  
  Local Cluster
&lt;/h3&gt;

&lt;p&gt;First we need to initialize the local cluster:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ pebl up
 :: initializing new pebl cluster...
 :: done!
 :: run `pebl info` to see logs, endpoints, and other info about the running cluster!
$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then execute &lt;code&gt;pebl info&lt;/code&gt; to attach to the running cluster. This let's you see information about the running cluster, including any running workloads, logs, etc. The info screen should look something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
  pebl cluster version: 0.0.9
  ctrl-C or q to exit the info pane
  (exiting will not stop the cluster)


══ logs ═══════════════════════════════
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And you can exit the info pane by pressing &lt;code&gt;q&lt;/code&gt; or &lt;code&gt;Ctrl-C&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Running the Project
&lt;/h3&gt;

&lt;p&gt;Now make sure you are at the root of the project, and execute &lt;code&gt;pebl run&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cd ~/work/pebl-tutorial
$ pebl run
 :: building golang project...
 :: staging build at: /tmp/dir
 :: containerizing the build...
 :: starting container...
$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And now if you check your info pane, you should see two workloads, the endpoint and the redis instance.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
  pebl cluster version: 0.0.9
  ctrl-C or q to exit the info pane
  (exiting will not stop the cluster)

      redis: redis-1 → localhost:55000
      endpoint: hey.pebl.rocks → localhost:55001

══ logs ════════════════════════════════
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Sending Requests
&lt;/h3&gt;

&lt;p&gt;The info pane shows the locally bound port for the service. In our example it is bound to &lt;code&gt;:55001&lt;/code&gt;, but your own case will differ. Send a test curl to the bound port:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ curl localhost:55001/incr
$ curl localhost:55001/
current count: 1
$ curl localhost:55001/incr
$ curl localhost:55001/incr
$ curl localhost:55001/
current count: 3
$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Making Changes
&lt;/h2&gt;

&lt;p&gt;Now to make it a bit more interesting! Let's add an endpoint to &lt;code&gt;/reset&lt;/code&gt;, which will set the &lt;code&gt;count&lt;/code&gt; key back to zero.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"net/http"&lt;/span&gt;
    &lt;span class="s"&gt;"github.com/peblcloud/go"&lt;/span&gt;
    &lt;span class="s"&gt;"github.com/redis/go-redis/v9"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;redisConn&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;pebl&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Redis&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"redis-1"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;rdb&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;redis&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;NewClient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;redis&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Options&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;Addr&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;redisConn&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Addr&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;

    &lt;span class="n"&gt;svc&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;NewServeMux&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;svc&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HandleFunc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;func&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ResponseWriter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;count&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;rdb&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Background&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="s"&gt;"count"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Result&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="n"&gt;res&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Sprintf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"current count: %s"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;count&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Write&lt;/span&gt;&lt;span class="p"&gt;([]&lt;/span&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;

    &lt;span class="n"&gt;svc&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HandleFunc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/incr"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;func&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ResponseWriter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;rdb&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Incr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Background&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="s"&gt;"count"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;


    &lt;span class="n"&gt;svc&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HandleFunc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/reset"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;func&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ResponseWriter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;rdb&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Background&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="s"&gt;"count"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;

    &lt;span class="n"&gt;pebl&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Service&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;svc&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"hey.pebl.rocks"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice the new &lt;code&gt;/reset&lt;/code&gt; handler that's been attached to &lt;code&gt;svc&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In other platforms making changes can be an involved process. But with pebl we just need to re-run the project! Pebl understands what it means to update an endpoint and will automatically handle switching the underlying server to the latest version without any interruption.&lt;/p&gt;

&lt;p&gt;Run the project again with &lt;code&gt;pebl run&lt;/code&gt; and then send requests to the &lt;code&gt;/reset&lt;/code&gt; endpoint:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ curl localhost:55001/
current count: 3
$ curl localhost:55001/reset
$ curl localhost:55001/
current count: 0
$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Cloud Runtime
&lt;/h2&gt;

&lt;p&gt;To really give you a sense of why the pebl approach is so powerful, we are going to deploy this project to the cloud. And we are going to do this without any changes, no extra configuration required!&lt;/p&gt;

&lt;p&gt;Just use &lt;code&gt;pebl deploy&lt;/code&gt; at the root of the project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cd ~/work/pebl-tutorial
$ pebl deploy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once deployed, you can visit the &lt;a href="https://www.pebl.io/console"&gt;pebl console&lt;/a&gt; to see the running redis instance. You can also create a local tunnel to the remote redis instance in order to inspect or debug:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ pebl tunnel redis
 :: tunnel established at: 127.0.0.1:50000
 :: use redis-cli to connect:
 :: redis-cli -p 50000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And as the output suggests, we can use &lt;code&gt;redis-cli&lt;/code&gt; to the locally bound port to tunnel to your remote redis instance:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ redis-cli -p 50000
127.0.0.1:50000&amp;gt; get counter
"1"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;note that there's no need to create a "tunnel" to your local cluster. the info pane already shows the locally bound port which you can use to inspect the local redis!&lt;/p&gt;

&lt;h2&gt;
  
  
  Next
&lt;/h2&gt;

&lt;p&gt;You can continue to make changes to the Go server, perhaps adding authentication or caching.&lt;/p&gt;

&lt;p&gt;For more tutorials, check out our &lt;a href="https://docs.pebl.io/category/guides"&gt;many guides&lt;/a&gt;. Pebl is currently also available in Python and Node.&lt;/p&gt;

&lt;p&gt;For a reference to the Go SDK, check out &lt;a href="https://pkg.go.dev/github.com/peblcloud/go"&gt;https://pkg.go.dev/github.com/peblcloud/go&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For an overview of all cloud functionality available with pebl, check out the &lt;a href="https://docs.pebl.io/reference/SDK"&gt;reference&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>pebl</category>
      <category>redis</category>
      <category>cloud</category>
      <category>devops</category>
    </item>
    <item>
      <title>Getting started with Node and pebl — a free cloud platform!</title>
      <dc:creator>Jin Lee</dc:creator>
      <pubDate>Thu, 22 Jun 2023 22:01:50 +0000</pubDate>
      <link>https://dev.to/pebl/getting-started-with-node-and-pebl-a-free-cloud-platform-3aop</link>
      <guid>https://dev.to/pebl/getting-started-with-node-and-pebl-a-free-cloud-platform-3aop</guid>
      <description>&lt;p&gt;Pebl recently released support for Node in &lt;a href="https://blog.pebl.io/release-007"&gt;release 0.0.7&lt;/a&gt;!&lt;/p&gt;

&lt;p&gt;As part of that we are starting a dedicated series on using Node and pebl which will go into detail about how to utilize all the different cloud capabilities that pebl offers.&lt;/p&gt;

&lt;p&gt;But we thought it'd be fun to start off the series with a quick guide that is &lt;strong&gt;actually quick&lt;/strong&gt;, and should take 5 minutes!&lt;/p&gt;

&lt;p&gt;When you are done you will have a Node project configured with a standard &lt;a href="https://nodejs.org/api/http.html#class-httpserver"&gt;&lt;code&gt;http.Server&lt;/code&gt;&lt;/a&gt; deployed to the cloud and serving live traffic!&lt;/p&gt;

&lt;h2&gt;
  
  
  Setup
&lt;/h2&gt;

&lt;p&gt;First create a free account at &lt;a href="https://www.pebl.io/signup"&gt;pebl.io&lt;/a&gt;. Make sure to claim your free &lt;code&gt;*.pebl.rocks&lt;/code&gt; subdomain! We will be using this to deploy with in this tutorial.&lt;/p&gt;

&lt;p&gt;Then download the pebl CLI, the steps are outlined &lt;a href="https://docs.pebl.io/setup"&gt;in the docs&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You also need to have Node and Docker installed on your system.&lt;/p&gt;

&lt;h2&gt;
  
  
  Project
&lt;/h2&gt;

&lt;p&gt;Now we're ready to initialize the node project! Create a folder to be the root of our project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ mkdir quickstart
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then place this &lt;code&gt;package.json&lt;/code&gt; inside the folder (Note that you could also use &lt;code&gt;npm init&lt;/code&gt; to do this):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
  "name": "node",
  "version": "1.0.0",
  "type": "module",
  "main": "index.js",
  "scripts": {
    "start": "node index.js"
  },
  "dependencies": {
    "pebl": "0.0.8"
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then install the &lt;code&gt;pebl@0.0.8&lt;/code&gt; dependency by running &lt;code&gt;npm install&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cd quickstart
$ npm install

added 1 package, and audited 2 packages in 739ms

found 0 vulnerabilities
$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  A simple server
&lt;/h2&gt;

&lt;p&gt;Let's create an &lt;code&gt;index.js&lt;/code&gt; with a simple server that utilizes pebl's &lt;a href="https://docs.pebl.io/reference/SDK"&gt;service&lt;/a&gt; functionality:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;pebl&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;pebl&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;http&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;http&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;requestListener&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;writeHead&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;end&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hello, world!&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;server&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;createServer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;requestListener&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;pebl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;service&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;server&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;your-domain-here.pebl.rocks&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Here make sure to place your own &lt;code&gt;pebl.rocks&lt;/code&gt; subdomain!&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Deploying
&lt;/h2&gt;

&lt;p&gt;Now we are ready to deploy the project.&lt;/p&gt;

&lt;p&gt;First run &lt;code&gt;pebl auth&lt;/code&gt; to authenticate the pebl CLI with your pebl account.&lt;/p&gt;

&lt;p&gt;Then run &lt;code&gt;pebl deploy&lt;/code&gt; at the root of the project!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ pebl deploy
 :: building node project...
 :: containerizing the build...
 :: build success!
 :: uploading...
 :: success!
$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now you can send requests to your deployment with curl:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ curl https://your-domain-here.pebl.rocks
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Make sure to use &lt;code&gt;https&lt;/code&gt;, as all pebl deployments get free SSL certificates!&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Can I run this locally?
&lt;/h3&gt;

&lt;p&gt;Yes! One power of pebl is that you can run the same code locally and in the cloud, without any modification. We will go into more details about how to do this, but the short version is: first create a local cluster with &lt;code&gt;pebl up&lt;/code&gt;, then you can run local workloads with &lt;code&gt;pebl run&lt;/code&gt; in the project folder.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I use &lt;a href="https://expressjs.com/"&gt;Express&lt;/a&gt;?
&lt;/h3&gt;

&lt;p&gt;Yes! In fact you use any server that conforms to &lt;a href="https://nodejs.org/api/net.html#serverlisten"&gt;net.Server.listen&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I use my own custom domain with pebl?
&lt;/h3&gt;

&lt;p&gt;We are currently beta testing this feature! If you are interested, fill out this typeform link and we will be in touch: &lt;a href="https://ie0rdzi5b9h.typeform.com/to/V0PJ90un"&gt;https://ie0rdzi5b9h.typeform.com/to/V0PJ90un&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>pebl</category>
      <category>cloud</category>
      <category>node</category>
      <category>devops</category>
    </item>
    <item>
      <title>mysql support! — pebl supports mysql with release 0.0.6</title>
      <dc:creator>Jin Lee</dc:creator>
      <pubDate>Tue, 13 Jun 2023 06:06:28 +0000</pubDate>
      <link>https://dev.to/pebl/mysql-support-pebl-supports-mysql-with-release-006-26md</link>
      <guid>https://dev.to/pebl/mysql-support-pebl-supports-mysql-with-release-006-26md</guid>
      <description>&lt;h2&gt;
  
  
  Quick Summary
&lt;/h2&gt;

&lt;p&gt;With release 0.0.6, pebl now supports creating mysql instances in both Python and Go.&lt;/p&gt;

&lt;h2&gt;
  
  
  Longform
&lt;/h2&gt;

&lt;p&gt;Both Python and Go will now have a new method that will initialize a mysql instance on your behalf. The usage is quite similar to the way redis is handled.&lt;/p&gt;

&lt;h3&gt;
  
  
  Python
&lt;/h3&gt;

&lt;p&gt;In python the method is &lt;code&gt;pebl.mysql&lt;/code&gt; that takes a single string argument to represents the mysql handle. The return value is a dictionary containing four keys, &lt;code&gt;host&lt;/code&gt;, &lt;code&gt;port&lt;/code&gt;, &lt;code&gt;user&lt;/code&gt;, and &lt;code&gt;password&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;These are the exact keys that are needed for &lt;code&gt;pymysql.connect&lt;/code&gt;, and so you can pass the dictionary as keywords args.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;pebl&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;pymysql&lt;/span&gt;

&lt;span class="n"&gt;conn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pebl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mysql&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"mysql"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;db&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pymysql&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"show databases"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;fetchall&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Go
&lt;/h3&gt;

&lt;p&gt;In Go the method is &lt;code&gt;pebl.Mysql&lt;/code&gt; that takes a single string argument to represent the mysql handle. The return value is of type &lt;code&gt;MysqlConn&lt;/code&gt;, which has the necessary fields required to connect to the mysql instance.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"database/sql"&lt;/span&gt;

    &lt;span class="s"&gt;"github.com/peblcloud/go"&lt;/span&gt;
    &lt;span class="s"&gt;"github.com/go-sql-driver/mysql"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;pebl&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Mysql&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"mysql-1"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;cfg&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;mysql&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Config&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;User&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;   &lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;User&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;Passwd&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Password&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;Net&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;    &lt;span class="s"&gt;"tcp"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="n"&gt;Addr&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;   &lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Addr&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;sql&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"mysql"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cfg&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;FormatDSN&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Ping&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nb"&gt;println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Connected!"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  pebl info
&lt;/h3&gt;

&lt;p&gt;When using &lt;code&gt;pebl info&lt;/code&gt; to display information about the local cluster, you will now see entries for any mysql instances that you utilize.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--87VqqGrv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4dy67li0428cn7gc8nmg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--87VqqGrv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4dy67li0428cn7gc8nmg.png" alt="a terminal showing the result of running pebl info" width="800" height="567"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The information will include the local port that you can utilize to connect, which you can pass into mysql:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ mysql --host 127.0.0.1 --port 32799 -uroot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Upgrading
&lt;/h2&gt;

&lt;p&gt;Make sure to download the latest pebl CLI, which will be needed in order to utilize the new release on your local cluster. Follow the section about installing the CLI in the &lt;a href="https://docs.pebl.io/setup"&gt;setup guide&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Go
&lt;/h3&gt;

&lt;p&gt;The Go SDK is available with the &lt;a href="https://pkg.go.dev/github.com/peblcloud/go"&gt;0.0.6 tag&lt;/a&gt;. You can update your existing Go projects by running &lt;code&gt;go get -u github.com/peblcloud/go@v0.0.6&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Python
&lt;/h3&gt;

&lt;p&gt;The Python SDK is available as pre-built &lt;a href="https://hub.docker.com/r/peblcloud/python"&gt;docker images&lt;/a&gt;. Update your Python projects by changing the &lt;code&gt;Dockerfile&lt;/code&gt; to utilize one of the 0.0.6 images.&lt;/p&gt;

</description>
      <category>pebl</category>
      <category>devops</category>
      <category>mysql</category>
    </item>
    <item>
      <title>pebl CLI update — initialize base pebl projects</title>
      <dc:creator>Jin Lee</dc:creator>
      <pubDate>Sat, 10 Jun 2023 00:33:29 +0000</pubDate>
      <link>https://dev.to/pebl/pebl-cli-update-initialize-base-pebl-projects-2h1n</link>
      <guid>https://dev.to/pebl/pebl-cli-update-initialize-base-pebl-projects-2h1n</guid>
      <description>&lt;h2&gt;
  
  
  Quick Summary
&lt;/h2&gt;

&lt;p&gt;The latest pebl CLI release can create base pebl projects for either Python or Go, helping you get started quickly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Longform
&lt;/h2&gt;

&lt;p&gt;One feedback we've heard is that it can be a bit cumbersome to set up a new project for pebl, especially when the setup doesn't work on the first try.&lt;/p&gt;

&lt;p&gt;In order to make this process more efficient and get you started right away, the latest pebl CLI has a built-in command to create correct pebl projects that can serve as a starting point.&lt;/p&gt;

&lt;h3&gt;
  
  
  Go
&lt;/h3&gt;

&lt;p&gt;For Go based projects, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ pebl init go my-project
 :: initializing project with endpoint: hey.pebl.rocks
 :: initializing go project...
 :: creating main.go ...
$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note that initializing a Go projects relies on the system installed Go binary, so make sure that is installed before invoking &lt;code&gt;pebl init&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Python
&lt;/h3&gt;

&lt;p&gt;For Python based projects, run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ pebl init python my-project
 :: initializing project with endpoint: hey.pebl.rocks
 :: creating Dockerfile ...
 :: creating main.py ...
$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Running
&lt;/h3&gt;

&lt;p&gt;Once initialized, the project is immediately ready! You can execute &lt;code&gt;pebl run&lt;/code&gt; inside the initialized project to get started.&lt;/p&gt;

</description>
      <category>pebl</category>
      <category>devops</category>
    </item>
    <item>
      <title>Pebl Release 0.0.5</title>
      <dc:creator>Jin Lee</dc:creator>
      <pubDate>Thu, 01 Jun 2023 19:56:32 +0000</pubDate>
      <link>https://dev.to/pebl/pebl-release-005-2mch</link>
      <guid>https://dev.to/pebl/pebl-release-005-2mch</guid>
      <description>&lt;h2&gt;
  
  
  Quick Summary
&lt;/h2&gt;

&lt;p&gt;Release 0.0.5 has support for streaming production logs using the CLI and updates to the Go package.&lt;/p&gt;

&lt;h2&gt;
  
  
  Longform
&lt;/h2&gt;

&lt;h3&gt;
  
  
  pebl CLI
&lt;/h3&gt;

&lt;p&gt;Previously the only way to look at logs from the cloud runtime was to go to our &lt;a href="https://www.pebl.io/console/logs"&gt;console&lt;/a&gt;. The latest pebl CLI now supports the command &lt;code&gt;pebl logs&lt;/code&gt;, which will stream those logs so that you can see them on your terminal.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ ./pebl logs
[06/01 12:43:49] foo
[06/01 12:44:34] bar
[06/01 12:44:35] hello, world!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To upgrade you can follow the &lt;a href="https://docs.pebl.io/setup"&gt;setup steps&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Go SDK
&lt;/h3&gt;

&lt;p&gt;Previously our Go package was structured such that the pebl bindings were under the &lt;code&gt;sdk&lt;/code&gt; package, meaning that you had to import the package using &lt;code&gt;github.com/peblcloud/go/sdk&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Based on user feedback we have decided to move all the bindings to the root level, and to change the package name to &lt;code&gt;pebl&lt;/code&gt;. In short you can now do this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"net/http"&lt;/span&gt;
    &lt;span class="s"&gt;"github.com/peblcloud/go"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;service&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;NewServeMux&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="n"&gt;service&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HandleFunc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;func&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ResponseWriter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Write&lt;/span&gt;&lt;span class="p"&gt;([]&lt;/span&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"hello, world!&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;

    &lt;span class="n"&gt;pebl&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Service&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;service&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"svc.internal"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To upgrade you can run &lt;code&gt;go get github.com/peblcloud/go@v0.0.5&lt;/code&gt; in your Go projects.&lt;/p&gt;

</description>
      <category>pebl</category>
      <category>devops</category>
      <category>cloud</category>
      <category>infrastructureascode</category>
    </item>
    <item>
      <title>Microservices with pebl — a complete and free cloud platform</title>
      <dc:creator>Jin Lee</dc:creator>
      <pubDate>Wed, 31 May 2023 19:24:34 +0000</pubDate>
      <link>https://dev.to/pebl/microservices-with-pebl-a-complete-and-free-cloud-platform-60i</link>
      <guid>https://dev.to/pebl/microservices-with-pebl-a-complete-and-free-cloud-platform-60i</guid>
      <description>&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;p&gt;In this guide I want to introduce pebl, a &lt;strong&gt;complete and free cloud platform&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Unlike the normal approach to Infrastructure as Code, pebl doesn't rely on declaring a set of yaml files to control your cloud. Instead pebl embeds cloud capabilities within your application through language specific SDKs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Started
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Signing Up
&lt;/h3&gt;

&lt;p&gt;So first we need to sign up for a free account at &lt;a href="https://www.pebl.io/signup" rel="noopener noreferrer"&gt;pebl.io&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frxz9gublr824sk0zvnbp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frxz9gublr824sk0zvnbp.png" alt="A screenshot showing the oauth sign up options on pebl.io"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Choose your desired identity provider and follow the steps. And make sure to go through claiming your free &lt;code&gt;*.pebl.rocks&lt;/code&gt; subdomain! We'll be using this for the rest of the tutorial.&lt;/p&gt;

&lt;h3&gt;
  
  
  Docker &amp;amp; pebl CLI
&lt;/h3&gt;

&lt;p&gt;There are only two system requirements for pebl, which is Docker and the pebl CLI. If you don't have Docker installed, head over to &lt;a href="https://docs.docker.com/get-docker/" rel="noopener noreferrer"&gt;the docker website&lt;/a&gt; and follow their directions.&lt;/p&gt;

&lt;p&gt;For pebl CLI, choose to correct link on the &lt;a href="https://docs.pebl.io/setup#pebl-cli" rel="noopener noreferrer"&gt;pebl's setup docs&lt;/a&gt;. Make sure you select the correct download link for your own system! If you are using a Mac you can check if your system is an Intel or M1 by going through the Apple Menu then About This Mac.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fooh4h1f6jvu0vgmont5o.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fooh4h1f6jvu0vgmont5o.png" alt="A screenshot showing Apple's About This Mac screen"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Verify that the CLI was installed correctly by running &lt;code&gt;pebl&lt;/code&gt; without any args:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ pebl
usage:

    pebl {command}

available commands:

       up  start the local pebl cluster.
     down  stop the local pebl cluster.
     info  attach and show info about the local pebl cluster.
      run  execute a pebl program locally.
   deploy  execute a pebl program in the cloud.
   tunnel  creates a tunnel to a redis instance.
     auth  manages the credentials needed for certain commands.
  version  print the version of the cli.

$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Simple Service
&lt;/h2&gt;

&lt;p&gt;The core building block that pebl provides is a &lt;strong&gt;service&lt;/strong&gt;. On other platforms it might be referred to as a serverless application. In essence pebl's service is a server that can respond to requests.&lt;/p&gt;

&lt;p&gt;Now let's dive into pebl by creating a very simple service using Python.&lt;/p&gt;

&lt;h3&gt;
  
  
  Hello World!
&lt;/h3&gt;

&lt;p&gt;Create a scratch project folder somewhere on your system. In our examples we will be using &lt;code&gt;~/work/scratch&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ mkdir -p ~/work/scratch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But feel free to choose another scheme that makes sense for your own setup. This folder will act as the root of our project.&lt;/p&gt;

&lt;p&gt;Now let's create a subfolder that will contain our simple hello world service.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir ~/work/scratch/hello
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a &lt;code&gt;main.py&lt;/code&gt; (&lt;code&gt;~/work/scratch/hello/main.py&lt;/code&gt;) that will hold the main method and paste in the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;flask&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Flask&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Flask&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;__name__&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nd"&gt;@app.route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;root&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hello, world!&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pebl&lt;/span&gt;
&lt;span class="n"&gt;pebl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;service&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hey.pebl.rocks&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# put your own domain here
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first section of &lt;code&gt;main.py&lt;/code&gt; should look very familiar if you've used &lt;a href="https://flask.palletsprojects.com/en/2.3.x/" rel="noopener noreferrer"&gt;Flask&lt;/a&gt; before. It's a very simple Flask definition, with a single handler on the root path. The last two lines are where we declare that this Flask application should be a service, hosted at your &lt;code&gt;*.pebl.rocks&lt;/code&gt; endpoint.&lt;/p&gt;

&lt;p&gt;At this point you might expect that we have to create some separate pebl specific yaml. But really this single method call is &lt;strong&gt;all it takes&lt;/strong&gt; to define a service with pebl! So to recap:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Cloud capabilities (&lt;code&gt;pebl.service&lt;/code&gt;) are incorporated into the application as regular code&lt;/li&gt;
&lt;li&gt;You can rely on any other Python library without additional configuration, like Flask&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now to run this, we will be relying on &lt;a href="https://hub.docker.com/r/peblcloud/python" rel="noopener noreferrer"&gt;pebl's base Docker image&lt;/a&gt; to create a re-usable container. Go ahead and create a &lt;code&gt;Dockerfile&lt;/code&gt; (&lt;code&gt;~/work/scratch/hello/Dockerfile&lt;/code&gt;) with the following content:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM peblcloud/python
COPY . .
RUN pip install flask
ENTRYPOINT python -u main.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Local Runtime
&lt;/h3&gt;

&lt;p&gt;Pebl let's you execute your code locally to ensure correctness and to provide a super fast iteration cycle. First start a local cluster that will contain all our local workloads with &lt;code&gt;pebl up&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ pebl up
 :: initializing new pebl cluster...
 :: done!
 :: run `pebl info` to see logs, endpoints, and other info about the running cluster!
$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once the cluster is configured, navigate to the &lt;code&gt;hello&lt;/code&gt; subfolder and execute &lt;code&gt;pebl run&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cd ~/work/scratch/hello
$ pebl run
 :: building docker project...
 :: starting container...
$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then run &lt;code&gt;pebl info&lt;/code&gt; to see the state of the running cluster.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqlvm8b6fb9d5ir1tkhpk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqlvm8b6fb9d5ir1tkhpk.png" alt="Screenshot of a terminal showing the pane from pebl info"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You should see something like this, but with your own &lt;code&gt;*.pebl.rocks&lt;/code&gt; subdomain instead of &lt;code&gt;hey.pebl.rocks&lt;/code&gt;. Go ahead and try sending a request to your server.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ curl localhost:32807
hello, world!
$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Make sure you put in the correct port as shown on your info pane!&lt;/p&gt;

&lt;h3&gt;
  
  
  Cloud Runtime
&lt;/h3&gt;

&lt;p&gt;By embedding your cloud infrastructure usage into your application, pebl unlocks a key benefit: The ability to deploy the exact same application to different runtimes, without any modifications.&lt;/p&gt;

&lt;p&gt;In other words, there's no longer a need to do any environment specific checks or define multiple config files for local vs. production deploys.&lt;/p&gt;

&lt;p&gt;So pebl makes it super easy to migrate your applications to the cloud once you are done testing them locally. Just run &lt;code&gt;pebl deploy&lt;/code&gt; in a similar fashion to &lt;code&gt;pebl run&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cd ~/work/scratch/hello
$ pebl deploy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you get authentication errors, make sure to run &lt;code&gt;pebl auth&lt;/code&gt; and follow the steps!&lt;/p&gt;

&lt;p&gt;Once the deploy is successful, try sending a request with curl. Make sure to use &lt;code&gt;https&lt;/code&gt; as all services in the cloud get TLS by default, and pebl disallows non-TLS traffic.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ curl https://hey.pebl.rocks
hello, world!
$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also head over to the &lt;a href="https://www.pebl.io/console" rel="noopener noreferrer"&gt;pebl console&lt;/a&gt; to get a report of all incoming traffic to your endpoints.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvl0doygclp8c33e7t2ul.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvl0doygclp8c33e7t2ul.png" alt="Screenshot of the console at pebl.io"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Microservices
&lt;/h2&gt;

&lt;p&gt;A common way to structure cloud workloads is to break them into small services, each serving a disparate part of the larger system. With pebl we can achieve that by utilizing the &lt;strong&gt;internal services&lt;/strong&gt; capability.&lt;/p&gt;

&lt;p&gt;Internal services are similar to &lt;code&gt;pebl.service&lt;/code&gt; that we used previously, with one key difference. They are only exposed to your other workloads, and are not configured for external traffic.&lt;/p&gt;

&lt;p&gt;So in this section we will explore adding an internal service, and utilizing Go instead of Python to highlight the language agnostic feature of pebl.&lt;/p&gt;

&lt;h3&gt;
  
  
  Go Setup
&lt;/h3&gt;

&lt;p&gt;Let's create a subfolder within our scratch folder to hold our Go setup.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ mkdir ~/work/scratch/go
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then initialize a Go project using &lt;code&gt;go mod init&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cd ~/work/scratch/go
$ go mod init scratch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And unlike Python, since Go is compiled we actually don't need a Dockerfile. Instead we need to download the &lt;a href="https://pkg.go.dev/github.com/peblcloud/go" rel="noopener noreferrer"&gt;pebl package for Go&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cd ~/work/scratch/go
$ go get github.com/peblcloud/go
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  User Service
&lt;/h3&gt;

&lt;p&gt;And to motivate a real usage, we will be creating an internal Go service that acts as a user service, one that handles managing user data. Create a &lt;code&gt;main.go&lt;/code&gt; (&lt;code&gt;~/work/scratch/go/main.go&lt;/code&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"github.com/peblcloud/go"&lt;/span&gt;
    &lt;span class="s"&gt;"net/http"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;mux&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;NewServeMux&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;mux&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HandleFunc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;func&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ResponseWriter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Write&lt;/span&gt;&lt;span class="p"&gt;([]&lt;/span&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"this is an internal service!&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;

    &lt;span class="n"&gt;pebl&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;InternalService&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mux&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"go.internal"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So just as we had done previously with Python, we are creating a server object based on the &lt;code&gt;net/http&lt;/code&gt;. Then passing configured server object into pebl's SDK with the &lt;code&gt;pebl.InternalService&lt;/code&gt; call.&lt;/p&gt;

&lt;p&gt;Note that unlike the serivce we defined previously, we are providing a seemingly invalid domain of &lt;code&gt;go.internal&lt;/code&gt;. For internal services the endpoint can be anything, though we recommend you use an easy-to-remember scheme, such as a &lt;code&gt;.local&lt;/code&gt; or &lt;code&gt;.internal&lt;/code&gt; TLD.&lt;/p&gt;

&lt;p&gt;Let's try running this! Same as before execute &lt;code&gt;pebl run&lt;/code&gt; to run it locally:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cd ~/work/scratch/go
$ pebl run
 :: building golang project...
 :: staging build at: /var/folders/92/_vg8jtqx7kncxb_9jlpw8rmm0000gn/T/3019178735
 :: containerizing the build...
 :: starting container...
$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now when you inspect the info pane, you should see another entry tagged as &lt;code&gt;internal&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8iexgyrjc2qgqorxxyyn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8iexgyrjc2qgqorxxyyn.png" alt="Screenshot showing updated info pane from running the Go service locally"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can send requests to this new internal endpoint with curl:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ curl localhost:32808
this is an internal service!
$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note that the ability to send requests like this to internal service is provided out of convenience while running locally. When deployed to the cloud runtime, you won't be able to access the internal services from outside the cluster.&lt;/p&gt;

&lt;h3&gt;
  
  
  Redis
&lt;/h3&gt;

&lt;p&gt;Now our internal Go service isn't very interesting because it doesn't really do anything based on our request. In order to support a much wider set of applications, pebl provides persistence through &lt;a href="https://redis.io/" rel="noopener noreferrer"&gt;Redis&lt;/a&gt;. And just as we have done so far, we unlock this capability through the SDK.&lt;/p&gt;

&lt;p&gt;So let's update the Go service (&lt;code&gt;~/work/scratch/go/main.go&lt;/code&gt;) by incorporating Redis.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"context"&lt;/span&gt;
    &lt;span class="s"&gt;"encoding/json"&lt;/span&gt;
    &lt;span class="s"&gt;"fmt"&lt;/span&gt;
    &lt;span class="s"&gt;"net/http"&lt;/span&gt;
    &lt;span class="s"&gt;"net/url"&lt;/span&gt;

    &lt;span class="s"&gt;"github.com/peblcloud/go"&lt;/span&gt;
    &lt;span class="s"&gt;"github.com/redis/go-redis/v9"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;connInfo&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;pebl&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Redis&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"users"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;redis&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;NewClient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;redis&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Options&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;Addr&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Sprintf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"%s:%d"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;connInfo&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Host&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;connInfo&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Port&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;

    &lt;span class="n"&gt;mux&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;NewServeMux&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;mux&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HandleFunc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;func&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ResponseWriter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;url&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ParseQuery&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;URL&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RawQuery&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;query&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;userInfo&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HGetAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Background&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Result&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Marshal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;userInfo&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;

    &lt;span class="n"&gt;pebl&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;InternalService&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mux&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"go.internal"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then update our module dependencies by running &lt;code&gt;go mod tidy&lt;/code&gt;, which should automatically pull down &lt;code&gt;github.com/redis/go-redis/v9&lt;/code&gt;. If for some reason this isn't working, you can manually run &lt;code&gt;go get github.com/redis/go-redis/v9&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Now run this Go service by executing &lt;code&gt;pebl run&lt;/code&gt; inside &lt;code&gt;~/work/scratch/go/&lt;/code&gt;. Your info pane should now list the redis instance we are using named &lt;code&gt;users&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6r45mgby6y1naoekukas.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6r45mgby6y1naoekukas.png" alt="Screenshot showing updated info pane from running redis locally"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you try and send requests to your internal Go service at this point, you'll always get an empty result because our redis instance has no user data yet.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ curl 'localhost:32808?name=alice'
{}
$ curl 'localhost:32808?name=bob'
{}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;But you can quickly manage the data in your local redis by using the exposed port shown on the info pane.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ redis-cli -p 32809
127.0.0.1:32809&amp;gt; hset alice name alice email alice@example.org
(integer) 2
127.0.0.1:32809&amp;gt; hset bob name bob email bob@example.org
(integer) 2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now when you send requests with either &lt;code&gt;alice&lt;/code&gt; or &lt;code&gt;bob&lt;/code&gt; as the query, you'll get their user info json in the response:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ curl 'localhost:32808?name=alice'
{"email":"alice@example.org","name":"alice"}
$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Proxying
&lt;/h2&gt;

&lt;p&gt;Now to utilize this internal service, we will be proxying a subset of requests from our external Python service to our intenal Go service. Let's update our &lt;code&gt;main.py&lt;/code&gt; in the &lt;code&gt;~/work/scratch/hello/&lt;/code&gt; folder:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;flask&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Flask&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Flask&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;__name__&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nd"&gt;@app.route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;root&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hello, world!&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;

&lt;span class="nd"&gt;@app.route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;/user/&amp;lt;name&amp;gt;&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;user_service&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;http://go.internal?name=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status_code&lt;/span&gt;

&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pebl&lt;/span&gt;
&lt;span class="n"&gt;pebl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;service&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;hey.pebl.rocks&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# put your own domain here
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So here we are relying on the popular &lt;a href="https://requests.readthedocs.io/" rel="noopener noreferrer"&gt;requests library&lt;/a&gt; in order to send &lt;code&gt;/user&lt;/code&gt; requests to the internal Go service at &lt;code&gt;go.internal:80&lt;/code&gt;. Once again the power of pebl is this ability to incorporate other Python libraries at ease without any external configuration. But before we can run this locally, we need to ensure that the requests library is available for use within the container. So update the &lt;code&gt;Dockerfile&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;FROM peblcloud/python
COPY . .
RUN pip install flask requests
ENTRYPOINT python -u main.py
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Go ahead and try running this! You'll be able to query the external endpoint at the &lt;code&gt;/user&lt;/code&gt; path to get access to the internal service:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ curl localhost:32807/user/alice
{"email":"alice@example.org","name":"alice"}
$ curl localhost:32807/user/bob
{"email":"bob@example.org","name":"bob"}
$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Deploying
&lt;/h3&gt;

&lt;p&gt;Go ahead and deploy these changes! First deploy the internal Go service:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cd ~/work/scratch/go
$ pebl deploy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then invoke &lt;code&gt;pebl deploy&lt;/code&gt; once again in the python subproject:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ cd ~/work/scratch/hello
$ pebl deploy
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pebl automatically implements zero downtime updates to services. This means that there won't be any dropped requests during this transition. Once the deploy is complete you can try sending the same requests to the cloud runtime:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ curl https://hey.pebl.rocks/user/alice
{}
$ curl https://hey.pebl.rocks/user/bob
{}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And as expected you should be seeing empty results as our cloud runtime doesn't have the data we filled for our local runtime.&lt;/p&gt;

&lt;h3&gt;
  
  
  Redis Management
&lt;/h3&gt;

&lt;p&gt;In order to access redis that's in the cloud runtime, we can utilize pebl CLI's &lt;code&gt;pebl tunnel&lt;/code&gt; command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ pebl tunnel
 :: tunnel established at: 127.0.0.1:59039
 :: use redis-cli to connect:
 :: redis-cli -p 59039
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This tunnel proxies local traffic to your redis instances in the cloud. You can use the &lt;code&gt;redis-cli&lt;/code&gt; with the &lt;code&gt;-p&lt;/code&gt; argument to connect to the proxied port and set the same data we used locally:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ redis-cli -p 59039
127.0.0.1:59039&amp;gt; hset alice name alice email alice@example.org
(integer) 2
127.0.0.1:59039&amp;gt; hset bob name bob email bob@example.org
(integer) 2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now your requests to the cloud will return the same results as before:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ curl https://hey.pebl.rocks/user/alice
{"email":"alice@example.org","name":"alice"}
$ curl https://hey.pebl.rocks/user/bob
{"email":"bob@example.org","name":"bob"}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Next Steps
&lt;/h2&gt;

&lt;p&gt;So we've explored three capabilities of pebl — services, internal services, and redis. You can explore the rest of pebl's offerings by digging into the &lt;a href="https://docs.pebl.io/reference/SDK" rel="noopener noreferrer"&gt;SDK reference&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You can also follow &lt;a href="https://docs.pebl.io/guides/python/service" rel="noopener noreferrer"&gt;our&lt;/a&gt; &lt;a href="https://docs.pebl.io/guides/go/service" rel="noopener noreferrer"&gt;many&lt;/a&gt; &lt;a href="https://docs.pebl.io/category/modern" rel="noopener noreferrer"&gt;guides&lt;/a&gt; on how to accomplish common cloud tasks.&lt;/p&gt;

</description>
      <category>pebl</category>
      <category>devops</category>
      <category>microservices</category>
      <category>infrastructureascode</category>
    </item>
    <item>
      <title>Pebl Release 0.0.4</title>
      <dc:creator>Jin Lee</dc:creator>
      <pubDate>Fri, 26 May 2023 00:16:17 +0000</pubDate>
      <link>https://dev.to/pebl/pebl-release-004-2idb</link>
      <guid>https://dev.to/pebl/pebl-release-004-2idb</guid>
      <description>&lt;h2&gt;
  
  
  Quick Summary
&lt;/h2&gt;

&lt;p&gt;Previously all pebl services were external facing. But a very common way of&lt;br&gt;
organizing distributed systems is by creating internal (micro)services that&lt;br&gt;
handle a localized part of the whole system.&lt;/p&gt;

&lt;p&gt;With release 0.0.4, we introduce a new SDK binding that supports internal&lt;br&gt;
only services.&lt;/p&gt;
&lt;h2&gt;
  
  
  Longform
&lt;/h2&gt;

&lt;p&gt;The previous &lt;code&gt;service&lt;/code&gt; binding remains unchanged. Using it will create&lt;br&gt;
a service that is exposed to external traffic.&lt;/p&gt;

&lt;p&gt;Release 0.0.4 introduces the new &lt;code&gt;internal_service&lt;/code&gt; binding. Unlike the&lt;br&gt;
external counterpart, this method will create a service that's only&lt;br&gt;
reachable from other running workloads.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"net/http"&lt;/span&gt;
    &lt;span class="s"&gt;"github.com/peblcloud/go/sdk"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;service&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;NewServeMux&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="n"&gt;service&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HandleFunc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;func&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ResponseWriter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Write&lt;/span&gt;&lt;span class="p"&gt;([]&lt;/span&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"some internal service!&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;

    &lt;span class="n"&gt;sdk&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;InternalService&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;service&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"svc.internal"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note that the &lt;code&gt;endpoint&lt;/code&gt; parameter here can be anything as long as it is&lt;br&gt;
in a valid domain format. We recommend creating an internally consistent&lt;br&gt;
scheme by adopting a TLD for all internal services, such as &lt;code&gt;.internal&lt;/code&gt;&lt;br&gt;
or &lt;code&gt;.local&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Upgrading
&lt;/h2&gt;

&lt;p&gt;Make sure to download the latest pebl CLI, which will be needed in order&lt;br&gt;
to utilize the new release on your local cluster. Follow the section&lt;br&gt;
about installing the CLI in the &lt;a href="https://docs.pebl.io/setup"&gt;setup guide&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Go
&lt;/h3&gt;

&lt;p&gt;The Go SDK is available with the &lt;a href="https://pkg.go.dev/github.com/peblcloud/go/sdk"&gt;0.0.4 tag&lt;/a&gt;.&lt;br&gt;
You can update your Go projects by running &lt;code&gt;go get github.com/peblcloud/go@v0.0.4&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Python
&lt;/h3&gt;

&lt;p&gt;The Python SDK is available as pre-built &lt;a href="https://hub.docker.com/r/peblcloud/python"&gt;docker images&lt;/a&gt;.&lt;br&gt;
Update your Python projects by changing the &lt;code&gt;Dockerfile&lt;/code&gt; to utilize&lt;br&gt;
one of the 0.0.4 images.&lt;/p&gt;

</description>
      <category>pebl</category>
      <category>devops</category>
      <category>cloud</category>
      <category>infrastructureascode</category>
    </item>
    <item>
      <title>Go SDK!</title>
      <dc:creator>Jin Lee</dc:creator>
      <pubDate>Thu, 18 May 2023 07:19:48 +0000</pubDate>
      <link>https://dev.to/pebl/go-sdk-4933</link>
      <guid>https://dev.to/pebl/go-sdk-4933</guid>
      <description>&lt;p&gt;Release 0.0.3 now includes support for Go!&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick Summary
&lt;/h2&gt;

&lt;p&gt;Pebl now supports projects in Go! Update to the latest CLI and &lt;a href="https://docs.pebl.io/guides/go/service"&gt;follow this guide&lt;/a&gt; to get started.&lt;/p&gt;

&lt;h2&gt;
  
  
  Longform
&lt;/h2&gt;

&lt;p&gt;At pebl we often talk about creating a full abstraction layer for the cloud. And at the core of this idea is that we can provide the full set of cloud capabilities through a programmatic binding, allowing developers to encode their infrastructure as code. An important mark of whether this is feasible is by expanding the set of languages that we support.&lt;/p&gt;

&lt;p&gt;So we are very excited to release pebl's Go SDK, meaning that you can now incorporate pebl's cloud capabilities into your Go projects!&lt;/p&gt;

&lt;h2&gt;
  
  
  Short Example
&lt;/h2&gt;

&lt;p&gt;The Go SDK is available as a &lt;a href="https://pkg.go.dev/github.com/peblcloud/go/sdk"&gt;public package&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Simply run &lt;code&gt;go get github.com/peblcloud/go&lt;/code&gt; and incorporate in your app:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;package&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="s"&gt;"net/http"&lt;/span&gt;
    &lt;span class="s"&gt;"github.com/peblcloud/go/sdk"&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;service&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;NewServeMux&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="n"&gt;service&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HandleFunc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;func&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ResponseWriter&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Request&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Write&lt;/span&gt;&lt;span class="p"&gt;([]&lt;/span&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"hello, world!&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="p"&gt;})&lt;/span&gt;

    &lt;span class="n"&gt;sdk&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Service&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;service&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"hey.pebl.rocks"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To run, use the familiar &lt;code&gt;pebl run&lt;/code&gt; cli command at the root of the project. Note that unlike Python projects, Go projects do not require a Dockerfile!&lt;/p&gt;

&lt;p&gt;For a more detailed tutorial of using pebl's Go SDK, check out our &lt;a href="https://docs.pebl.io/guides/go/service"&gt;guided example&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Python
&lt;/h2&gt;

&lt;p&gt;A short note on the Python SDK, we have expanded the set of base images available for your use! Now you can combine the desired pebl SDK version (latest is 0.0.3) with the desired Python version (3.10, 3.11, 3.12). You can find more information on our &lt;a href="https://hub.docker.com/r/peblcloud/python"&gt;peblcloud dockerhub&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>pebl</category>
      <category>devops</category>
      <category>cloud</category>
      <category>go</category>
    </item>
    <item>
      <title>Modern Cloud Workflow with Pebl - Part 4</title>
      <dc:creator>Jin Lee</dc:creator>
      <pubDate>Mon, 08 May 2023 22:49:35 +0000</pubDate>
      <link>https://dev.to/pebl/modern-cloud-workflow-with-pebl-part-4-36pf</link>
      <guid>https://dev.to/pebl/modern-cloud-workflow-with-pebl-part-4-36pf</guid>
      <description>&lt;p&gt;In part 3 we explored adding object store capabilities with an intuitive file system interface.&lt;/p&gt;

&lt;p&gt;In part 4 we are going to look at adding scheduled tasks to our application.&lt;/p&gt;

&lt;h2&gt;
  
  
  Decorating Scheduled Tasks
&lt;/h2&gt;

&lt;p&gt;With pebl scheduled tasks are created with a python decorator placed on the function that you want to run at a regular interval:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;pebl&lt;/span&gt;

&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;pebl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cron&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"task"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"@hourly"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;task&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
  &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;time&lt;/span&gt;
  &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;" -- task running at:"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first argument to the decorator is a unique identifier provided by you. Pebl ensures that there's only one scheduled task ever registered for each identifier, meaning that updates &amp;amp; redeploys behave as expected.&lt;/p&gt;

&lt;p&gt;The second argument is the interval, and currently only two values are supported, &lt;code&gt;@hourly&lt;/code&gt; and &lt;code&gt;@daily&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Simple Example
&lt;/h2&gt;

&lt;p&gt;Let's incorporate a scheduled task into our Flask application! And while doing so let's also utilize the object store. We will create a simple daily task that snapshots the current count.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;pebl&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;redis&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;flask&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;Flask&lt;/span&gt;

&lt;span class="n"&gt;conn&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Redis&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="n"&gt;pebl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;redis&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"redis-1"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;span class="n"&gt;app&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Flask&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;__name__&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;root&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;"Hello!"&lt;/span&gt;

&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/counter"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;methods&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"POST"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;increment&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
  &lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;incr&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"counter"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;"success!"&lt;/span&gt;

&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;route&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/counter"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;methods&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;"GET"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_count&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
  &lt;span class="n"&gt;curr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"counter"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s"&gt;"counter"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;curr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;curr&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="o"&gt;@&lt;/span&gt;&lt;span class="n"&gt;pebl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;cron&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"snapshot"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"@hourly"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;counter_snapshot&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
  &lt;span class="n"&gt;path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="s"&gt;"/snapshots/&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt;
  &lt;span class="n"&gt;curr&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;conn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"counter"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="nb"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"w"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;curr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;encode&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;

&lt;span class="n"&gt;pebl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;service&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"your-subdomain.pebl.rocks"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Give this a try by running it with &lt;code&gt;pebl run&lt;/code&gt;!&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;And with that we have covered four key capabilities provided by the pebl SDK, and also how to run and deploy pebl workloads.&lt;/p&gt;

</description>
      <category>pebl</category>
      <category>devops</category>
      <category>cloud</category>
      <category>infrastructure</category>
    </item>
    <item>
      <title>pebl cli release - redis tunnel support!</title>
      <dc:creator>Jin Lee</dc:creator>
      <pubDate>Fri, 05 May 2023 18:29:45 +0000</pubDate>
      <link>https://dev.to/pebl/pebl-cli-release-redis-tunnel-support-4ok9</link>
      <guid>https://dev.to/pebl/pebl-cli-release-redis-tunnel-support-4ok9</guid>
      <description>&lt;h2&gt;
  
  
  Quick Summary
&lt;/h2&gt;

&lt;p&gt;The latest pebl cli now supports creating tunnels to your redis instances!&lt;br&gt;
Make sure to download the latest cli in order to easily gain access to&lt;br&gt;
your remote redis instances.&lt;/p&gt;


&lt;h2&gt;
  
  
  Longform
&lt;/h2&gt;

&lt;p&gt;If you don't have redis running on pebl's cloud runtime yet, head&lt;br&gt;
over to the &lt;a href="https://docs.pebl.io/guides/python/redis"&gt;intro to redis&lt;/a&gt; guide&lt;br&gt;
to create one!&lt;/p&gt;
&lt;h3&gt;
  
  
  setup
&lt;/h3&gt;

&lt;p&gt;Follow the &lt;a href="https://docs.pebl.io/setup"&gt;setup guide&lt;/a&gt; to install&lt;br&gt;
the latest pebl cli. Make sure that the cli is properly installed&lt;br&gt;
by checking the output of &lt;code&gt;pebl version&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ pebl version
0.0.2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  pebl tunnel
&lt;/h3&gt;

&lt;p&gt;To create the tunnel, simply run the &lt;code&gt;pebl tunnel&lt;/code&gt; command and supply&lt;br&gt;
the name of the redis instance you want to connect to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ pebl tunnel my-redis-1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, if you have just one redis in our cloud runtime, you can omit&lt;br&gt;
the name argument:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ pebl tunnel
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will automatically create a tunnel to your one redis instance.&lt;/p&gt;

&lt;h3&gt;
  
  
  redis-cli
&lt;/h3&gt;

&lt;p&gt;The command allocates a local port that will proxy traffic between&lt;br&gt;
your local machine to the cloud redis instance. The command will&lt;br&gt;
output the local port and an example &lt;code&gt;redis-cli&lt;/code&gt; command that you&lt;br&gt;
can invoke:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ pebl tunnel
tunnel established at: 127.0.0.1:12345
use redis-cli to connect:
redis-cli -p 12345
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then simply invoke the &lt;code&gt;redis-cli&lt;/code&gt; with the &lt;code&gt;-p&lt;/code&gt; option to connect.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ redis-cli -p 12345
127.0.0.1:12345&amp;gt; ping
PONG
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And that's it! That should give a fast way to inspecting your&lt;br&gt;
redis instances. For more information on how to utilize redis&lt;br&gt;
on the pebl runtime, head over to the&lt;br&gt;
&lt;a href="https://docs.pebl.io/guides/python/redis"&gt;intro to redis&lt;/a&gt; guide.&lt;/p&gt;

</description>
      <category>pebl</category>
      <category>devops</category>
      <category>cloud</category>
      <category>release</category>
    </item>
  </channel>
</rss>
