<?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[Fotonicia - Medium]]></title>
        <description><![CDATA[www.fotonicia.com - Medium]]></description>
        <link>https://medium.com/fotonicia?source=rss----c3df5af66c7b---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Fotonicia - Medium</title>
            <link>https://medium.com/fotonicia?source=rss----c3df5af66c7b---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 17:25:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/fotonicia" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Gitlab CI for deploying Magento2 on AWS]]></title>
            <link>https://medium.com/fotonicia/gitlab-ci-for-deploying-magento2-on-aws-7e7081cfffc2?source=rss----c3df5af66c7b---4</link>
            <guid isPermaLink="false">https://medium.com/p/7e7081cfffc2</guid>
            <category><![CDATA[ec2]]></category>
            <category><![CDATA[magento-2]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[gitlab]]></category>
            <category><![CDATA[gitlab-ci]]></category>
            <dc:creator><![CDATA[Ankit Gupta]]></dc:creator>
            <pubDate>Wed, 29 Apr 2020 14:42:01 GMT</pubDate>
            <atom:updated>2023-06-11T09:27:07.128Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xI_nZ2DTRdAtvWyb" /><figcaption>Photo by <a href="https://unsplash.com/@wocintechchat?utm_source=medium&amp;utm_medium=referral">Christina @ wocintechchat.com</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>If you have experienced deploying applications with Magento2 on server, you would know those can be tricky, especially if done manually (replacing files, running di:compile, static-content:deploy and cache:flush).</p><p>Thankfully, with tools like <a href="https://github.com/davidalger/capistrano-magento2">Capistrano-Magento2</a> you can automate the deployments via a single command.</p><p>If you are like me and use Gitlab for your source control, you would still have to manually trigger deployments to your staging/production servers once the build is ready.</p><p>Gitlab CI/CD with its shared runners takes the pain away from performing the steps of build, test &amp; deploy manually. Besides automating your deployments can have a lot of benefits:</p><ol><li>No failed deployments due to missing any step in the deployment process.</li><li>More release velocity — since now you can continuously deploy instead of doing them on a schedule.</li><li>And of-course, reducing dev ops time (which is the probably the main motivation ;) )</li></ol><p>Moving to the interesting part.</p><p>Below is a working .gitlab-ci.yml which deploys your magento2 code to the server running on AWS.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0193ef0eb06d21c676f2abf65c039fc1/href">https://medium.com/media/0193ef0eb06d21c676f2abf65c039fc1/href</a></iframe><p>Few things to note:</p><ol><li>The deploy script <a href="https://gist.github.com/ankitdbst/9bb9d2a8078286da4b13b674e1934e6a">update-ip.s</a>h uses awscli to whitelist the runner ip in AWS EC2 security group for SSH access.</li><li>You can add the keys to perform changes to the server using the ssh-agent .</li><li>The credentials used by the deployment script above are defined in the <a href="https://docs.gitlab.com/ee/ci/variables/">Variables</a> section of your Gitlab projects CI/CD settings.</li><li>Finally, there are 2 separate jobs staging_deploy and production_deploy to deploy to the specific environments, which get triggered when there is a push to the corresponding branches — develop and master .</li></ol><p>References:</p><ul><li><a href="https://www.jvt.me/posts/2017/01/25/gitlab-ci-capistrano/">https://www.jvt.me/posts/2017/01/25/gitlab-ci-capistrano/</a></li></ul><p>If you liked this, connect with me on <a href="https://www.linkedin.com/in/ankitgupta90/">LinkedIn</a> or <a href="https://twitter.com/_AnkitGupta">Twitter</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e7081cfffc2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fotonicia/gitlab-ci-for-deploying-magento2-on-aws-7e7081cfffc2">Gitlab CI for deploying Magento2 on AWS</a> was originally published in <a href="https://medium.com/fotonicia">Fotonicia</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Install SSL certificate from Comodo]]></title>
            <link>https://medium.com/fotonicia/install-ssl-certificate-from-comodo-a45afc089b03?source=rss----c3df5af66c7b---4</link>
            <guid isPermaLink="false">https://medium.com/p/a45afc089b03</guid>
            <category><![CDATA[comodo]]></category>
            <category><![CDATA[ssl]]></category>
            <category><![CDATA[nginx]]></category>
            <dc:creator><![CDATA[Ankit Gupta]]></dc:creator>
            <pubDate>Mon, 25 Nov 2019 15:28:47 GMT</pubDate>
            <atom:updated>2019-11-25T15:45:27.241Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*RiiKY1VxADTi49XD" /><figcaption>Photo by <a href="https://unsplash.com/@markusspiske?utm_source=medium&amp;utm_medium=referral">Markus Spiske</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>There are 3 types of SSL certificates that you can purchase for your site from <a href="http://comodo.co.in/">Comodo</a>:</p><ol><li>Positive SSL/Comodo SSL (DV)</li></ol><p>This is domain verified SSL certificate which only verifies the <strong>genuinity </strong>of the domain but not the organization. It provides 2048 bit encryption with a warranty of $10k (Positive SSL) and $250k (Comodo SSL)</p><p>These are usually cheaper and can work well for starter businesses.</p><p>2. Premium SSL (OV)</p><p>This SSL certificate not only verifies the domain but also verifies the <strong>genuinity </strong>of the organization for which the certificate is issued.</p><p>This is costlier than the 1st type.</p><p>3. SSL Certificate (EV)</p><p>This includes extended verification and adds an extra layer of trust. This is usually costlier than the OV SSLs.</p><p>Once you purchase either of the SSL certs, the installation steps for a server running Ubuntu / Nginx is as below:</p><ol><li><a href="https://support.sectigo.com/Com_KnowledgeDetailPage?Id=kA01N000000zFJQ">Create</a> the CSR file and upload it</li><li>Verify the domain</li><li>Download the certificate zip</li></ol><p>To install:</p><ol><li>Copy the key created in step 1 above to /etc/nginx/ssl/private</li><li>Create ssl-bundle.crt within /etc/nginx/ssl/certs with the following commands:</li></ol><ul><li>cat SectigoRSADomainValidationSecureServerCA.crt AddTrustExternalCARoot.crt &gt; example_com.ca-bundle</li><li>cat www_example_com.crt example_com.ca-bundle &gt; ssl-bundle.crt</li></ul><p>3. Finally update the <a href="https://support.sectigo.com/Com_KnowledgeDetailPage?Id=kA01N000000zFJQ">nginx config</a> to enable SSL</p><pre>server {<br>  listen 443;<br>  server_name example.com;<br>  ssl on;<br>  ssl_certificate /etc/ssl/certs/ssl-bundle.crt;<br>  ssl_certificate_key /etc/ssl/private/example.key;<br>  ssl_prefer_server_ciphers on;<br>}</pre><p><strong>Note</strong>: You can check for some coupon codes from <a href="https://comodo.co.in/indian-independence-day-offers/">here</a> to purchase SSL certificate on Sectigo (formerly comodo.co.in).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a45afc089b03" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fotonicia/install-ssl-certificate-from-comodo-a45afc089b03">Install SSL certificate from Comodo</a> was originally published in <a href="https://medium.com/fotonicia">Fotonicia</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Add custom fees on cart item add in Magento2]]></title>
            <link>https://medium.com/fotonicia/add-custom-fees-on-cart-item-add-in-magento2-303ae996608a?source=rss----c3df5af66c7b---4</link>
            <guid isPermaLink="false">https://medium.com/p/303ae996608a</guid>
            <category><![CDATA[magento-2]]></category>
            <category><![CDATA[php]]></category>
            <dc:creator><![CDATA[Ankit Gupta]]></dc:creator>
            <pubDate>Wed, 14 Aug 2019 04:57:54 GMT</pubDate>
            <atom:updated>2019-08-14T05:21:26.128Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*AX_z4givCBg6ejC6" /><figcaption>Photo by <a href="https://unsplash.com/@austindistel?utm_source=medium&amp;utm_medium=referral">Austin Distel</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>Step 1</strong>. Listen to Magento2 event checkout_cart_product_add_after, by adding entry into events.xml</p><pre><em>&lt;?</em><strong>xml version=&quot;1.0&quot;</strong><em>?&gt;<br><br></em>&lt;<strong>config xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;<br>        xsi:noNamespaceSchemaLocation=&quot;urn:magento:framework:Event/etc/events.xsd&quot;</strong>&gt;<br>    &lt;<strong>event name=&quot;checkout_cart_product_add_after&quot;</strong>&gt;<br>        &lt;<strong>observer name=&quot;add_setup_fees&quot; instance=&quot;Fotonicia\SetupFees\Model\Observer\AddSetupFees&quot; </strong>/&gt;<br>    &lt;/<strong>event</strong>&gt;<br>&lt;/<strong>config</strong>&gt;</pre><p>AddSetupFees.php</p><pre><strong>class </strong>AddSetupFees <strong>implements </strong>ObserverInterface<br>{<br>    <strong>public function </strong>execute(\Magento\Framework\Event\Observer $observer)<br>    {<br>        $setupFees = 100; <em>// dynamically calculate based on the $item<br>        /** </em><strong><em>@var </em></strong><em>Item $item */<br>        </em>$item = $observer-&gt;getEvent()-&gt;getQuoteItem();<br>        $quote = $item-&gt;getQuote();<br>        <em>// Logic to set fees only if the item print type combo is not already in the cart<br>        </em>$quote-&gt;setSetupFees($quote-&gt;getSetupFees() + $setupFees);<em><br>        </em><strong>return </strong>$this;<br>    }<br>}</pre><p><strong>Step 2.</strong> Extend quote, quote_address, sales_order, sales_invoice tables to include the setup fees from each item.</p><p>UpgradeSchema.php</p><pre><em>//Quote address tables<br></em>$setup-&gt;getConnection()<br>    -&gt;addColumn(<br>        $setup-&gt;getTable($quoteTable),<br>        <strong>&#39;setup_fees&#39;</strong>,<br>        [<br>            <strong>&#39;type&#39; </strong>=&gt; \Magento\Framework\DB\Ddl\Table::<strong><em>TYPE_DECIMAL</em></strong>,<br>            <strong>&#39;10,2&#39;</strong>,<br>            <strong>&#39;default&#39; </strong>=&gt; 0.00,<br>            <strong>&#39;nullable&#39; </strong>=&gt; <strong>true</strong>,<br>            <strong>&#39;comment&#39; </strong>=&gt;<strong>&#39;Setup Fees&#39;<br>        </strong>]<br>    );<br>$setup-&gt;getConnection()<br>    -&gt;addColumn(<br>        $setup-&gt;getTable($quoteTable),<br>        <strong>&#39;base_setup_fees&#39;</strong>,<br>        [<br>            <strong>&#39;type&#39; </strong>=&gt; \Magento\Framework\DB\Ddl\Table::<strong><em>TYPE_DECIMAL</em></strong>,<br>            <strong>&#39;10,2&#39;</strong>,<br>            <strong>&#39;default&#39; </strong>=&gt; 0.00,<br>            <strong>&#39;nullable&#39; </strong>=&gt; <strong>true</strong>,<br>            <strong>&#39;comment&#39; </strong>=&gt;<strong>&#39;Base Setup Fees&#39;<br>        </strong>]<br>    );<br>...<br>// Fields for other tables</pre><p>Step 3. Add a row to sales.xml for total calculations for quote &amp; order</p><pre><em>&lt;?</em><strong>xml version=&quot;1.0&quot;</strong><em>?&gt;<br></em>&lt;<strong>config xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xsi:noNamespaceSchemaLocation=&quot;urn:magento:module:Magento_Sales:etc/sales.xsd&quot;</strong>&gt;<br>    &lt;<strong>section name=&quot;quote&quot;</strong>&gt;<br>        &lt;<strong>group name=&quot;totals&quot;</strong>&gt;<br>            &lt;<strong>item name=&quot;setup_fees&quot; instance=&quot;Fotonicia\SetupFees\Model\Quote\Total\SetupFees&quot; sort_order=&quot;150&quot;</strong>/&gt;<br>        &lt;/<strong>group</strong>&gt;<br>    &lt;/<strong>section</strong>&gt;<br>    &lt;<strong>section name=&quot;order_invoice&quot;</strong>&gt;<br>        &lt;<strong>group name=&quot;totals&quot;</strong>&gt;<br>            &lt;<strong>item name=&quot;setup_fees&quot; instance=&quot;Fotonicia\SetupFees\Model\Invoice\Total\SetupFees&quot; sort_order=&quot;160&quot;</strong>/&gt;<br>        &lt;/<strong>group</strong>&gt;<br>    &lt;/<strong>section</strong>&gt;<br>&lt;/<strong>config</strong>&gt;</pre><p>SetupFees.php</p><pre><strong>&lt;?php<br></strong><em>/**<br> * Copyright © 2015 Magento. All rights reserved.<br> * See COPYING.txt for license details.<br> */<br></em><strong>namespace </strong>Fotonicia\SetupFees\Model\Quote\Total;<br><br><strong>use </strong>Magento\Store\Model\ScopeInterface;<br><br><strong>class </strong>SetupFees <strong>extends </strong>\Magento\Quote\Model\Quote\Address\Total\AbstractTotal<br>{<br><br>    <strong>protected $helperData</strong>;<br><br>    <em>/**<br>     * Collect grand total address amount<br>     *<br>     * </em><strong><em>@param </em></strong><em>\Magento\Quote\Model\Quote $quote<br>     * </em><strong><em>@param </em></strong><em>\Magento\Quote\Api\Data\ShippingAssignmentInterface $shippingAssignment<br>     * </em><strong><em>@param </em></strong><em>\Magento\Quote\Model\Quote\Address\Total $total<br>     * </em><strong><em>@return </em></strong><em>$this<br>     */<br>    </em><strong>protected $quoteValidator </strong>= <strong>null</strong>;<br><br>    <strong>public function </strong>__construct(\Magento\Quote\Model\QuoteValidator $quoteValidator,<br>                                \Fotonicia\SetupFees\Helper\Data $helperData)<br>    {<br>        $this-&gt;<strong>quoteValidator </strong>= $quoteValidator;<br>        $this-&gt;<strong>helperData </strong>= $helperData;<br>    }<br><br>    <strong>public function </strong>collect(<br>        \Magento\Quote\Model\Quote $quote,<br>        \Magento\Quote\Api\Data\ShippingAssignmentInterface $shippingAssignment,<br>        \Magento\Quote\Model\Quote\Address\Total $total<br>    )<br>    {<br>        <strong>parent</strong>::<em>collect</em>($quote, $shippingAssignment, $total);<br>        $enabled = $this-&gt;<strong>helperData</strong>-&gt;isModuleEnabled();<br>        <strong>if </strong>($enabled) {<br>            $setupFees = $quote-&gt;getSetupFees();<br>            $total-&gt;setTotalAmount(<strong>&#39;setup_fees&#39;</strong>, $setupFees);<br>            $total-&gt;setBaseTotalAmount(<strong>&#39;setup_fees&#39;</strong>, $setupFees);<br>            $total-&gt;setSetupFees($setupFees);<br>            $total-&gt;setBaseSetupFees($setupFees);<br>            $quote-&gt;setSetupFees($setupFees);<br>            $quote-&gt;setBaseSetupFees($setupFees);<br>            $total-&gt;setGrandTotal($total-&gt;getGrandTotal() + $setupFees);<br>            $total-&gt;setBaseGrandTotal($total-&gt;getBaseGrandTotal() + $setupFees);<br>        }<br>        <strong>return </strong>$this;<br>    }<br><br>    <em>/**<br>     * </em><strong><em>@param </em></strong><em>\Magento\Quote\Model\Quote $quote<br>     * </em><strong><em>@param </em></strong><em>\Magento\Quote\Model\Quote\Address\Total $total<br>     * </em><strong><em>@return </em></strong><em>array<br>     */<br>    </em><strong>public function </strong>fetch(\Magento\Quote\Model\Quote $quote, \Magento\Quote\Model\Quote\Address\Total $total)<br>    {<br><br>        $enabled = $this-&gt;<strong>helperData</strong>-&gt;isModuleEnabled();<br>        $setupFees = $quote-&gt;getSetupFees();<br>        <strong>if </strong>($enabled &amp;&amp; $setupFees) {<br>            <strong>return </strong>[<br>                <strong>&#39;code&#39; </strong>=&gt; <strong>&#39;setup_fees&#39;</strong>,<br>                <strong>&#39;title&#39; </strong>=&gt; <strong>&#39;Setup Fees&#39;</strong>,<br>                <strong>&#39;value&#39; </strong>=&gt; $setupFees<br>            ];<br>        } <strong>else </strong>{<br>            <strong>return array</strong>();<br>        }<br>    }<br><br>    <em>/**<br>     * Get Subtotal label<br>     *<br>     * </em><strong><em>@return </em></strong><em>\Magento\Framework\Phrase<br>     */<br>    </em><strong>public function </strong>getLabel()<br>    {<br>        <strong>return </strong>__(<strong>&#39;Setup Fees&#39;</strong>);<br>    }<br><br>    <em>/**<br>     * </em><strong><em>@param </em></strong><em>\Magento\Quote\Model\Quote\Address\Total $total<br>     */<br>    </em><strong>protected function </strong>clearValues(\Magento\Quote\Model\Quote\Address\Total $total)<br>    {<br>        $total-&gt;setTotalAmount(<strong>&#39;subtotal&#39;</strong>, 0);<br>        $total-&gt;setBaseTotalAmount(<strong>&#39;subtotal&#39;</strong>, 0);<br>        $total-&gt;setTotalAmount(<strong>&#39;tax&#39;</strong>, 0);<br>        $total-&gt;setBaseTotalAmount(<strong>&#39;tax&#39;</strong>, 0);<br>        $total-&gt;setTotalAmount(<strong>&#39;discount_tax_compensation&#39;</strong>, 0);<br>        $total-&gt;setBaseTotalAmount(<strong>&#39;discount_tax_compensation&#39;</strong>, 0);<br>        $total-&gt;setTotalAmount(<strong>&#39;shipping_discount_tax_compensation&#39;</strong>, 0);<br>        $total-&gt;setBaseTotalAmount(<strong>&#39;shipping_discount_tax_compensation&#39;</strong>, 0);<br>        $total-&gt;setSubtotalInclTax(0);<br>        $total-&gt;setBaseSubtotalInclTax(0);<br>    }<br>}</pre><h3>Left-out parts:</h3><ul><li>On removing item from cart, we need to listen and remove the specific fees for that item.</li><li>Front-end display of the totals on Cart &amp; Order page needs to be extended as well.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=303ae996608a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fotonicia/add-custom-fees-on-cart-item-add-in-magento2-303ae996608a">Add custom fees on cart item add in Magento2</a> was originally published in <a href="https://medium.com/fotonicia">Fotonicia</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Monitoring application & server logs with Slack]]></title>
            <link>https://medium.com/fotonicia/monitoring-application-server-logs-with-slack-d9ea8641d64f?source=rss----c3df5af66c7b---4</link>
            <guid isPermaLink="false">https://medium.com/p/d9ea8641d64f</guid>
            <category><![CDATA[nginx]]></category>
            <category><![CDATA[magento-2]]></category>
            <category><![CDATA[slack]]></category>
            <category><![CDATA[logging]]></category>
            <dc:creator><![CDATA[Ankit Gupta]]></dc:creator>
            <pubDate>Sat, 20 Jul 2019 07:06:03 GMT</pubDate>
            <atom:updated>2019-07-20T07:06:03.247Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*H50NfEBqjss3rZ_E" /><figcaption>Photo by <a href="https://unsplash.com/@chrisliverani?utm_source=medium&amp;utm_medium=referral">Chris Liverani</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>There is no easy way to currently monitor the errors in real time on your Magento 2 server. There are a <a href="http://splunk.com/">few</a> <a href="https://rollbar.com/">solutions</a> <a href="https://airbrake.io/">out</a> there but unless you want to invest into complex methods with monthly paid plans, there is an easy way out with Slack <a href="https://api.slack.com/incoming-webhooks">web-hooks</a>.</p><p>Below is a modified script from <a href="https://blog.getpostman.com/2015/12/23/stream-any-log-file-to-slack-using-curl/">Postman</a> blog to tail any log. It writes the output to slack as below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UWqqfKH8Q6UuRa8SqtDMXQ.png" /></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/17a7d4cdda94edce1d53a9cfc101a5f0/href">https://medium.com/media/17a7d4cdda94edce1d53a9cfc101a5f0/href</a></iframe><p>Logs of interest in case of Magento2 running on Nginx:</p><ol><li>access.log</li><li>error.log</li><li>exception.log</li><li>system.log</li></ol><p>Below is a script that monitors the above logs and sends the output to the above configured web-hook on slack</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/16cbfad8ca20a4f174772e1e1223708e/href">https://medium.com/media/16cbfad8ca20a4f174772e1e1223708e/href</a></iframe><p>To stop all the running tail processes:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1296d13049030caef581c596d548d08d/href">https://medium.com/media/1296d13049030caef581c596d548d08d/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d9ea8641d64f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fotonicia/monitoring-application-server-logs-with-slack-d9ea8641d64f">Monitoring application &amp; server logs with Slack</a> was originally published in <a href="https://medium.com/fotonicia">Fotonicia</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sync files to remote server with PHPStorm on Windows]]></title>
            <link>https://medium.com/fotonicia/sync-files-to-remote-server-with-phpstorm-on-windows-659b4c9a6bb?source=rss----c3df5af66c7b---4</link>
            <guid isPermaLink="false">https://medium.com/p/659b4c9a6bb</guid>
            <category><![CDATA[phpstorm]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[windows-10]]></category>
            <category><![CDATA[sync]]></category>
            <dc:creator><![CDATA[Ankit Gupta]]></dc:creator>
            <pubDate>Thu, 20 Jun 2019 13:41:08 GMT</pubDate>
            <atom:updated>2019-06-20T13:42:03.941Z</atom:updated>
            <content:encoded><![CDATA[<p>If you are like me who prefers an IDE (particularly by Jetbrains) over Vim while working on your remote linux machines, you would have wanted to sync your project folders to remote while working on your IDE in the local windows machine.</p><p>Unfortunately, mounting the drive to the Windows system using <a href="https://www.nsoftware.com/sftp/netdrive/download.aspx">SFTP</a> or Samba doesn’t work. On adding the project to PHPStorm, the IDE hangs and the below warnings are shown:</p><pre>External file changes sync may be slow: Project files cannot be watched (are they under network mount ?)</pre><p>Jetbrains has also <a href="http://Working directly over mounted networked location is officially unsupported">advised</a> against this setup.</p><h3>Solution:</h3><p>rsync and File Watcher Plugin to the rescue.</p><p>You would either require <a href="http://www.mingw.org/">MingW</a> or <a href="https://docs.microsoft.com/en-us/windows/wsl/install-win10">WSL</a> to have rsync running on your bash.</p><p>Then you can write the below mage-sync.bat file to sync your files over to your linux machine.</p><pre>REM Starting sync...<br>bash -c &quot;rsync -a /mnt/c/git/magento2/app/ hash:code/magento2/app/ --no-perms --no-owner --no-group --cvs-exclude&quot;<br>REM Finished syncing</pre><p>I am using this to sync my Magento 2 source files to my local linux machine.</p><p>--no-perms --no-owner --no-group is to ignore file permissions and ownerships</p><p>--cvs-exclude is to ignore folders like .git</p><p>To test out run mage-sync.bat</p><p>Finally, to run this on every save &amp; auto-save by PHPStorm, map this command in the FileWatcher Plugin</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CFRbqxB-qzyC6Df8i5U9Zw.png" /></figure><p>Voila, now you would have the files updated on the linux machine on every save.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=659b4c9a6bb" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fotonicia/sync-files-to-remote-server-with-phpstorm-on-windows-659b4c9a6bb">Sync files to remote server with PHPStorm on Windows</a> was originally published in <a href="https://medium.com/fotonicia">Fotonicia</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Magento 2 on container]]></title>
            <link>https://medium.com/fotonicia/magento-2-on-container-a10cda399d72?source=rss----c3df5af66c7b---4</link>
            <guid isPermaLink="false">https://medium.com/p/a10cda399d72</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[magento-2]]></category>
            <category><![CDATA[containers]]></category>
            <dc:creator><![CDATA[Ankit Gupta]]></dc:creator>
            <pubDate>Tue, 18 Jun 2019 10:20:11 GMT</pubDate>
            <atom:updated>2019-06-18T12:03:06.433Z</atom:updated>
            <content:encoded><![CDATA[<h3>Why container?</h3><p>Containers help to isolate the application dependencies and allows one to scale by running the services on additional containers with minimal effort.</p><h3>Setup docker</h3><p><a href="https://docs.docker.com/install/linux/docker-ce/ubuntu/">Install</a>docker&amp;&amp; docker-composer.</p><h3>Create Services</h3><p>For Magento 2, we would need the below 3 services at the minimum:</p><ol><li>PHP — Running php-fpm</li><li>Nginx — Running the web server</li><li>MySQL — Runing the my sql server</li></ol><p>Since Magento 2 has specific platform <a href="https://devdocs.magento.com/guides/v2.3/install-gde/system-requirements-tech.html">requirements</a>, we need to build those into the container. For e.g. PHP container should have php-gd library build with jpeg support and freetype fonts.</p><p>Dockerfile for php:</p><pre>FROM php:7.1-fpm<br><br># install libraries required by the extensions<br>RUN apt-get update \<br>  &amp;&amp; apt-get install -y \<br>    cron \<br>    libicu-dev \<br>    libjpeg62-turbo-dev \<br>    libmcrypt-dev \<br>    libpng-dev \<br>    libxslt1-dev \<br>    libfreetype6-dev<br><br># install extensions<br>RUN docker-php-ext-configure gd --with-jpeg-dir --with-freetype-dir &amp;&amp; \<br>    docker-php-ext-install \<br>      bcmath \<br>      gd \<br>      intl \<br>      mbstring \<br>      mcrypt \<br>      pdo_mysql \<br>      soap \<br>      xsl \<br>      zip<br><br># creating php.ini file<br>RUN echo &#39;memory_limit = 2G\n\<br>max_execution_time = 1800\n\<br>zlib.output_compression = On&#39; &gt;&gt; /usr/local/etc/php/php.ini<br><br>COPY startup.sh /bin/startup.sh<br><br>WORKDIR /var/www/html<br><br>ENTRYPOINT &quot;/bin/startup.sh&quot;</pre><p>Here I am using theENTRYPOINT to run the start up script startup.sh which runs commands required by Magento.</p><p>Contents ofstartup.sh</p><pre>#!/bin/bash<br>bin/magento cron:install<br>service cron start<br>docker-php-entrypoint php-fpm</pre><p><strong>Note</strong>: These commands cannot be run in the Dockerfile since the services (cron in this case) aren’t running at that time.</p><p>Dockerfile for nginx:</p><pre>FROM nginx:1.11<br><br>COPY default.conf /etc/nginx/conf.d/default.conf</pre><p>And finally the docker-compose.yml to compose the 3 services above:</p><pre>version: &#39;3&#39;<br>services:<br>  php:<br>    image: fotonicia/php<br>    build: php<br>    volumes:<br>      - ./magento2:/var/www/html<br>    networks:<br>      - appnet<br><br>  nginx:<br>    image: fotonicia/nginx<br>    build: nginx<br>    ports:<br>      - 8080:80<br>    volumes:<br>      - ./magento2:/var/www/html<br>    networks:<br>      - appnet<br><br>  db:<br>    image: mysql:5.7<br>    volumes:<br>      - db_data:/var/lib/mysql<br>    ports:<br>      - 3307:3306<br>    environment:<br>      MYSQL_ROOT_PASSWORD: root<br>      MYSQL_DATABASE: magento2<br>      MYSQL_USER: magento2<br>      MYSQL_PASSWORD: magento2<br>    networks:<br>      - appnet<br><br>volumes:<br>  db_data:<br>    driver: &quot;local&quot;<br><br>networks:<br>  appnet:<br>    driver: &quot;bridge&quot;</pre><p><strong>Note</strong>: Magento needs to be downloaded in the magento2 directory in the same folder where the docker-compose.yml is present. This volume is mounted within the containers as we do not want the data to be destroyed in case the containers are recreated.</p><p>To fetch Magento 2 without running platform requirements check (since the platform requirements would be installed on container):</p><pre>composer create-project --repository=https://repo.magento.com/ magento/project-community-edition magento2 --ignore-platform-reqs</pre><h3>Build &amp; Start</h3><p>To build the above docker services run docker-compose build</p><p>Once the build is successful start the containers with docker-compose up -d</p><p>-d starts docker services in detached mode.</p><h3>Push to Docker Hub</h3><p>In order to use these images on your production server. You need to signup on <a href="https://www.docker.com/">Docker Hub</a>.</p><p>You can then push your services to Docker using: docker-compose push this will push the images to the name specified in image tag in docker-compose.yml</p><p>You can find the complete code in the repository <a href="https://gitlab.com/fotonicia/magento2-docker">here</a>.</p><h3>References</h3><p><a href="https://rocketweb.com/blog/running-magento-2-inside-a-container">https://rocketweb.com/blog/running-magento-2-inside-a-container</a></p><p><a href="https://cloudkul.com/blog/magento-2-docker-compose/">https://cloudkul.com/blog/magento-2-docker-compose/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a10cda399d72" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fotonicia/magento-2-on-container-a10cda399d72">Magento 2 on container</a> was originally published in <a href="https://medium.com/fotonicia">Fotonicia</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Gitlab CI with Instrumentation Tests]]></title>
            <link>https://medium.com/fotonicia/gitlab-ci-with-instrumentation-tests-bbd702abb53?source=rss----c3df5af66c7b---4</link>
            <guid isPermaLink="false">https://medium.com/p/bbd702abb53</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[espresso]]></category>
            <category><![CDATA[gitlab]]></category>
            <category><![CDATA[gitlab-ci]]></category>
            <dc:creator><![CDATA[Ankit Gupta]]></dc:creator>
            <pubDate>Mon, 10 Jun 2019 06:10:56 GMT</pubDate>
            <atom:updated>2023-06-11T09:28:36.830Z</atom:updated>
            <content:encoded><![CDATA[<p>This post is in continuation with the previous <a href="https://medium.com/@mailtoankitgupta/gitlab-ci-with-android-and-fabric-9d21167cf39">post</a> on deploying of artifacts to Fabric via Gitlab Pipeline.</p><p>The debugTests task in the Gitlab Pipeline in previous post only had unit tests. On any real Android project you would want to <a href="https://medium.com/@mailtoankitgupta/writing-espresso-tests-in-android-d83696528aeb">write down UI tests</a> or instrumentation tests as well which can be integrated with your build process on Gitlab.</p><p>While unit tests can be run on a shared runner on CI/CD of Gitlab, the instrumentation tests require hardware acceleration which is not available on shared runners (as of now). So, the option one has is to configure your own machine as a runner that Gitlab can use to run CI/CD.</p><p>Thanks to this <a href="https://medium.com/@shepeliev/setting-up-gitlab-ci-for-android-project-2e1082f431a2">post</a>, I used my spare linux desktop* as Gitlab Runner. Below is my .gitlab.yml section that I am using for instrumentation tests.</p><pre><strong>instrumentationTests</strong>:<br>  <strong>stage</strong>: test<br>  <strong>tags</strong>:<br>    - android # tag with which our runner is started<br>  <strong>before_script</strong>:<br>    - <strong>&#39;&#39;<br>  image</strong>: shepeliev/android-sdk<br>  <strong>script</strong>:<br>    - /opt/start-default-emulator.sh<br>    <em># Turn off animation<br></em>    - adb shell settings put global window_animation_scale 0<br>    - adb shell settings put global transition_animation_scale 0<br>    - adb shell settings put global animator_duration_scale 0<br>    <em># Turn off google auto-fill<br>    </em>- adb shell settings put secure autofill_service null<br>    - ./gradlew cAT<br>  <strong>only</strong>:<br>    - /^master$/</pre><p>Few things to note:</p><ol><li>I am using the tag android for the runner that I created.</li><li>I have left the before_script empty since rest of my yaml script sets up the android sdk and platform tools dynamically.</li><li>I am using the pre-built image shepelieve/android-sdk for the an emulator running API 28 on Pixel 2.</li><li>Most tests require you to turn off the animations before running your UI tests so the adb shell settings commands are for those</li><li>Lastly, the google auto-fill creates problems during the test execution for my test cases, so I have turned those off as well.</li></ol><ul><li>you may need to enable virtualization in your BIOS before being able to run the emulator. Use kvm-ok to check whether hardware acceleration is enabled or not.</li></ul><p>If you liked this, connect with me on <a href="https://www.linkedin.com/in/ankitgupta90/">LinkedIn</a> or <a href="https://twitter.com/_AnkitGupta">Twitter</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bbd702abb53" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fotonicia/gitlab-ci-with-instrumentation-tests-bbd702abb53">Gitlab CI with Instrumentation Tests</a> was originally published in <a href="https://medium.com/fotonicia">Fotonicia</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>