<?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 PAWANJOT KAUR BAWEJA on Medium]]></title>
        <description><![CDATA[Stories by PAWANJOT KAUR BAWEJA on Medium]]></description>
        <link>https://medium.com/@pawanjotkaurbaweja?source=rss-365134aea544------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*fA7Oih5_mJaarX3j.jpg</url>
            <title>Stories by PAWANJOT KAUR BAWEJA on Medium</title>
            <link>https://medium.com/@pawanjotkaurbaweja?source=rss-365134aea544------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 11:45:22 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pawanjotkaurbaweja/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[Setting Up Bitbucket Pipeline with Google Cloud VM Machine Using Tunnel]]></title>
            <link>https://medium.com/@pawanjotkaurbaweja/setting-up-bitbucket-pipeline-with-google-cloud-vm-machine-using-tunnel-b25d81dad6d8?source=rss-365134aea544------2</link>
            <guid isPermaLink="false">https://medium.com/p/b25d81dad6d8</guid>
            <category><![CDATA[deployment-pipelines]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[gcpdeployment]]></category>
            <category><![CDATA[gcp]]></category>
            <category><![CDATA[bitbucket-pipelines]]></category>
            <dc:creator><![CDATA[PAWANJOT KAUR BAWEJA]]></dc:creator>
            <pubDate>Sat, 20 Dec 2025 07:53:52 GMT</pubDate>
            <atom:updated>2025-12-20T07:55:23.923Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/775/1*iSnLNl5kP58BOe6gB8D9gA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4mxvebIheAJl5urG5y3I9w.png" /></figure><p>In this guide, we’ll walk through setting up a complete CI/CD pipeline that:</p><ul><li>Pulls code from Bitbucket</li><li>Authenticates with GCP using service accounts</li><li>Connects to your VM via secure tunnel (no SSH keys exposed)</li><li>Deploys your application</li></ul><h3>Step 1: Enable Google Cloud APIs and Grant Necessary IAM Roles</h3><p>Perform these steps from your local machine, and ensure you have access to your Google Cloud account as an administrator.</p><p>Install gcloud first using -</p><pre>curl https://sdk.cloud.google.com | bash<br><br><br>gcloud init</pre><p>Then follow these commands -</p><p>from Google Cloud Console — check and replace the following variables</p><ol><li>YOUR_VM_NAME = name of your compute instance machine</li><li>YOUR_ZONE = where your machine is located, like — asia-south1-b</li><li>YOUR_GCP_PROJECT_ID = project ID of your Google Cloud Console project where the VM is located</li><li>YOUR_SERVICE_ACCOUNT_NAME_AS_IN_STEP_3 = It is generated in step 3 below.</li></ol><pre>1. gcloud services enable iap.googleapis.com compute.googleapis.com <br>oslogin.googleapis.com<br><br>2. gcloud compute instances add-metadata YOUR_VM_NAME \\<br>  --zone=YOUR_ZONE \\<br>  --metadata enable-oslogin=TRUE<br>3. gcloud iam service-accounts create bitbucket-iap \\<br>  --display-name=&quot;Bitbucket IAP SSH&quot;<br><br>//// ABOVE STEP GIVES THE SERVICE ACCOUNT NAME<br><br>4. gcloud projects add-iam-policy-binding YOUR_GCP_PROJECT_ID \\<br>  --member=&quot;serviceAccount:YOUR_SERVICE_ACCOUNT_NAME_AS_IN_STEP_3&quot; \\<br>  --role=&quot;roles/iap.tunnelResourceAccessor&quot;<br>5. gcloud projects add-iam-policy-binding YOUR_GCP_PROJECT_ID \\<br>  --member=&quot;serviceAccount:YOUR_SERVICE_ACCOUNT_NAME_AS_IN_STEP_3&quot; \\<br>  --role=&quot;roles/compute.osLogin&quot;<br>6. gcloud projects add-iam-policy-binding YOUR_GCP_PROJECT_ID \\<br>  --member=&quot;serviceAccount:YOUR_SERVICE_ACCOUNT_NAME_AS_IN_STEP_3&quot; \\<br>  --role=&quot;roles/compute.osAdminLogin&quot;<br>7. gcloud projects add-iam-policy-binding YOUR_GCP_PROJECT_ID \\<br>  --member=&quot;serviceAccount:YOUR_SERVICE_ACCOUNT_NAME_AS_IN_STEP_3&quot; \\<br>  --role=&quot;roles/serviceusage.serviceUsageAdmin&quot;<br>8. gcloud projects add-iam-policy-binding YOUR_GCP_PROJECT_ID \\<br>  --member=&quot;serviceAccount:YOUR_SERVICE_ACCOUNT_NAME_AS_IN_STEP_3&quot; \\<br>  --role=&quot;roles/compute.viewer&quot;<br>9. gcloud projects add-iam-policy-binding YOUR_GCP_PROJECT_ID \\<br>  --member=&quot;serviceAccount:YOUR_SERVICE_ACCOUNT_NAME_AS_IN_STEP_3&quot; \\<br>  --role=&quot;roles/compute.instanceUser&quot;<br><br>10. gcloud iam service-accounts keys create  bitbucket-iap.json \\<br>  --iam-account=YOUR_SERVICE_ACCOUNT_NAME_AS_IN_STEP_3<br>// do - cat bitbucket-iap.json, you will need this while setting up pipeline<br><br>11.gcloud projects add-iam-policy-binding YOUR_GCP_PROJECT_ID \\<br>  --member=&quot;serviceAccount:YOUR_SERVICE_ACCOUNT_NAME_AS_IN_STEP_3&quot; \\<br>  --role=&quot;roles/compute.instanceAdmin.v1&quot;<br><br>12. gcloud compute instances describe YOUR_VM_NAME \\<br>  --zone YOUR_ZONE \\<br>  --format=&quot;get(serviceAccounts.email)&quot;<br><br>//// ABOVE STEP GIVES THE SERVICE ACCOUNT NAME<br><br>13. gcloud iam service-accounts add-iam-policy-binding <br>ID_FROM_LAST_STEP@developer.gserviceaccount.com \\<br>  --member=&quot;serviceAccount:YOUR_SERVICE_ACCOUNT_NAME_AS_IN_STEP_3&quot; \\<br>  --role=&quot;roles/iam.serviceAccountUser&quot;<br><br></pre><h3>Step 2: Verify your configuration is working</h3><pre><br>1. gcloud auth list<br>/// YOU WILL SEE YOURS ACCOUNTS HERE WITH ADMIN SELECTED<br><br>2. gcloud config set account &lt;NEW ACCOUNT THAT YOU CREATED&gt;<br><br>3. gcloud compute ssh YOUR_VM_NAME \\<br>  --zone YOUR_ZONE \\<br>  --tunnel-through-iap\<br><br>/// IF YOUR SSH WORKED, THEN EVERYTHING IS WORKING <br><br>// IF IT DID NOT WORKED CHECK - <br>gcloud compute instances describe GCP_INSTANCE \\<br>  --zone YOUR_ZONE \\<br>  --format=&#39;value(metadata.enable-oslogin)&#39;<br>//SHOULD BE TRUE<br><br><br>//YOU WILL SEE IF ANY PERMISSION IS MISSING<br>gcloud compute ssh YOUR_VM_NAME --project=YOUR_GCP_PROJECT_ID<br>--zone=YOUR_ZONE --troubleshoot --tunnel-through-iap<br><br>//YOU NEED TO SEE WHAT ERROR IT GIVES, CHANGE ACCOUNT TO ADMIN AGAIN <br>LIKE STEP 2, GIVE PERMISSION AND TRY AGAIN<br></pre><h3>Step 3: Writing the pipeline</h3><p>Create the pipeline configuration file in your repository root. I am using bitbucket so I created <strong>bitbucket-pipelines.yml</strong> file in my repository’s root directory.</p><p>I am writing it to deploy a next js website. You can replace the node version to be same as of your gcp compute machine.</p><blockquote>Define $GCP_SA_KEY is your bitbucket repository variables. Go to your repository -&gt; Repository settings -&gt; Repository variables</blockquote><p>When you created service account above, you get a file with name cat bitbucket-iap.json. Copy the contents of this.</p><pre>cat bitbucket-iap.json</pre><p>Define $GCP_SA_KEY = contents of bitbucket-iap.json, mark this variable secured.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xo7LGjcly7GQbFC51N4V6g.png" /></figure><p>You can directly replace variables like YOUR_GCP_PROJECT_ID, YOUR_VM_NAME, YOUR_ZONE, PATH_TO_PROJECT_ENV in below code, or define it in repository variables as best practice.</p><pre>image: node:20.19.6<br><br>pipelines:<br>  custom:<br>    nextjswebsite:<br>      - step:<br>          name: Build My Next App<br>          caches:<br>            - node<br>          script:<br>            - apt-get update &amp;&amp; apt-get install -y curl tar <br>              python3 openssh-client<br>            - curl -sSL https://sdk.cloud.google.com | bash<br>            - source /root/google-cloud-sdk/path.bash.inc<br>            - echo &quot;$GCP_SA_KEY&quot; &gt; /tmp/gcp-key.json<br>            - gcloud auth activate-service-account <br>              --key-file=/tmp/gcp-key.json<br>            - gcloud config set project &lt;YOUR_GCP_PROJECT_ID&gt;<br>            - gcloud compute scp &lt;YOUR_VM_NAME&gt;:&lt;PATH_TO_PROJECT_ENV&gt; <br>              .env.production --zone &lt;YOUR_ZONE&gt;--tunnel-through-iap<br>            <br>      <br>            - test -f .env.production || (echo &quot;Env file missing&quot; &amp;&amp; exit 1)<br>            - echo &quot;Installing dependencies&quot;<br><br>            - npm ci<br>            - echo &quot;Running build&quot;<br>            - npm run build<br>            - test -d .next || { echo &quot;ERROR folder not found after<br>                build&quot;; exit 1; }<br>            - tar -czf next_artifact.tgz .next<br><br>          artifacts:<br>            - next_artifact.tgz<br>          <br>      - step:<br>          name: Upload .next to GCP VM<br>          caches:<br>            - node<br>          script:<br>            - apt-get update &amp;&amp; apt-get install -y curl <br>              tar python3 openssh-client<br>            - curl -sSL https://sdk.cloud.google.com | bash<br>            - source /root/google-cloud-sdk/path.bash.inc<br>            - echo &quot;$GCP_SA_KEY&quot; &gt; /tmp/gcp-key.json<br>            - gcloud auth activate-service-account --key-file=/tmp/gcp-key.json<br>            - gcloud config set project &lt;YOUR_GCP_PROJECT_ID&gt;<br>            - gcloud compute scp next_artifact.tgz <br>              &lt;YOUR_VM_NAME&gt;:/tmp/next_artifact.tgz <br>               --zone &lt;YOUR_ZONE&gt; --tunnel-through-iap<br>            - gcloud compute ssh &lt;YOUR_VM_NAME&gt; --zone &lt;YOUR_ZONE&gt; <br>              --tunnel-through-iap <br>              --command=&quot;sudo -n bash -lc <br>               &#39;cd deployments &amp;&amp; bash deploy_nextjswebsite.sh&#39;&quot;</pre><h3>Step 4: Run the pipeline</h3><ul><li>Go to <strong>Pipelines</strong> tab in Bitbucket</li><li>Click on run pipeline</li><li>Choose your branch where you created <strong>bitbucket-pipelines.yml </strong>and choose name of pipeline, which is <strong><em>nextjswebsite</em></strong> above and pipeline should run successfully.</li></ul><h3><strong>Questions or issues?</strong> Feel free to reach out in the comments below! 👇</h3><p>Happy deploying! 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b25d81dad6d8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Complete Guide to Add Daphne to Your Django Server]]></title>
            <link>https://medium.com/@pawanjotkaurbaweja/complete-guide-to-add-daphne-to-your-django-server-aa5124aab5c5?source=rss-365134aea544------2</link>
            <guid isPermaLink="false">https://medium.com/p/aa5124aab5c5</guid>
            <category><![CDATA[ubuntu-server]]></category>
            <category><![CDATA[django-rest-framework]]></category>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[daphne]]></category>
            <category><![CDATA[websocket]]></category>
            <dc:creator><![CDATA[PAWANJOT KAUR BAWEJA]]></dc:creator>
            <pubDate>Fri, 07 Feb 2025 12:15:18 GMT</pubDate>
            <atom:updated>2025-02-07T12:18:54.930Z</atom:updated>
            <content:encoded><![CDATA[<h3>Why Use Daphne?</h3><p>We recently added a chat feature to our project using Daphne. It’s the recommended ASGI server for Django for the following reasons:</p><ul><li>It allows <strong>WebSockets</strong>, <strong>HTTP/2</strong>, and <strong>asynchronous views</strong>.</li><li>It integrates seamlessly with Django’s <strong>ASGI capabilities</strong>.</li><li>It works well with Django Channels for real-time functionality.</li></ul><p>I was using Ubuntu, but you can find the corresponding commands for your operating system.</p><p>To setup Django project without Daphne, check this story — <a href="https://medium.com/p/8bd2a5032f68">https://medium.com/p/8bd2a5032f68</a></p><h3>Install Daphne</h3><pre>sudo apt install daphne</pre><p>Install redis — (you may need this to support your configuration)</p><pre>sudo yum install redis<br>sudo apt-get install lsb-release curl gpg<br>curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg<br>sudo chmod 644 /usr/share/keyrings/redis-archive-keyring.gpg<br>echo &quot;deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main&quot; | sudo tee /etc/apt/sources.list.d/redis.list<br>sudo apt-get update<br>sudo apt-get install redis<br>sudo systemctl enable redis-server<br>sudo systemctl start redis-server</pre><p>Activate your virtual environment and install following packages-</p><pre>pip install channels<br>pip install daphne<br>pip install asgi_redis<br>pip install channels-redis</pre><p>Create consumers.py inside your main app (where your settings.py or wsgi.py is location)- (I used asynchronous version of this)</p><pre>&#39;&#39;&#39;<br><br>synchronous version<br>&#39;&#39;&#39;<br><br>import json<br><br>from asgiref.sync import async_to_sync<br>from channels.generic.websocket import WebsocketConsumer<br><br><br>class ChatConsumer(WebsocketConsumer):<br>    def connect(self):<br>        self.room_name = self.scope[&#39;url_route&#39;][&#39;kwargs&#39;][&#39;room_name&#39;]<br>        self.room_group_name = &#39;chat_%s&#39; % self.room_name<br>        # Join room group<br>        async_to_sync(self.channel_layer.group_add)(<br>            self.room_group_name,<br>            self.channel_name<br>        )<br><br>        self.accept()<br><br>    def disconnect(self, close_code):<br>        # Leave room group<br>        async_to_sync(self.channel_layer.group_discard)(<br>            self.room_group_name,<br>            self.channel_name<br>        )<br><br>    # Receive message from WebSocket<br>    def receive(self, text_data):<br>        text_data_json = json.loads(text_data)<br>        message = text_data_json[&#39;message&#39;]<br>        # Send message to room group<br>        async_to_sync(self.channel_layer.group_send)(<br>            self.room_group_name,<br>            {<br>                &#39;type&#39;: &#39;chat_message&#39;,<br>                &#39;message&#39;: message<br>            }<br>        )<br><br>    # Receive message from room group<br>    def chat_message(self, event):<br>        message = event[&#39;message&#39;]<br>        # Send message to WebSocket<br>        self.send(text_data=json.dumps({<br>            &#39;message&#39;: message<br>        }))<br><br><br>&#39;&#39;&#39;<br><br>asynchronous version<br>&#39;&#39;&#39;<br><br># import json<br># from channels.generic.websocket import AsyncWebsocketConsumer<br>#<br>#<br># class ChatConsumer(AsyncWebsocketConsumer):<br>#     async def connect(self):<br>#         self.room_name = self.scope[&#39;url_route&#39;][&#39;kwargs&#39;][&#39;room_name&#39;]<br>#         self.room_group_name = &#39;chat_%s&#39; % self.room_name<br>#<br>#         # Join room group<br>#         await self.channel_layer.group_add(<br>#             self.room_group_name,<br>#             self.channel_name<br>#         )<br>#<br>#         await self.accept()<br>#<br>#     async def disconnect(self, close_code):<br>#         # Leave room group<br>#         await self.channel_layer.group_discard(<br>#             self.room_group_name,<br>#             self.channel_name<br>#         )<br>#<br>#     # Receive message from WebSocket<br>#     async def receive(self, text_data):<br>#         text_data_json = json.loads(text_data)<br>#         message = text_data_json[&#39;message&#39;]<br>#<br>#         # Send message to room group<br>#         await self.channel_layer.group_send(<br>#             self.room_group_name,<br>#             {<br>#                 &#39;type&#39;: &#39;chat_message&#39;,<br>#                 &#39;message&#39;: message<br>#             }<br>#         )<br>#<br>#     # Receive message from room group<br>#     async def chat_message(self, event):<br>#         message = event[&#39;message&#39;]<br>#<br>#         # Send message to WebSocket<br>#         await self.send(text_data=json.dumps({<br>#             &#39;message&#39;: message<br>#         }))<br>#<br></pre><p>Create routing.py inside your main app (where your settings.py or wsgi.py is location)-</p><pre>from django.urls import re_path<br>from &lt;app name&gt; import consumers<br><br>websocket_urlpatterns = [<br>    re_path(r&#39;ws/chat/(?P&lt;room_name&gt;\w+)/$&#39;, consumers.ChatConsumer.as_asgi()),<br>    re_path(r&quot;ws/global_notifications/$&quot;, consumers.ChatConsumer.as_asgi()),<br>]</pre><p>Create asgi.py inside your main app (where your settings.py or wsgi.py is location)-</p><pre><br>import os<br><br>from django.core.asgi import get_asgi_application<br><br>from channels.routing import ProtocolTypeRouter, URLRouter<br>from channels.auth import AuthMiddlewareStack<br>from &lt;app name&gt;.routing import websocket_urlpatterns<br>from channels.layers import get_channel_layer<br><br>os.environ.setdefault(&#39;DJANGO_SETTINGS_MODULE&#39;, &#39;&lt;app name&gt;.settings&#39;)<br><br>#application = get_asgi_application()<br>application = ProtocolTypeRouter({<br>    &quot;http&quot;: get_asgi_application(),<br>    &quot;websocket&quot;: AuthMiddlewareStack(<br>        URLRouter(<br>            websocket_urlpatterns<br>        )<br>    ),<br>})<br><br><br>async def global_connect(consumer, event):<br>    channel_layer = get_channel_layer()<br>    await channel_layer.group_add(<br>        &quot;global_notifications&quot;,<br>        consumer.channel_name<br>    )</pre><p>Replace &lt;app name&gt; with your app folder inside the project folder</p><p>Create daphne.socket using -</p><p>sudo nano /etc/systemd/system/daphne.socket</p><pre>[Unit]<br>Description=daphne socket<br><br>[Socket]<br>ListenStream=/run/daphne.sock<br><br>[Install]<br>WantedBy=sockets.target</pre><p>Create daphne.service using -</p><p>sudo nano /etc/systemd/system/daphne.service</p><pre>[Unit]<br>Description=daphne daemon<br>Requires=daphne.socket<br>After=network.target<br><br>[Service]<br>Type=simple<br>User=root<br><br>WorkingDirectory=&lt;path of your backend project&gt;<br>ExecStart=/home/ubuntu/&lt;path to env&gt;/bin/daphne -b 0.0.0.0 -p 8000 &lt;app name&gt;.asgi:application<br><br>[Install]<br>WantedBy=multi-user.target</pre><p>Before starting, run this command -</p><pre>daphne -p 8000 &lt;main-app-name&gt;.asgi:application</pre><p>If you do not see any errors, then run following commands -</p><pre>sudo systemctl start daphne.socket<br>sudo systemctl enable daphne.socket</pre><p>To check status —</p><p>sudo journalctl -u daphne.socket</p><p>sudo systemctl status daphne.socket</p><h3><strong>uwsgi configuration -</strong></h3><p>Create wsgi file -</p><p>sudo nano &lt;main-app-name&gt;/wsgi.py</p><pre>import os<br>import sys<br>sys.path.append(&#39;/home/ubuntu/&lt;project-folder&gt;&#39;)<br><br><br>from django.core.wsgi import get_wsgi_application<br><br>        <br>os.environ.setdefault(&#39;DJANGO_SETTINGS_MODULE&#39;, &#39;&lt;main-app-name&gt;.settings&#39;)<br><br>application = get_wsgi_application()</pre><p>sudo nano /etc/uwsgi/sites/&lt;project name&gt;.ini</p><pre>[uwsgi]<br>project = django-project<br>projectdir = django-project<br>uid = ubuntu<br>base = /home/%(uid)<br><br>chdir = %(base)/%(projectdir)<br>home = %(base)/&lt;project-env&gt;<br>module = &lt;main-app-name&gt;.wsgi:application<br><br>master = true<br>processes = 5<br><br># Finish off the configuration with the following lines<br>socket = /run/uwsgi/%(project).sock<br>logto = /var/log/uwsgi/%(project).log<br>chown-socket = %(uid):www-data<br>chmod-socket = 660<br>vacuum = true</pre><p>Nginx configuration -</p><p>sudo nano /etc/nginx/sites-available/&lt;site-name&gt;</p><pre>upstream asgi_server {<br>    server localhost:8000;  # Replace with the ASGI server&#39;s IP and port<br>}<br><br>upstream djangoproject {<br>    server unix:///run/uwsgi/&lt;socket_name&gt;.sock;<br>}<br><br><br>server {<br>    <br><br>    listen 80;<br>    server_name &lt;domain name&gt;;<br>    location = /favicon.ico { access_log off; log_not_found off; }<br>    location /static/ {<br>        root /home/ubuntu/&lt;project-dir&gt;/;<br>    }<br>    location /ws/ {<br>        proxy_pass http://asgi_server;<br>        proxy_http_version 1.1;<br>        proxy_set_header Upgrade $http_upgrade;<br>        proxy_set_header Connection &quot;upgrade&quot;;<br>        proxy_set_header Host $host;<br>        proxy_redirect off;<br>    }<br><br>    location / {<br>        uwsgi_pass  djangoproject;<br>        &lt;other configurations&gt;<br>    }<br>}</pre><p>Run following command to activate this domain —</p><p>sudo ln -s /etc/nginx/sites-available/&lt;site-name&gt; /etc/nginx/sites-enabled/&lt;site-name&gt;</p><p>Restart project -</p><pre>sudo service uwsgi restart<br>sudo service nginx restart</pre><p>You can check project logs using following command -</p><pre>tail -f /var/log/uwsgi/&lt;project-name&gt;.log </pre><h3>Final Thoughts</h3><p>By following these steps, you’ve successfully configured <strong>Daphne</strong> into your Django server, enabling it to handle <strong>asynchronous requests</strong> and <strong>WebSockets</strong>. Whether you’re building <strong>real-time apps</strong>, <strong>chat systems</strong>, or <strong>live notifications</strong>, Daphne ensures your Django project is <strong>future-proof</strong> and <strong>scalable</strong>. 🚀</p><p>Let me know if you have any questions! Happy coding! 🎉</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aa5124aab5c5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Use Bitbucket Pipelines to automate your project updates on Google Compute Engine (GCE) on GCP.]]></title>
            <link>https://medium.com/@pawanjotkaurbaweja/use-bitbucket-pipelines-to-automate-your-project-updates-on-google-compute-engine-gce-on-gcp-56375b8933ec?source=rss-365134aea544------2</link>
            <guid isPermaLink="false">https://medium.com/p/56375b8933ec</guid>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[bitbucket-pipelines]]></category>
            <category><![CDATA[gcp]]></category>
            <category><![CDATA[google-compute-engine]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <dc:creator><![CDATA[PAWANJOT KAUR BAWEJA]]></dc:creator>
            <pubDate>Thu, 27 Jun 2024 14:46:59 GMT</pubDate>
            <atom:updated>2024-06-27T14:46:59.718Z</atom:updated>
            <content:encoded><![CDATA[<p>I will list the steps to deploy your Next.js project or any other project, whether it be React, Node.js, or Django.</p><ol><li>Create an SSH key pair on any machine using the following command.</li></ol><pre>ssh-keygen -t rsa -C &quot;&lt;gcp_username&gt;&quot;</pre><ul><li>This will generate two files; one ending with .pub is your public key file, and the other is your private key file.</li></ul><p>2. Go to your Google Compute Engine machine:</p><ul><li>Click on Edit.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U_dFxKEo6etiRt4Ss6YolA.png" /></figure><ul><li>Add the SSH public key.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qqWEhgX9w2rlUARpWXJRfQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d7e3pbHlRFYeGRofNzp6hg.png" /></figure><ul><li>Click Save.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vS7hzz2_ISwJWrWiIS0SBQ.png" /></figure><p>4. <strong>SSH into the machine:</strong></p><ul><li>Create a file named pipeline_script.sh in your gcp user directly which you used above.</li><li>Copy and paste the following code: echo &#39;Hello, Bash!&#39;</li></ul><pre>echo &#39;Hello, Bash!&#39;</pre><p>5. <strong>Go to Bitbucket.org:</strong></p><ul><li>Log in and choose a repository.</li><li>Go to repository settings.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/1*hx5tlv1m10ulzlt4Y3FJKw.png" /></figure><ul><li>Scroll down and click on SSH Keys.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/510/1*RWxlIwvRWwNU1ykO6gGZuw.png" /></figure><ul><li>Add the host address and click Fetch.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MV2DSLCh8cFD-br8ocfLIw.png" /></figure><ul><li>Click on Use my own keys.</li><li>Add the private and public keys.</li><li>Click Save Key pair.</li></ul><p><strong>6. In your Bitbucket repository:</strong></p><ul><li>Go to Source and choose your branch.</li><li>Click on the three dots.</li><li>Click Add file.</li><li>Name the file bitbucket-pipelines.yml.</li><li>Copy and paste the following content.</li></ul><pre>pipelines:<br>  branches:<br>     nam:<br>       - step:<br>           name: Deploy to production<br>           deployment: production<br>           script:<br>             - echo &quot;Deploying to production environment1&quot;<br>             - pipe: atlassian/ssh-run:0.2.2<br>               variables:<br>                 SSH_USER: &#39;&lt;gcp_username&gt;&#39;<br>                 SERVER: &#39;&lt;gcp_ip_address&gt;&#39;<br>                 COMMAND: &#39;bash pipeline_script.sh&#39;</pre><p>Click on Commit button.</p><p>7. Go to Pipelines in your Bitbucket repository, check status of your Pipeline.</p><p>Feel free to comment if you encounter any problems. Following these steps will also resolve errors like “Permission denied (publickey)” and “No default SSH key configured in Pipelines.”</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=56375b8933ec" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cross domain cookies — Solved!]]></title>
            <link>https://medium.com/@pawanjotkaurbaweja/cross-domain-cookies-solved-e5552e9de6ca?source=rss-365134aea544------2</link>
            <guid isPermaLink="false">https://medium.com/p/e5552e9de6ca</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[cross-domain-tracking]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[cookies]]></category>
            <category><![CDATA[cross-domain]]></category>
            <dc:creator><![CDATA[PAWANJOT KAUR BAWEJA]]></dc:creator>
            <pubDate>Fri, 24 May 2024 14:47:06 GMT</pubDate>
            <atom:updated>2024-05-24T14:48:45.722Z</atom:updated>
            <content:encoded><![CDATA[<h3>Cross domain cookies — Solved!</h3><p>As part of a project where we were using custom analytics, one of the requirements was to get the <strong>same cookie</strong> across all domains when we deployed the application <strong>on more than two domains.</strong></p><p>For example, if we set a cookie on <strong>domainA.com</strong>, we needed the same cookie on <strong>domainB.com</strong>.</p><p>Create a common javascript file <strong>cookieSetter.js </strong>with following code on <strong>domainA.com</strong></p><pre><br>function setCookie(cname, cvalue, exdays) {<br>  const d = new Date();<br>  d.setTime(d.getTime() + (exdays*24*60*60*1000));<br>  let expires = &quot;expires=&quot;+ &quot;2025-05-24T15:04:29.000Z&quot;;<br>  var now = new Date();<br>  var time = now.getTime();<br>  var expireTime = time + 1000*36000;<br>  now.setTime(expireTime);<br>  document.cookie = cname + &quot;=&quot; + cvalue + &quot;;expires=&quot;+now.toUTCString()+&quot;;path=/;SameSite=None;Secure=False&quot;;<br>}<br><br>function getCookie(cname) {<br>  let name = cname + &quot;=&quot;;<br>  let decodedCookie = decodeURIComponent(document.cookie);<br>  let ca = decodedCookie.split(&#39;;&#39;);<br>  for(let i = 0; i &lt;ca.length; i++) {<br>    let c = ca[i];<br>    while (c.charAt(0) == &#39; &#39;) {<br>      c = c.substring(1);<br>    }<br>    if (c.indexOf(name) == 0) {<br>      return c.substring(name.length, c.length);<br>    }<br>  }<br>  return &quot;&quot;;<br>}<br><br>if(getCookie(&quot;test1&quot;))<br>{<br>  console.log(&quot;your test cookie is-&quot;,getCookie(&quot;test1&quot;))<br>}<br>else<br>{<br>  setCookie(&quot;test1&quot;,Math.random() * 20 + Math.random()*65)<br>  console.log(&quot;your test cookie is-&quot;,getCookie(&quot;test1&quot;))<br>}<br><br><br><br><br>&lt;/script&gt;</pre><p>getstorage.html on <strong>domainA.com</strong>, include cookieSetter.js from its path.</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;head&gt;<br>        &lt;title&gt;Listner of domainA.com&lt;/title&gt;<br>&lt;------- include cookieSetter.js ----------&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br><br>&lt;script type=&quot;text/javascript&quot;&gt;<br>  <br>  if(getCookie(&quot;testCookie&quot;))<br>  {<br>    window.top.postMessage(getCookie(&quot;testCookie&quot;), &#39;*&#39;)<br>  } <br>&lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;<br></pre><p>Include following in index.html on <strong>domainB.com</strong></p><pre>&lt;iframe style=&quot;display:none;&quot; src=&quot;https://domainA.com/getstorage.html&quot; id=&quot;ifr&quot;  &gt;&lt;/iframe&gt;<br><br>&lt;script type=&quot;text/javascript&quot;&gt;<br>window.onmessage = function(e) { // inside the iframe<br>        console.log(e.data);<br>};<br><br>&lt;/script&gt;</pre><p>How it works?</p><ol><li>When you open <strong>domainA.com, </strong>it creates a cookie on <strong>domainA.com</strong></li><li>You can check this cookie on Inspect -&gt; Application</li><li>When you open <strong>domainB.com, </strong>it loads an iframe from <strong>domainA.com, </strong>iframe get the cookie which is same as point 1, and sends it using <strong>postMessage.</strong></li><li>This way you can have the same cookie on <strong>domainA.com and domainB.com</strong></li></ol><p>Do not test this in incognito mode!!</p><p>Feel free to ask questions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e5552e9de6ca" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Solved!!!!!!!! — TypeError: fetch failed]]></title>
            <link>https://medium.com/@pawanjotkaurbaweja/solved-typeerror-fetch-failed-4f7d304c0c68?source=rss-365134aea544------2</link>
            <guid isPermaLink="false">https://medium.com/p/4f7d304c0c68</guid>
            <category><![CDATA[memory-management]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[error]]></category>
            <category><![CDATA[server-side-rendering]]></category>
            <dc:creator><![CDATA[PAWANJOT KAUR BAWEJA]]></dc:creator>
            <pubDate>Tue, 26 Mar 2024 10:03:45 GMT</pubDate>
            <atom:updated>2024-03-26T10:03:45.200Z</atom:updated>
            <content:encoded><![CDATA[<h3>Solved!!!!!!!! — TypeError: fetch failed</h3><p>at node:internal/deps/undici/undici:12345:11</p><p>After one of our releases on the Next.js website, we ran into the following error —</p><pre>TypeError: fetch failed<br>    at node:internal/deps/undici/undici:12345:11<br>    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)<br>    at async invokeRequest (/node_modules/next/dist/server/lib/server-ipc/invoke-request.js:17:12)<br>    at async invokeRender (/node_modules/next/dist/server/lib/router-server.js:254:29)<br>    at async handleRequest (/node_modules/next/dist/server/lib/router-server.js:447:24)<br>    at async requestHandler (/node_modules/next/dist/server/lib/router-server.js:464:13)<br>    at async Server.&lt;anonymous&gt; (/node_modules/next/dist/server/lib/start-server.js:117:13) {<br>  cause: Error: connect ECONNREFUSED ::1:46367<br>      at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1595:16) {<br>    errno: -111,<br>    code: &#39;ECONNREFUSED&#39;,<br>    syscall: &#39;connect&#39;,<br>    address: &#39;::1&#39;,<br>    port: 46367<br>  }<br>}</pre><p>I’ll cut to the chase and share what worked for us:</p><h3><strong>Downgrading Next js version from 13.4.19 to 13.4.7. </strong>🎉</h3><p>Here are the steps —</p><ol><li>Stop pm2 — pm2 stop &lt;id&gt;</li><li>Change “next”: “13.4.19” to “next”: “13.4.17” in package.json.</li><li>sudo rm -rf node_modules/</li><li>sudo npm cache clean — force</li><li>sudo rm package-lock.json</li><li>sudo rm -rf .next/</li><li>sudo npm install</li><li>sudo npm run build</li><li>pm2 start npm</li></ol><p>What didn’t work for us -</p><p>🚫 Trying with 127.0.0.1 instead of localhost</p><p>🚫 Changing /etc/hosts</p><p>🚫 Changing node version</p><p>Feel free to ask any questions regarding this, and I’ll be happy to provide answers!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4f7d304c0c68" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Debug error — no python application found, check your startup logs for errors]]></title>
            <link>https://medium.com/@pawanjotkaurbaweja/debug-error-no-python-application-found-check-your-startup-logs-for-errors-d758f6ea981a?source=rss-365134aea544------2</link>
            <guid isPermaLink="false">https://medium.com/p/d758f6ea981a</guid>
            <category><![CDATA[uwsgi]]></category>
            <category><![CDATA[django]]></category>
            <category><![CDATA[nginx]]></category>
            <category><![CDATA[deployment]]></category>
            <category><![CDATA[error-message]]></category>
            <dc:creator><![CDATA[PAWANJOT KAUR BAWEJA]]></dc:creator>
            <pubDate>Fri, 15 Dec 2023 11:03:39 GMT</pubDate>
            <atom:updated>2023-12-15T11:03:39.279Z</atom:updated>
            <content:encoded><![CDATA[<h3>Debug error — no python application found, check your startup logs for errors</h3><p>[pid: 3286273|app: -1|req: -1/1] () {62 vars in 1604 bytes} [Fri Dec 15 10:22:53 2023] GET / =&gt; generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (1 switches on core 0)<br>announcing my loyalty to the Emperor…<br> — — no python application found, check your startup logs for errors — -<br>[pid: 3286272|app: -1|req: -1/2] () {62 vars in 1604 bytes} [Fri Dec 15 10:22:54 2023] GET / =&gt; generated 21 bytes in 0 msecs (HTTP/1.1 500) 2 headers in 83 bytes (1 switches on core 0)<br>announcing my loyalty to the Emperor…</p><ol><li>Run following command —</li></ol><p><strong>uwsgi — http :8080 — home /home/sammy/Env/firstsite — chdir /home/sammy/firstsite -w firstsite.wsgi</strong></p><p>Replace env path similar to your path in uwsgi configuration (.ini) file located at /etc/uwsgi/sites/</p><p>And project location — /home/sammy/firstsite with your actual project location</p><p>And module — firstsite.wsgi as same mentioned in “module =” in file located at /etc/uwsgi/sites/</p><p>When you run this command, you will see the logs in which you may find the detailed error.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d758f6ea981a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setup celery service on Django (ubuntu/debian) server]]></title>
            <link>https://medium.com/@pawanjotkaurbaweja/setup-celery-service-on-django-ubuntu-debian-server-329a805f78fc?source=rss-365134aea544------2</link>
            <guid isPermaLink="false">https://medium.com/p/329a805f78fc</guid>
            <category><![CDATA[django-framework]]></category>
            <category><![CDATA[celery]]></category>
            <category><![CDATA[django]]></category>
            <category><![CDATA[celerybeat]]></category>
            <category><![CDATA[celery-django]]></category>
            <dc:creator><![CDATA[PAWANJOT KAUR BAWEJA]]></dc:creator>
            <pubDate>Fri, 15 Dec 2023 10:52:39 GMT</pubDate>
            <atom:updated>2024-07-26T09:28:56.065Z</atom:updated>
            <content:encoded><![CDATA[<ol><li>Create a celery configuration file</li></ol><p>sudo nano /etc/default/celeryd</p><p>Replace CELERY_BIN — with your env path</p><p>CELERYD_USER — your user</p><p>CELERYD_GROUP — your user group</p><pre>CELERYD_NODES=&quot;ayuvya_worker&quot;<br>CELERY_BIN=&quot;/home/ubuntu/venv/bin/celery&quot;<br>CELERY_APP=&quot;ayuvya&quot;<br>CELERYD_MULTI=&quot;multi&quot;<br>CELERYD_OPTS=&quot; --time-limit=600 --concurrency=2&quot;<br>CELERYD_LOG_LEVEL=&quot;DEBUG&quot;<br>CELERYD_LOG_FILE=&quot;/var/log/celery/%n%I.log&quot;<br>CELERYD_PID_FILE=&quot;/var/run/celery/%n.pid&quot;<br>CELERYBEAT_PID_FILE=&quot;/var/run/celery/beat.pid&quot;<br>CELERYBEAT_LOG_FILE=&quot;/var/log/celery/beat.log&quot;<br>CELERYD_USER=&quot;ubuntu&quot;<br>CELERYD_GROUP=&quot;ubuntu&quot;<br>CELERY_CREATE_DIRS=1</pre><p>2. Create a celery service file —</p><p>sudo nano /etc/systemd/system/celery.service</p><p>Replace</p><p>User — with your user</p><p>Group — with your group</p><p>WorkingDirectory — directory of your project</p><pre>[Unit]<br>Description=Celery Service<br>After=network.target<br>[Service]<br>Type=forking<br>User=ubuntu<br>Group=ubuntu<br>EnvironmentFile=/etc/default/celeryd<br>WorkingDirectory=/home/ubuntu/&lt;Project Name&gt;<br>ExecStart=/bin/sh -c &#39;${CELERY_BIN} -A $CELERY_APP multi start $CELERYD_NODES \<br>--pidfile=${CELERYD_PID_FILE} --logfile=${CELERYD_LOG_FILE} \<br>--loglevel=&quot;${CELERYD_LOG_LEVEL}&quot; $CELERYD_OPTS&#39;<br>ExecStop=/bin/sh -c &#39;${CELERY_BIN} multi stopwait $CELERYD_NODES \<br>--pidfile=${CELERYD_PID_FILE} --loglevel=&quot;${CELERYD_LOG_LEVEL}&quot;&#39;<br>ExecReload=/bin/sh -c &#39;${CELERY_BIN} -A $CELERY_APP multi restart $CELERYD_NODES \<br>--pidfile=${CELERYD_PID_FILE} --logfile=${CELERYD_LOG_FILE} \<br>--loglevel=&quot;${CELERYD_LOG_LEVEL}&quot; $CELERYD_OPTS&#39;<br>Restart=always<br>[Install]<br>WantedBy=multi-user.target</pre><p>3. Create a celery beat service file</p><p>sudo nano /etc/systemd/system/celerybeat.service</p><p>Replace</p><p>User — with your user</p><p>Group — with your group</p><p>WorkingDirectory — directory of your project</p><pre>[Unit]<br>Description=Celery beat service<br>After=network.target celery.service<br>[Service]<br>Type=simple<br>User=ubuntu<br>Group=ubuntu<br>EnvironmentFile=/etc/default/celeryd<br>WorkingDirectory=/home/ubuntu/&lt;Project Name&gt;<br>ExecStart=/bin/sh -c &#39;${CELERY_BIN} -A ${CELERY_APP} beat  \<br>--pidfile=${CELERYBEAT_PID_FILE} \<br>--logfile=${CELERYBEAT_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL}&#39;<br>ExecStop=/bin/systemctl kill celerybeat.service<br>RemainAfterExit=yes<br>[Install]<br>WantedBy=multi-user.target</pre><p>4. Run the following commands</p><pre>sudo systemctl daemon-reloadsudo systemctl enable celery.service<br>sudo systemctl enable celerybeat.service<br>sudo mkdir /var/log/celery<br>sudo chown -R ubuntu:ubuntu /var/log/celery<br>sudo mkdir /var/run/celery<br>sudo chown -R ubuntu:ubuntu /var/run/celery</pre><p>to check status -</p><pre>sudo systemctl status celery.service<br>sudo systemctl status celerybeat.service</pre><p><strong>If something is not working then comment “Restart=always” in celery service file and reload the daemon, restart, check status for the exact error.</strong></p><p>to restart-</p><pre>sudo systemctl restart celerybeat.service<br>sudo systemctl restart celery.service</pre><p>5. To check logs -</p><pre>tail -f /var/log/celery/worker_name-1.log <br>tail -f /var/log/celery/worker_name.log</pre><p>Feel free to post comments/questions in case you feel anything is missed.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=329a805f78fc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Send uwsgi nginx logs from Django project to cloudwatch]]></title>
            <link>https://medium.com/@pawanjotkaurbaweja/send-uwsgi-nginx-logs-from-django-project-to-cloudwatch-8bfb518c8477?source=rss-365134aea544------2</link>
            <guid isPermaLink="false">https://medium.com/p/8bfb518c8477</guid>
            <dc:creator><![CDATA[PAWANJOT KAUR BAWEJA]]></dc:creator>
            <pubDate>Wed, 15 Mar 2023 19:20:59 GMT</pubDate>
            <atom:updated>2023-03-15T19:20:59.427Z</atom:updated>
            <content:encoded><![CDATA[<p>There might be cases when you want to send your logs from your Django project to AWS cloud watch.</p><p>We are assuming that your server is deployed using nginx and uwsgi mode.</p><ol><li>Login to AWS console.</li><li>Go to <a href="https://us-east-1.console.aws.amazon.com/iam/home#/home"><strong>Identity and Access Management (IAM)</strong></a> (<a href="https://us-east-1.console.aws.amazon.com/iamv2/home?region=us-east-1#/home">https://us-east-1.console.aws.amazon.com/iamv2/home?region=us-east-1#/home</a>). You can choose the region as per your preference.</li><li>Choose Users from the left menu bar.</li><li>Click on Add User as shown in following screenshot</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NDOod6V9WkaVzqVW957UbQ.png" /></figure><p>5. Add User name — cloudwatch, click Next.</p><p>6. Choose — <strong>Attach policies directly</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UeExoJ3gKKNX0p1Ep37w8g.png" /></figure><p>Choose permissions-</p><p><a href="https://us-east-1.console.aws.amazon.com/iam/home#/policies/arn%3Aaws%3Aiam%3A%3Aaws%3Apolicy%2Fservice-role%2FAmazonAPIGatewayPushToCloudWatchLogs">AmazonAPIGatewayPushToCloudWatchLogs</a></p><p><a href="https://us-east-1.console.aws.amazon.com/iam/home#/policies/arn%3Aaws%3Aiam%3A%3Aaws%3Apolicy%2FAmazonS3FullAccess">AmazonS3FullAccess</a></p><p><a href="https://us-east-1.console.aws.amazon.com/iam/home#/policies/arn%3Aaws%3Aiam%3A%3Aaws%3Apolicy%2FAmazonSSMFullAccess">AmazonSSMFullAccess</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1-y1HHvGI4TSZpN0Y7GoRg.png" /></figure><p>Click NEXT</p><p>Click Create User.</p><p>7. On Users page, click on your user which you have recently created.</p><p>Go to Security Credentials. Scroll to create an ACCESS key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JfIafAAAzC15qAKMP2zKSw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-AwzKs5QVnZQSOFx0sGKlQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9Va1EBjnWoz-_th3HDuUVQ.png" /></figure><p>8. SSH into your Linux instance and run following commands -</p><p><strong>Install AWS CLI</strong></p><blockquote>curl “<a href="https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip">https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip</a>&quot; -o “awscliv2.zip”</blockquote><blockquote>unzip awscliv2.zip</blockquote><blockquote>sudo ./aws/install</blockquote><blockquote>/usr/local/bin/aws — version</blockquote><p><strong>Install AWS Cloudwatch agent</strong></p><blockquote>sudo curl -o /root/amazon-cloudwatch-agent.deb <a href="https://s3.amazonaws.com/amazoncloudwatch-agent/debian/amd64/latest/amazon-cloudwatch-agent.deb">https://s3.amazonaws.com/amazoncloudwatch-agent/debian/amd64/latest/amazon-cloudwatch-agent.deb</a></blockquote><blockquote>sudo dpkg -i -E /root/amazon-cloudwatch-agent.deb</blockquote><blockquote>sudo aws configure — profile AmazonCloudWatchAgent</blockquote><p>Enter access key</p><p>Enter AWS Secret Access Key</p><p>Default region name [None]: us-east-1<br>Default output format [None]: text</p><p>sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-config-wizard</p><ol><li>On which OS are you planning to use the agent? Enter — <strong>1 , linux</strong></li></ol><p>2. Are you using EC2 or On-Premises hosts? Enter —<strong> 2 , On-Premises</strong></p><p>3. Which user are you planning to run the agent? — <strong>1, root</strong></p><p>4. Do you want to turn on StatsD daemon? <strong>2. no</strong></p><p>5. Do you want to monitor metrics from CollectD? WARNING: CollectD must be installed or the Agent will fail to start <strong>2. no</strong></p><p>6. Do you want to monitor any host metrics? e.g. CPU, memory, etc. — <strong>2. no</strong></p><p>7. Do you have any existing CloudWatch Log Agent (<a href="http://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AgentReference.html">http://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/AgentReference.html</a>) configuration file to import for migration? Enter <strong>2. no</strong></p><p>8. Do you want to monitor any log files? <strong>1. yes</strong></p><p>Log file path: /var/log/uwsgi/&lt;replace your file name&gt;</p><p>Log group name: &lt;replace your log group name&gt;</p><p>Log stream name: &lt;replace your log stream name&gt;</p><p>Log Group Retention in days: <strong>7. 30</strong></p><p>Do you want to specify any additional log files to monitor? <strong>2. no</strong></p><p>Do you want to store the config in the SSM parameter store? <strong>1. yes</strong></p><p>What parameter store name do you want to use to store your config? (Use ‘AmazonCloudWatch-’ prefix if you use our managed AWS policy)<br>default choice: [AmazonCloudWatch-linux]</p><p>Which region do you want to store the config in the parameter store?</p><p>default choice: [us-east-1]</p><p>Which AWS credential should be used to send json config to parameter store?</p><ol><li>*****(From Profile: AmazonCloudWatchAgent)</li></ol><blockquote>sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -a fetch-config -m onPremise -s -c file:/opt/aws/amazon-cloudwatch-agent/bin/config.json</blockquote><blockquote>sudo systemctl enable amazon-cloudwatch-agent.service</blockquote><blockquote>sudo service amazon-cloudwatch-agent start</blockquote><p>You can add more files logs in cloudwatch by editing the config file-</p><p>sudo nano /opt/aws/amazon-cloudwatch-agent/bin/config.json</p><p>To restart AWS cloudwatch, run-</p><p>sudo service amazon-cloudwatch-agent restart</p><p>You can go to AWS console log group and check if logs are coming.</p><p>Thanks.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8bfb518c8477" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Top 15 Companies Accepting Crypto Payments]]></title>
            <link>https://medium.com/@pawanjotkaurbaweja/top-15-companies-accepting-crypto-payments-a399097a7311?source=rss-365134aea544------2</link>
            <guid isPermaLink="false">https://medium.com/p/a399097a7311</guid>
            <category><![CDATA[accept-crypto-payments]]></category>
            <category><![CDATA[crypto-payment-gateway]]></category>
            <category><![CDATA[cryptopayments]]></category>
            <category><![CDATA[crypto]]></category>
            <category><![CDATA[cryptopay]]></category>
            <dc:creator><![CDATA[PAWANJOT KAUR BAWEJA]]></dc:creator>
            <pubDate>Fri, 25 Feb 2022 13:51:08 GMT</pubDate>
            <atom:updated>2022-02-25T13:51:08.489Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1hR1ZQq0QofxE9jAW4kZJw.jpeg" /></figure><p>Cryptocurrency, a concept that emerged more than a decade ago, has now become a highly buzzing word across the financial sector for a year. Initially, people sought cryptocurrencies for investments but now, with the advent of high-end technologies that facilitate hassle-free instant payments, Cryptocurrencies have entered the payments zone.</p><p>Most of the large companies are keen on crypto payments and some have even invested in technologies that facilitate efficient payments via cryptocurrencies.</p><p><strong>Why are major companies across different domains choosing crypto payments?</strong></p><ol><li>It aids in increasing the customer base, as most people are choosing businesses that have crypto payments because of reasons like hassle-free international payments, low transaction fees, etc.</li><li>The rapid digital advancements in the financial sector have led to the rise in Cryptocurrency preference. Thus, businesses tend to align with those companies that have invested in Crypto-related technologies.</li><li>Crypto payments put companies on the map of future technological breakthroughs. Currently, Cryptocurrencies are recognized as one of the prominent future payment channels, and this is the right time for companies to invest in the same.</li><li>Payments made via cryptocurrency are transparent, instant, secure, and do not include any additional charges as compared to other payment methods.</li><li>Companies opening access to crypto payments also have the chance to open new capital or tokenize their existing capital for better liquidity maintenance.</li></ol><p>Here are some notable organizations that have successfully accepted crypto payments:</p><ol><li><strong><em>Microsoft</em></strong></li></ol><p>Around the end of 2014, cryptocurrencies had faced a lot of backslashes due to certain misinterpreted discrepancies. Most businesses and consumers were against investing in Cryptocurrencies.</p><p>During this critical phase, Microsoft took a risky plunge into the pool of crypto payments. The company started accepting payments for gaming and apps on Windows and Xbox platforms.</p><p><strong><em>2. PayPal</em></strong></p><p>With the ongoing pandemic and the rise in the demand for digital payments, PayPal, in 2020, announced their entry to the world of crypto payments.</p><p>Today PayPal stands to be one of the biggest cryptocurrency and crypto payment platforms. Apart from buying or selling cryptocurrencies, you can even make purchases using the same. PayPal accepts Bitcoin, Ethereum, Litecoin, etc</p><p><strong><em>3. Overstock.com</em></strong></p><p>Coming to the Master of crypto payments — Overstock.com started accepting crypto payments in early 2014. Overstock.com beat Microsoft and PayPal in taking the risk of the crypto platform in partnership with Coinbase. In fact, it also has invested in Blockchain technology to help step up the world of Cryptocurrencies.</p><p><strong><em>4. Starbucks</em></strong></p><p>Fancy a Starbucks coffee? How about making it a bit fancier? In 2020, right at the beginning of the Covid-19 fiasco, Starbucks entered the mighty crypto dynasty with the help of Bakkt, the crypto exchange partner.</p><p><strong><em>5. AT&amp;T</em></strong></p><p>AT&amp;T is the first US-based telecommunications company that accept payments via cryptocurrencies. This initiation started in 2019 in association with BitPay as part of their brand services expansion.</p><p><strong><em>6. Travala.com</em></strong></p><p>Now you can book your hotels and flights on Travala.com via crypto payments in partnership with Binance Pay and crypto.com. Travala.com accepts Cardano, Bitcoin, Dogecoin, etc., and they also have their own cryptocurrency — AVA.</p><p><strong><em>7. Shopify</em></strong></p><p>Interested in shopping online? How about shopping on one of the biggest e-commerce platforms and paying via crypto payments? Yes, Shopify started accepting crypto payments as early as 2013. They currently accept Bitcoin.</p><p><strong><em>8. airBaltic</em></strong></p><p>Crypto payments entered the aviation world with airBaltic in 2014. airBaltic has been very successful with their crypto payments, and they have made a good amount of successful transactions to date.</p><p><strong><em>9. Pavillion Hotel and Resorts</em></strong></p><p>How about staying in one of the luxurious hotels by paying via crypto payments? This Hong-Kong-based hotel chain extended its payment options to cryptocurrencies in 2021. Pavillion Hotel and Resorts is the first international hotel chain to welcome Crypto payments.</p><p><strong><em>10. CheapAir.com</em></strong></p><p>Another air and hotel booking platform to encourage crypto payments is CheapAir.com. They started accepting cryptocurrencies in 2013 and currently accept most coins, including Bitcoin, Ethereum, Dogecoin, etc.</p><p><strong><em>11. Whole Foods</em></strong></p><p>Did you imagine buying groceries via crypto payments any day? Well, if yes, then here is your reality. Whole Foods joined the club of crypto payments in 2019 via a platform that converted Bitcoins automatically to dollars. This technology also led many big retailers to accept crypto payments.</p><p><strong><em>12. Newegg</em></strong></p><p>Unknown to many, Newegg, one of the biggest retail companies, has been accepting crypto payments since 2014. Since then, they have constantly increased their crypto coin options successfully, including Bitcoin, Ethereum, Litecoin, etc., to the latest Shiba Inu Token. Unlike the rest of the companies listed, they have chosen to take a direct payment path without any gateway partner.</p><p><strong><em>13. Mastercard</em></strong></p><p>As a part of their customer loyalty program, Mastercard came in partnership with Amber, BitKub, and CoinJar in 2021 to facilitate crypto payments. Customers can now store cryptocurrencies in their digital wallets, along with buying and selling crypto coins.</p><p><strong><em>14. AXA Insurance</em></strong></p><p>People of Switzerland can now pay their insurance via crypto payments with the help of AXA insurance. This became the first major insurer to allow Cryptocurrency based insurance. Owing to the rapid digital financial transformation due to the pandemic, AXA insurance decided to welcome crypto payments with open hands.</p><p><strong><em>15. Sotheby’s</em></strong></p><p>In 2021, one of the finest auction companies, Sotheby’s, confirmed that they would accept crypto payments in collaboration with Coinbase. They started their crypto payment journey with Bitcoin and Ethereum.</p><p>These companies conclusively tell the same tale that crypto payments are here to stay for a while. However, there are hundreds of other queries businesses have that need transparent answers. Overall, for any business or company to accept crypto payments, the crucial aspect is to choose the best cryptocurrency payment gateway, partner.</p><p>iPint assists such businesses with hassle-free payments, easy-to-understand payment transaction UI, instant transaction and invoice generation, etc., making crypto payments as easy as other payment options.</p><p>Get in touch with us for further queries!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a399097a7311" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Remote Push notifications with react native on Android]]></title>
            <link>https://medium.com/@pawanjotkaurbaweja/remote-push-notifications-with-react-native-on-android-fe94f69f390b?source=rss-365134aea544------2</link>
            <guid isPermaLink="false">https://medium.com/p/fe94f69f390b</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[firebase-messaging]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[notifications]]></category>
            <category><![CDATA[push-notification]]></category>
            <dc:creator><![CDATA[PAWANJOT KAUR BAWEJA]]></dc:creator>
            <pubDate>Sat, 04 Dec 2021 15:48:31 GMT</pubDate>
            <atom:updated>2021-12-04T15:48:31.662Z</atom:updated>
            <content:encoded><![CDATA[<h3>Push notifications with react native on Android</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*2NJuW4hZOHbUG43bgoDDWQ.png" /></figure><p>Hi, I tried many tutorials for push notifications on Android but nothing worked so I am writing detailed steps to achieve working push notifications on Android using react native</p><ol><li>Create an app on <strong>Google Firebase Console </strong><a href="https://console.firebase.google.com/u/0/">https://console.firebase.google.com/u/0/</a></li><li>From Settings icon, move to Project Settings</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/902/1*lXrUXpp8JevZeGNtkjUotQ.png" /></figure><p>3. Add Firebase to your Android app</p><p>Add Debug signing certificate SHA-1</p><p>Download <strong>google-services.json </strong>and add it in &lt;project&gt;/android/appdirectory</p><pre>keytool -list -v -alias androiddebugkey -keystore ~/.android/debug.keystore</pre><p><strong>Project-level build.gradle </strong>(android/build.gradle):</p><pre><br>buildscript {<br>  repositories {<br>    // Check that you have the following line (if not, add it):<br>    google()  // Google&#39;s Maven repository</pre><pre>}<br>  dependencies {<br>    ...<br>    // Add this line<br>    classpath &#39;com.google.gms:google-services:4.3.10&#39;</pre><pre>}<br>}<br><br>allprojects {<br>  ...<br>  repositories {<br>    // Check that you have the following line (if not, add it):<br>    google()  // Google&#39;s Maven repository</pre><pre>...<br>  }<br>}</pre><p>App-level build.gradle (&lt;project&gt;/android/app/build.gradle):</p><pre><br>apply plugin: &#39;com.android.application&#39;<br>apply plugin: &#39;com.google.gms.google-services&#39;</pre><pre>dependencies {<br>  // Import the Firebase BoM<br>  implementation platform(&#39;com.google.firebase:firebase-bom:29.0.1&#39;)</pre><pre>// Add the dependency for the Firebase SDK for Google Analytics<br>  // When using the BoM, don&#39;t specify versions in Firebase dependencies<br>  implementation &#39;com.google.firebase:firebase-analytics&#39;</pre><pre>implementation &#39;com.google.firebase:firebase-messaging:23.0.0&#39;</pre><pre>}</pre><p>4. Please check if inside your &lt;project&gt;/android/app/src/main/java/ the package name is the same as you entered while creating the firebase app.</p><p>So your<strong> MainApplication.java </strong>should be inside &lt;project&gt;/android/app/src/main/java/&lt;your&gt;/&lt;package&gt;/&lt;name&gt;/<strong>MainApplication.java</strong></p><p><strong>Note-</strong> If you wish you change your package name in this step, follow these steps</p><p>a. Compile your app with your initial package name without new <strong>google-services.json</strong></p><p>b. Add file <strong>google-services.json </strong>and change the package name in your Manifest file and app/build.gradle.</p><p>c. Open android studio and create your package inside java folder</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/526/1*pBJ6uIYuycBLlpecP12Q4w.png" /></figure><p>Move <strong>MainApplication.java</strong> and<strong> MainActivity.java</strong> in your new package.</p><p>5. Once you are able to compile your app successfully after adding <strong>google-services.json</strong>, the following steps need to be followed:</p><p>Install following modules</p><pre>npm i react-native-push-notification<br>npm i @react-native-community/push-notification-ios</pre><p>6.</p><p>Add the following code in android/app/src/main/AndroidManifest.xml</p><pre>&lt;!-- Change the value to true to enable pop-up for in foreground on receiving remote notifications (for prevent duplicating while showing local notifications set this to false) --&gt;<br>        &lt;meta-data  android:name=&quot;com.dieam.reactnativepushnotification.notification_foreground&quot;<br>                    android:value=&quot;false&quot;/&gt;<br>        &lt;!-- Change the resource name to your App&#39;s accent color - or any other color you want --&gt;<br>        &lt;meta-data  android:name=&quot;com.dieam.reactnativepushnotification.notification_color&quot;<br>                    android:resource=&quot;@color/white&quot;/&gt; &lt;!-- or @android:color/{name} to use a standard color --&gt;<br><br>        &lt;receiver android:name=&quot;com.dieam.reactnativepushnotification.modules.RNPushNotificationActions&quot; /&gt;<br>        &lt;receiver android:name=&quot;com.dieam.reactnativepushnotification.modules.RNPushNotificationPublisher&quot; /&gt;<br>        &lt;receiver android:name=&quot;com.dieam.reactnativepushnotification.modules.RNPushNotificationBootEventReceiver&quot;&gt;<br>            &lt;intent-filter&gt;<br>                &lt;action android:name=&quot;android.intent.action.BOOT_COMPLETED&quot; /&gt;<br>                &lt;action android:name=&quot;android.intent.action.QUICKBOOT_POWERON&quot; /&gt;<br>                &lt;action android:name=&quot;com.htc.intent.action.QUICKBOOT_POWERON&quot;/&gt;<br>            &lt;/intent-filter&gt;<br>        &lt;/receiver&gt;<br><br>        &lt;service<br>            android:name=&quot;com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerService&quot;<br>            android:exported=&quot;false&quot; &gt;<br>            &lt;intent-filter&gt;<br>                &lt;action android:name=&quot;com.google.firebase.MESSAGING_EVENT&quot; /&gt;<br>            &lt;/intent-filter&gt;<br>        &lt;/service&gt;</pre><p>Add the following code in android/app/src/main/res/values/colors.xml</p><pre>&lt;resources&gt;<br>    &lt;color name=&quot;white&quot;&gt;#FFF&lt;/color&gt;<br>&lt;/resources&gt;</pre><p>Add the following code in android/app/src/main/res/values/colors.xml</p><pre>react-native link react-native-push-notification</pre><p>Add the following code in app/build.gradle</p><pre>implementation project(&#39;:react-native-push-notification&#39;)</pre><p>DO NOT USE .configure() INSIDE A COMPONENT, EVEN App</p><blockquote><em>If you do, notification handlers will not fire, because they are not loaded. Instead, use </em><em>.configure() in the app&#39;s first file, usually </em><em>index.js.</em></blockquote><pre>import PushNotificationIOS from &quot;<a href="http://twitter.com/react">@react</a>-native-community/push-notification-ios&quot;;<br>import PushNotification from &quot;react-native-push-notification&quot;;</pre><pre>// Must be outside of any component LifeCycle (such as `componentDidMount`).<br>PushNotification.configure({<br>  // (optional) Called when Token is generated (iOS and Android)<br>  onRegister: function (token) {<br>    console.log(&quot;TOKEN:&quot;, token);<br>  },</pre><pre>// (required) Called when a remote is received or opened, or local notification is opened<br>  onNotification: function (notification) {<br>    console.log(&quot;NOTIFICATION:&quot;, notification);</pre><pre>// process the notification</pre><pre>// (required) Called when a remote is received or opened, or local notification is opened<br>    notification.finish(PushNotificationIOS.FetchResult.NoData);<br>  },</pre><pre>// (optional) Called when Registered Action is pressed and invokeApp is false, if true onNotification will be called (Android)<br>  onAction: function (notification) {<br>    console.log(&quot;ACTION:&quot;, notification.action);<br>    console.log(&quot;NOTIFICATION:&quot;, notification);</pre><pre>// process the action<br>  },</pre><pre>// (optional) Called when the user fails to register for remote notifications. Typically occurs when APNS is having issues, or the device is a simulator. (iOS)<br>  onRegistrationError: function(err) {<br>    console.error(err.message, err);<br>  },</pre><pre>// IOS ONLY (optional): default: all - Permissions to register.<br>  permissions: {<br>    alert: true,<br>    badge: true,<br>    sound: true,<br>  },</pre><pre>// Should the initial notification be popped automatically<br>  // default: true<br>  popInitialNotification: true,</pre><pre>/**<br>   * (optional) default: true<br>   * - Specified if permissions (ios) and token (android and ios) will requested or not,<br>   * - if not, you must call PushNotificationsHandler.requestPermissions() later<br>   * - if you are not using remote notification or do not have Firebase installed, use this:<br>   *     requestPermissions: Platform.OS === &#39;ios&#39;<br>   */<br>  requestPermissions: true,<br>});</pre><p>Build the app, the token is printed in the console, copy the token and send a test notification message.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4qeYWNJY-LSApqkIME5xWQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ic0MAo9BNFCqyxNqsDYgpg.png" /></figure><p>You will get the notification on your android device after this.</p><p>I HOPE YOU WILL LIKE THIS AND IT WORKS FOR YOU. Have a great time😊.</p><p>You can leave your comments in case you need any help with this.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fe94f69f390b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>