<?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 Charbel El-Jalkh on Medium]]></title>
        <description><![CDATA[Stories by Charbel El-Jalkh on Medium]]></description>
        <link>https://medium.com/@charbeleljalkh?source=rss-92a17a69f826------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by Charbel El-Jalkh on Medium</title>
            <link>https://medium.com/@charbeleljalkh?source=rss-92a17a69f826------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 17:19:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@charbeleljalkh/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[Cloud Pub/Sub in Laravel]]></title>
            <link>https://medium.com/carsguide-engineering/cloud-pub-sub-in-laravel-9f6220019f2c?source=rss-92a17a69f826------2</link>
            <guid isPermaLink="false">https://medium.com/p/9f6220019f2c</guid>
            <category><![CDATA[gcp]]></category>
            <category><![CDATA[google-cloud-pubsub]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[php]]></category>
            <dc:creator><![CDATA[Charbel El-Jalkh]]></dc:creator>
            <pubDate>Mon, 30 Nov 2020 23:48:09 GMT</pubDate>
            <atom:updated>2020-11-30T23:48:09.068Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>It was a new sprint and I was assigned a task to unpack Cloud Pub/Sub and see how we can implement it in our current system to integrate data. End goal was to be able to send messages from one service and then on the other end pull them from the second service. I had close to zero knowledge on how Publishers and Subscribers work. Only thing that pops up on my mind when I hear the term Pub/Sub is Apache Kafka, however I have no idea how it’s architected or how to use it, which didn’t help much. At the end of the day, I took the challenge and decided to dig deep into Google’s Cloud Pub/Sub.</blockquote><blockquote>Like any other tech stack or product that a Software Engineer wishes to use for the very first time, there is always a learning curve. It can feel too overwhelming at first but at the end of the day I assure you that nothing is impossible, it’s only a matter of time on when you will grasp it. As a first timer, I always recommend using the official documentation for any technology, I mean they are the people behind it and that way you would be able to keep your mind on one resource, but as you get comfortable its never a bad idea to explore other content.</blockquote><h3>What is Cloud Pub/Sub?</h3><p>Cloud Pub/Sub is a real-time asynchronous messaging service that is fully-managed, it allows you to send and receive messages between applications that do not depend on each other.</p><h3>Cloud Pub/Sub fundamentals</h3><p><strong>Publisher: </strong>The service that sends messages.</p><p><strong>Topic</strong>: A named resource to which publishers send messages to.</p><p><strong>Subscription(Push/Pull)</strong>: A named resource that represents the stream of messages from a specific topic, this will then be delivered to the subscriber.<br>Can either be Push or Pull. If using Push, then Pub/Sub delivers the messages as soon as they have been published. Whereas if using Pull, then subscribers should request pulling the messages.</p><p><strong>Message</strong>: A mix of data and attributes that are sent by a publisher and eventually end up getting delivered to subscribers. Messages are kept for 7 days.</p><p><strong>Subscriber: </strong>The service that receives the messages.</p><p><strong>Acknowledged (Ack): </strong>Informs the subscription that the message has been received by the subscriber. No other subscriber will be able to pull the message if a message is acknowledged.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4YtdU6xiCnuPpUCM.png" /></figure><h3>Getting started</h3><blockquote>I will show you step by step on how to setup Google’s Cloud Pub/Sub in GCP dashboard, followed by implementing it using Laravel 8.x<br>Our main goal is to be able to push messages to the topic from the publisher’s endpoint and pull the messages from the subscriber’s endpoint.</blockquote><h4>Setting up Cloud Pub/Sub in Google Cloud Platform:</h4><p><strong>Step 1:</strong></p><p><a href="https://console.cloud.google.com/freetrial/signup/tos">Sign up to Google Cloud Platform</a></p><p><strong>Step 2:</strong></p><p><a href="https://console.cloud.google.com/projectcreate">Create a Google Cloud project</a></p><p>Name the project sandbox</p><p><strong>Step 3:</strong></p><p><a href="https://console.cloud.google.com/cloudpubsub/topic/list">Go to Cloud Pub/Sub in GCP dashboard</a></p><p><strong>Step 4:</strong></p><p>Create a topic named topic-test</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bOB-DWH37zu5EMMQ.png" /></figure><p><strong>Step 5:</strong></p><p>After a topic is created, scroll down and create a subscription for the topic.<br>Alternatively, you can create a subscription by <a href="https://console.cloud.google.com/cloudpubsub/subscription/list">clicking on the subscription in the left hand panel</a> and linking it to the topic you just created.</p><p>Name the subscription subscription-test</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*K8RKRoAYMF4UF7Gh.png" /></figure><p><strong>Step 6:</strong></p><p>Now that we have both a topic and a subscription created, we need to <a href="https://console.cloud.google.com/iam-admin/serviceaccounts/create">create a service account</a></p><p>Name the service account cloud-pub-sub-account</p><p><strong>Step 7:</strong></p><p>Add the following roles to grant the service account access to the project</p><p>Pub/Sub Publisher</p><p>Pub/Sub Subscriber</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dwwhUGP9uL4t__-1.png" /></figure><p><strong>Step 8:</strong></p><p>Create a JSON key type file.<br>This file will be used for authentication to access Cloud Pub/Sub.<br>Store the file in a safe place.<br>Rename the file to sandbox-cloud-pub-sub.json</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*L7nVhaRj3kMreXqc.png" /></figure><h4>Setting up Laravel to use Cloud Pub/Sub:</h4><p><strong>Step 1:</strong></p><p>In your Laravel project, install Cloud Pub/Sub client library.</p><p>$ composer require google/cloud-pubsub</p><p><strong>Step 2:</strong></p><p>Add the following variable to your .env file. The value should be the path of the JSON key file used for authentication.</p><p>GOOGLE_APPLICATION_CREDENTIALS=app/sandbox-cloud-pub-sub.json</p><p><strong>Step 3:</strong></p><p>Add the following api endpoints in routes/api.php.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2304cda16d43fca9043ed8b7d1390ef1/href">https://medium.com/media/2304cda16d43fca9043ed8b7d1390ef1/href</a></iframe><p>Create a PublisherController.php file with the following code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8080bf929a9409ea20b83582358cae79/href">https://medium.com/media/8080bf929a9409ea20b83582358cae79/href</a></iframe><p>Create a SubscriberController.php file with the following code.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cd8405a4f6972fcb04d9f1137e659e3e/href">https://medium.com/media/cd8405a4f6972fcb04d9f1137e659e3e/href</a></iframe><h4>Running the application:</h4><p>Navigate to the root directory of your Laravel project and spin up your application using<br>$ php artisan serve</p><p>To publish messages to the topic, send a POST request to the following endpoint.<br>http://127.0.0.1:800/api/publish</p><p>To pull the stored messages, send a POST request to the following endpoint.<br>http://127.0.0.1:800/api/pull</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F3oriePyXoWNJ5Gf8zu%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F3oriePyXoWNJ5Gf8zu%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2F3oriePyXoWNJ5Gf8zu%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="331" frameborder="0" scrolling="no"><a href="https://medium.com/media/592dccb2cf1cafe735256a871d300a6f/href">https://medium.com/media/592dccb2cf1cafe735256a871d300a6f/href</a></iframe><h3>Conclusion</h3><p>You can check the repo in the below link.<br><a href="https://github.com/CharbelJ/cloud-pub-sub">https://github,com/CharbelJ/cloud-pub-sub</a></p><p>or clone it to your machine</p><p>$ git clone <a href="https://github.com/CharbelJ/cloud-pub-sub.git">https://github.com/CharbelJ/cloud-pub-sub.git</a></p><p>It always feels good to share knowledge. I hope this article makes it easier to use Cloud Pub/Sub in your Laravel project.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9f6220019f2c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/carsguide-engineering/cloud-pub-sub-in-laravel-9f6220019f2c">Cloud Pub/Sub in Laravel</a> was originally published in <a href="https://medium.com/carsguide-engineering">CAMS Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Dockerize a Laravel application]]></title>
            <link>https://medium.com/carsguide-engineering/how-to-dockerize-a-laravel-application-77a24ba669c5?source=rss-92a17a69f826------2</link>
            <guid isPermaLink="false">https://medium.com/p/77a24ba669c5</guid>
            <category><![CDATA[docker-image]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[docker-compose]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[laravel]]></category>
            <dc:creator><![CDATA[Charbel El-Jalkh]]></dc:creator>
            <pubDate>Wed, 10 Jun 2020 00:40:32 GMT</pubDate>
            <atom:updated>2021-07-30T09:31:59.941Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>When I first was told to use Docker in my local dev environment. I didn’t have any idea what it is or how it works. All I can remember is that I need to bring a container up docker-compose up and then bring it down by docker-compose down. As any Software Engineer, I was very curious to see how Docker works, what makes it so popular. I dug into a lot of articles, online tutorials, and even interactive browser-based scenarios. Completing the above, I still felt I did not grasp the idea of how Docker works. I decided to hit the pedal and Dockerize my Laravel application.</blockquote><h3>What is Docker?</h3><p>Docker is an open source tool that allows you to develop, ship, and run applications. One of its main advantages is that it allows you to run an application in an isolated environment. It goes by the term ‘you build it once and you run it anywhere’ it does not care what setup you have on your OS, which makes development fast when working across different operating systems.</p><h3>Docker fundamentals</h3><p><strong>Docker client (docker):</strong> the primary way that users interact with Docker. When we use docker commands, the client sends them to docker daemon (dockerd) to execute them.</p><p><strong>Docker daemon (dockerd):</strong> listens for Docker API requests sent from the docker client. It manages networks, containers, images, and volumes.</p><p><strong>Image:</strong> a read-only template with steps to create a Docker container. An image can consist of multiple layers. Like building an image that is based on PHP, but installs composer as well. You can create your own image or use already existing ones. To create your own image, a Dockerfile needs to be created.</p><p><strong>Container:</strong> it is an instance of a running image.</p><p><strong>Volumes:</strong> the device that stores persisting data to be accessed by Docker containers.</p><p><strong>Networks:</strong> allows Docker containers to connect together.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vbGHnT2NG7df2MMWfETGVg.png" /></figure><h3>Getting started</h3><blockquote>I will show you step by step on how to make a Laravel 8.x application work locally using Docker. Our main goal is to be able to execute PHP, Composer and npm commands in the same container.</blockquote><h4>Prerequisites</h4><ul><li>Docker Engine (v19.03.0+)</li><li>Docker Compose</li></ul><h4>Setup</h4><p><strong>Step 1:</strong></p><p>Install <a href="https://www.docker.com/products/docker-desktop">Docker Desktop</a> (includes both Docker Engine and Docker Compose)</p><p><strong>OR</strong></p><p>Install <a href="https://docs.docker.com/engine/install/">Docker Engine</a> and <a href="https://docs.docker.com/compose/install/">Docker Compose</a> separately.</p><p><strong>Step 2:</strong></p><p>Create a docker-compose.yaml file in the root directory of your project with the following code</p><p>$ touch docker-compose.yaml</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/288fbdbd2bf70cc926bc782b0e65634c/href">https://medium.com/media/288fbdbd2bf70cc926bc782b0e65634c/href</a></iframe><p><strong>Step 3:</strong></p><p>Create a docker/php directory in the root directory of your project and add a Dockerfile with the following code</p><p>$ mkdir -p docker/php &amp;&amp; touch docker/php/Dockerfile</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/57c72f98f44f8fa11ff684b2df6a08e4/href">https://medium.com/media/57c72f98f44f8fa11ff684b2df6a08e4/href</a></iframe><p><strong>Step 4:</strong></p><p>Create a laravel.ini file inside the docker/php directory with the following code</p><p>$ touch docker/php/laravel.ini</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2ae2ea4c775e3a5a50415dda76cd786d/href">https://medium.com/media/2ae2ea4c775e3a5a50415dda76cd786d/href</a></iframe><p><strong>Step 5:</strong></p><p>Create a docker/nginx directory in the root directory of your project and add a Dockerfile with the following code</p><p>$ mkdir -p docker/nginx &amp;&amp; touch docker/nginx/Dockerfile</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3c6c2e68de729c1046474e1e44886d07/href">https://medium.com/media/3c6c2e68de729c1046474e1e44886d07/href</a></iframe><p><strong>Step 6:</strong></p><p>Create a entrypoint.sh file inside docker/nginx directory with the following code</p><p>$ touch docker/nginx/entrypoint.sh</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3ebde352805daf01b624ca20f188a902/href">https://medium.com/media/3ebde352805daf01b624ca20f188a902/href</a></iframe><p><strong>Step 7:</strong></p><p>Create a fpm-template.conf file inside docker/nginx directory with the following code</p><p>$ touch docker/nginx/fpm-template.conf</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/69f785093121cb31c22f9ec3e729ab87/href">https://medium.com/media/69f785093121cb31c22f9ec3e729ab87/href</a></iframe><p><strong>Step 8:</strong></p><p>Create a nginx.conf file inside docker/nginx directory with the following code</p><p>$ touch docker/nginx/nginx.conf</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/91a1b6f0d2aa0ac79f823d251df045b4/href">https://medium.com/media/91a1b6f0d2aa0ac79f823d251df045b4/href</a></iframe><p><strong>Step 9:</strong></p><p>In the root directory of your project create a .env file from the existing .env.example file and modify the following fields in your .env file to use the values specified in the database container</p><p>$ cp .env.example .env</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b36506ca2c2d4eb5dd5cb4eb3a6be625/href">https://medium.com/media/b36506ca2c2d4eb5dd5cb4eb3a6be625/href</a></iframe><p>To run the containers you should be in the root directory of the project.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F3orif1cg5cuMZkkH9C%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F3orif1cg5cuMZkkH9C%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2F3orif1cg5cuMZkkH9C%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/e199aec41a8fdd75f9f5b7417c98d2be/href">https://medium.com/media/e199aec41a8fdd75f9f5b7417c98d2be/href</a></iframe><p><strong>To bring all containers up:</strong></p><p>$ docker-compose up -d</p><p>The command will take a while to run, since it will build the images for the first time.</p><p><em>note: any change you make to the Dockerfile or any other file that the Dockerfile uses (excluding docker-compose.yaml) you will need to build the images again for the changes to take effect by executing the following command.<br></em>docker-compose build &amp;&amp; docker-compose up -d</p><p><strong>To list all running containers:</strong></p><p>$ docker ps</p><p><strong>To run specific commands in your app container:</strong></p><p>We want to be able to run artisan, composer, and npm commands all in the same container. To run these commands, you should enter the app container by executing the following command:</p><p>$ docker-compose exec blog_app bash</p><p><strong>To access your Laravel Application visit:</strong></p><p><a href="http://localhost:8000/">localhost:8000</a></p><p><strong>To exit a container:</strong></p><p>$ exit</p><p><strong>To bring all containers down:</strong></p><p>$ docker-compose down</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F3orif2yRVSOcd1VuN2%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F3orif2yRVSOcd1VuN2%2Fgiphy.gif&amp;image=https%3A%2F%2Fmedia3.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExYjUwOTVpOWsxbmluaGtscGVkazBvbWxpdDUyc2J3N2QzeDZiZjFmZSZlcD12MV9naWZzX2dpZklkJmN0PWc%2F3orif2yRVSOcd1VuN2%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="333" frameborder="0" scrolling="no"><a href="https://medium.com/media/e68a9bb6d5036b57532e87d78d85cc67/href">https://medium.com/media/e68a9bb6d5036b57532e87d78d85cc67/href</a></iframe><h3>Conclusion</h3><p>You can check the repo in the below link.<br><a href="https://github.com/CharbelJ/blog">https://github.com/CharbelJ/blog</a></p><p>or clone it to your machine</p><p>$ git clone <a href="https://github.com/CharbelJ/blog.git">https://github.com/CharbelJ/blog.git</a></p><p>I am excited that I have shared my knowledge on how to use Docker to develop Laravel Applications. I hope you found this article useful.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=77a24ba669c5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/carsguide-engineering/how-to-dockerize-a-laravel-application-77a24ba669c5">How to Dockerize a Laravel application</a> was originally published in <a href="https://medium.com/carsguide-engineering">CAMS Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>