<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Yashwindar on Medium]]></title>
        <description><![CDATA[Stories by Yashwindar on Medium]]></description>
        <link>https://medium.com/@yashwindar2624?source=rss-19128a5597cf------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*HNbdFRxOjYx76wOA</url>
            <title>Stories by Yashwindar on Medium</title>
            <link>https://medium.com/@yashwindar2624?source=rss-19128a5597cf------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 05:14:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@yashwindar2624/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to deploy the project’s Docker Image to AWS ECR private repository using GitHub Actions]]></title>
            <link>https://articles.readytowork.jp/how-to-deploy-the-projects-docker-image-to-aws-ecr-private-repository-using-github-actions-e978e0f6ee8e?source=rss-19128a5597cf------2</link>
            <guid isPermaLink="false">https://medium.com/p/e978e0f6ee8e</guid>
            <category><![CDATA[ecr]]></category>
            <category><![CDATA[docker-compose]]></category>
            <category><![CDATA[golang]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Yashwindar]]></dc:creator>
            <pubDate>Wed, 07 Sep 2022 09:11:29 GMT</pubDate>
            <atom:updated>2022-09-08T16:56:31.685Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/856/1*xj-A7-vcBwvhr2yHV3w5nA.png" /><figcaption>Pushing Docker images to AWS ECR using GitHub Actions</figcaption></figure><p>For following this blog, we must have an <strong>AWS account</strong> and a<strong> GitHub account</strong>.</p><h3><strong>Step-1: Creating a private repository in AWS ECR</strong></h3><p>After logging in to the AWS account, We have to search for ECR (Elastic Container Registry).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*3NNOQXQsdqr52vj91ZnBbQ.png" /><figcaption>Elastic Container Registry (ECR)</figcaption></figure><p>Here, we will have to click on create a repository by selecting private on the top.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*F0yEhn92Oo59JfaF1OoczA.png" /><figcaption>Create Private Repository</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*g2LpLtK7pF0l0o8YcgctRw.png" /><figcaption>Creating a private ECR repository</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*JEPwQH55li2y1YdPyvRKeQ.png" /><figcaption>Private ECR repository Created</figcaption></figure><h3>Step-2: Creating a Policy for deploying docker images using GitHub Actions</h3><p>For adding the policy have to search for “IAM” and click on the first option as shown in the figure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/828/1*uTgtRd4O16Qwu8ktxzMfmQ.png" /><figcaption>IAM Policy</figcaption></figure><p>Now, click on the “Create policy” Button</p><p>I am naming the policy “AllowPushPullPolicy”, you can give any suitable name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*00OQfwxprRX-6GhstKyGuQ.png" /><figcaption>Creating policy</figcaption></figure><p>Now, we have to select “JSON” and edit the policy,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*5nDm8Qbs9lnUxJwKyFRdBw.png" /><figcaption>Policy to push Images</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/983/1*mebnGQAzwy1MG2iU3jj5mQ.png" /><figcaption>ECR resource</figcaption></figure><p>In the Resource, please replace your account Id, you can find it by clicking on the dropdown of your account name available on the Navbar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/491/1*hY_VO1ISobIn7h8tUHFfxg.png" /><figcaption>Account ID</figcaption></figure><h3>Step-3: Creating a User Group</h3><p>Now, we will have to create a User Group. For this, we have to click on the User groups link on the left side navBar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*qrKTTYO72-kSbb9zLdPwQg.png" /><figcaption>User Groups</figcaption></figure><p>We can click on create group button, please provide a suitable name to the group, I am naming it “push-pull-images”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*0KcG_2elaVz_zSLWkU6MQQ.png" /><figcaption>Naming User Group</figcaption></figure><p>We will have to attach the policy we created above to this group. For this, we will have to fill in the checkbox by searching the policy we created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*1AeW_w4nf_IrV4XAKZygYg.png" /><figcaption>Attaching the policy to the group</figcaption></figure><h3>Step-4: Creating a user for pushing images from GitHub actions</h3><p>Now, we will have to create a User so that we can be authenticated and be allowed to push the images to ECR.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*QXRV-vn_fnkcoWP9Y-7uEQ.png" /><figcaption>Users</figcaption></figure><p>To create a user Please click on the “Add users” button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*vNEWteEuT9BcyqRdMsHT1w.png" /><figcaption>Naming the User</figcaption></figure><p>I am naming the user as “github-actions”, you can give any suitable name.</p><blockquote>Please Note to check “Access key- Programmatic access” Before clicking the Next button.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/878/1*iXPc6hyASLwBxyWydL7mCw.png" /><figcaption>Selecting the group</figcaption></figure><p>We will have to select the group we created before, In my case, it is “push-pull-images”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*NoB9ZEjdauddshCyoeRblw.png" /><figcaption>User Credentials</figcaption></figure><blockquote>Please keep the <strong>Access Key ID</strong> and<strong> Secret</strong> saved somewhere, these credentials will be needed to push out docker image to ECR.</blockquote><h3>Step-5: Creating GitHub Secrets using users’ credentials and pushing Docker image</h3><p>Now, we have created GitHub secrets so that we can store out AWS users’ credentials.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*3_RTtKbrDDKGT2S3hBLxjg.png" /><figcaption>Creating GitHub Secrets</figcaption></figure><p>I have created a sample Go project for this blog,</p><p><a href="https://github.com/jaswinda/iguana_api">GitHub - jaswinda/iguana_api: Backed of the IGUANA MEXICANA</a></p><p>After attaching the secrets to the project repository, we will have to dockerize our project. For this demo, I am dockerizing a go project where I will have to attach a go.yml file. I have also created a script that will help me give a version number to every new merge in the main branch while creating a new image i.e., git_update.sh</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/80bcf86a6e67dc73037d314eb251b767/href">https://medium.com/media/80bcf86a6e67dc73037d314eb251b767/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/19e45d79d3fba4c671f7c097124bade2/href">https://medium.com/media/19e45d79d3fba4c671f7c097124bade2/href</a></iframe><p>Here, in go.yml we have mentioned the “main” branch as a production branch, So any commit to the main branch will run GitHub action, where it will run tests, create a docker image and push it to the ECR using the AWS credentials that we have saved in GitHub secrets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*nKr7VwDZ3-dkucYj7lJ-dw.png" /><figcaption>GitHub Workflows</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*YzXaWTTVKk5nF97-i6Nlsw.png" /><figcaption>Version Tags</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gNSsfPp7eAZPYTWzy_clDQ.png" /><figcaption>ECR Images</figcaption></figure><p>We have successfully pushed the docker image of our project to a private repository.</p><p>Happy Coding!! 🥳🥳</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e978e0f6ee8e" width="1" height="1" alt=""><hr><p><a href="https://articles.readytowork.jp/how-to-deploy-the-projects-docker-image-to-aws-ecr-private-repository-using-github-actions-e978e0f6ee8e">How to deploy the project’s Docker Image to AWS ECR private repository using GitHub Actions</a> was originally published in <a href="https://articles.readytowork.jp/">readytowork, Inc.</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Laravel-multitenancy & Creating Sub-domains and databases dynamically]]></title>
            <link>https://articles.readytowork.jp/laravel-multitenancy-creating-sub-domains-and-databases-dynamically-483e7d7f5540?source=rss-19128a5597cf------2</link>
            <guid isPermaLink="false">https://medium.com/p/483e7d7f5540</guid>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[multitenancy]]></category>
            <dc:creator><![CDATA[Yashwindar]]></dc:creator>
            <pubDate>Wed, 06 Jul 2022 07:07:16 GMT</pubDate>
            <atom:updated>2022-07-06T07:44:02.377Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LS6C5mq5jeMgzCZi.png" /><figcaption>Multitenancy</figcaption></figure><h3>Why do we need multitenancy?</h3><p>When we want separate users(subdomains) interface with a separate database for each of the users but controlled by a single application, we can use multitenancy.</p><blockquote>Here, we will see how can we share a single application for different users(subdomains) and different databases using <strong>Laravel.</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/212/1*AXJoTM4kNsqL1ofcPtPuWg.png" /><figcaption>Shared application &amp; Separate Database</figcaption></figure><p>We will be using “<strong><em>spatie/laravel-multitenancy” </em></strong>package for multitenancy. This package provides us with a set of commands which help us to migrate the tables into the databases for each of the tenants(sub-domains).</p><p>The main aim of this article is not to introduce multitenancy, but to help readers to be aware that subdomains and databases can be created dynamically. As you can read about how <strong><em>multitenancy </em></strong>in Laravel, <a href="https://spatie.be/docs/laravel-multitenancy/v2/introduction">Here</a>.</p><h3>Creating Subdomains and databases Dynamically</h3><p>For the following functions, we can make them “Helper Functions”, and use them whenever we can to create a new subdomain and a database associated with that subdomains.</p><p>Here After any subdomain and database is created, we are running the following command:</p><pre>Artisan::call(‘tenants:artisan “migrate — database=tenant”’);</pre><p>The above command migrates the tables into the newly created database.</p><p>It works on the hosting with the CPanel.</p><p>GITHUB: <a href="https://github.com/readytowork-org/createSubdomainAndDatabaseDynamically/blob/main/createSubdomain.php">CODE LINK</a></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6f2241a52bb08fabd4f8d6a8dc7702de/href">https://medium.com/media/6f2241a52bb08fabd4f8d6a8dc7702de/href</a></iframe><h3>How to implement this in Laravel Project?</h3><p>We can create a simple helper file with the above functions for creating subdomains and databases.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/313/1*-bnr0fI-51_RrqujCG3HSw.png" /><figcaption>Helper PHP file</figcaption></figure><p>Now, whenever we want to create a new tenant we can use these helper functions. I used the following functions when the users signed up for my application to provide them with particular user dashboards.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/662/1*x8vVoMiSZgKA6PJ8z--vnQ.png" /><figcaption>Register a new Tenant</figcaption></figure><p>Here, Initially, the user details are validated, and a row is added to the landlord&#39;s user table with the provided details.</p><p>After that, we can use our helper functions to create a particular subdomain for the user. Again after the subdomain and database have been created for the user, we have used the following command to migrate the tables in our helper function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/583/1*SDDDulEqYTHjs-jTR9JSMA.png" /></figure><p>Now, after that, we have added the first user with the same details provided to for creating a tenant (subdomain).</p><h3>The output of the project</h3><p>In my case, I had a react project that was using the APIs from my Laravel project. So, what I had to do is deploy the react project in one of the directories and use the same project from different subdomains and APIs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*XGVqhljE8OcNXXc7eISOCA.png" /><figcaption>Tenant Registration</figcaption></figure><p>A new user is asked for the details like username, name, and other details. Most importantly, for my project, users had signup or login to register themselves to create a new subdomain and one user was allowed to create one subdomain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rkbtIsp4W6WROoMU4Z9D0A.png" /><figcaption>Tenant Information</figcaption></figure><p>After the subdomain was active, the user was allowed to visit the subdomain,</p><blockquote>For the demo, I created <a href="https://harke.everestbilling.com/">https://harke.everestbilling.com/</a></blockquote><p>As I mentioned, In my case I had to create a subdomain for API too for each of the tenants, so the other subdomain automatically generated was:</p><p><a href="https://api-harke.everestbilling.com/">https://api-harke.everestbilling.com/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GhBTcxumM3OhdNEbysfMBA.png" /><figcaption>Subdomain with react project</figcaption></figure><p>Here, the above figure is a react project which uses its particular API, subdomain, and database.</p><p>To view its working flow, please use the following credentials,</p><blockquote>Username: user@gmail.com</blockquote><blockquote>Password: password</blockquote><p>Happy Coding!! 🥳🥳</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=483e7d7f5540" width="1" height="1" alt=""><hr><p><a href="https://articles.readytowork.jp/laravel-multitenancy-creating-sub-domains-and-databases-dynamically-483e7d7f5540">Laravel-multitenancy &amp; Creating Sub-domains and databases dynamically</a> was originally published in <a href="https://articles.readytowork.jp/">readytowork, Inc.</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[API Documentation in Laravel Project with Swagger]]></title>
            <link>https://articles.readytowork.jp/api-documentation-in-laravel-project-with-swagger-c4ac0ef28ebc?source=rss-19128a5597cf------2</link>
            <guid isPermaLink="false">https://medium.com/p/c4ac0ef28ebc</guid>
            <category><![CDATA[lumen]]></category>
            <category><![CDATA[api-documentation]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[swagger]]></category>
            <dc:creator><![CDATA[Yashwindar]]></dc:creator>
            <pubDate>Thu, 16 Jun 2022 11:51:21 GMT</pubDate>
            <atom:updated>2022-06-16T11:51:21.912Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/560/0*574E61nKoiDuyXlX.png" /><figcaption>Laravel Swagger API Documentation</figcaption></figure><p>Giving API users an interactive view of your whole API is always a smart idea when developing an API. Things will be much better if the interactive tool can be utilized as a testing ground for your API. Swagger is a platform for creating and visualizing RESTful APIs that are independent of language or framework. Laravel and Lumen are two of the most popular frameworks for building PHP-based web apps and APIs these days.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FOhNlhvFG96M%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DOhNlhvFG96M&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FOhNlhvFG96M%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/f7d7833a75374eded0ec3adfb0be8c01/href">https://medium.com/media/f7d7833a75374eded0ec3adfb0be8c01/href</a></iframe><h3>Installation</h3><p>DarkaOnLine/L5-Swagger is one of the most popular packages for creating OpenAPI documentation in Laravel.</p><p>To install the package we have to run the following command:</p><pre>composer require darkaonline/l5-swagger</pre><blockquote><strong><em>We next publish config/views from Service Provider: following the installation instructions in the </em></strong><a href="https://github.com/DarkaOnLine/L5-Swagger#readme"><strong>Readme.</strong></a></blockquote><pre>php artisan vendor:publish --provider &quot;L5Swagger\L5SwaggerServiceProvider&quot;</pre><p>Now, we have to paste the following command into the .env file</p><pre>L5_SWAGGER_CONST_HOST=http://project.test/api/v1</pre><p>Now, in the Controller.php inside app-&gt;Http-&gt;Controllers-&gt;Controller.php, paste the following command above the class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/210/0*uqYjpbVuRB7wNR7F.png" /><figcaption>Location of Controller.php</figcaption></figure><pre>/**</pre><pre>* @OA\Info(</pre><pre>*    title=&quot;My First Laravel API Documentation&quot;,</pre><pre>*    version=&quot;1.0.0&quot;,</pre><pre>* ),</pre><pre>*   @OA\SecurityScheme(</pre><pre>*       securityScheme=&quot;bearerAuth&quot;,</pre><pre>*       in=&quot;header&quot;,</pre><pre>*       name=&quot;bearerAuth&quot;,</pre><pre>*       type=&quot;http&quot;,</pre><pre>*       scheme=&quot;bearer&quot;,</pre><pre>*       bearerFormat=&quot;JWT&quot;,</pre><pre>*    ),</pre><pre>*/</pre><h3>Creating documentation for a test route</h3><p>For creating the documentation for the route, we have to create a route in the api.php.</p><pre>Route::post(&#39;/test&#39;, [UserController::class, &#39;test&#39;]);</pre><p>Now, in the ‘UserController’ we have to create a “test” function. For swagger documentation for the test route, we will have to Paste the following comment just above the function.</p><pre>/**</pre><pre>*  @OA\GET(</pre><pre>*      path=&quot;/api/test&quot;,</pre><pre>*      summary=&quot;Get all users&quot;,</pre><pre>*      description=&quot;Get all users&quot;,</pre><pre>*      tags={&quot;Test&quot;},</pre><pre>*      @OA\Parameter(</pre><pre>*         name=&quot;name&quot;,</pre><pre>*         in=&quot;query&quot;,</pre><pre>*         description=&quot;name&quot;,</pre><pre>*         required=false,</pre><pre>*      ),</pre><pre>*     @OA\Parameter(</pre><pre>*         name=&quot;email&quot;,</pre><pre>*         in=&quot;query&quot;,</pre><pre>*         description=&quot;email&quot;,</pre><pre>*         required=false,</pre><pre>*      ),</pre><pre>*     @OA\Parameter(</pre><pre>*         name=&quot;page&quot;,</pre><pre>*         in=&quot;query&quot;,</pre><pre>*         description=&quot;Page Number&quot;,</pre><pre>*         required=false,</pre><pre>*      ),</pre><pre>*      @OA\Response(</pre><pre>*          response=200,</pre><pre>*          description=&quot;OK&quot;,</pre><pre>*          @OA\MediaType(</pre><pre>*              mediaType=&quot;application/json&quot;,</pre><pre>*          )</pre><pre>*      ),</pre><pre>*</pre><pre>*  )</pre><pre>*/</pre><pre>public function test(Request $request){</pre><pre>return response()-&gt;json([</pre><pre>&#39;message&#39; =&gt; &#39;Welcome to the API&#39;,</pre><pre>&#39;data&#39; =&gt; $request</pre><pre>]);</pre><pre>}</pre><p>Now, we can run the command to generate the documentation</p><pre>php artisan l5-swagger:generate</pre><p>It should produce a JSON file, which will then be converted into an HTML page.</p><p>To view the documentation we can follow the route: <a href="http://localhost:8000/api/documentation">http://localhost:8000/api/documentation</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/0*kz9XakjWhPJOI0uD.png" /><figcaption>Swagger Documentation of Test Route</figcaption></figure><p>Happy Coding!🎉</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c4ac0ef28ebc" width="1" height="1" alt=""><hr><p><a href="https://articles.readytowork.jp/api-documentation-in-laravel-project-with-swagger-c4ac0ef28ebc">API Documentation in Laravel Project with Swagger</a> was originally published in <a href="https://articles.readytowork.jp/">readytowork, Inc.</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>