<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Samuel Andreo</title>
    <description>The latest articles on Forem by Samuel Andreo (@samuanv).</description>
    <link>https://forem.com/samuanv</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F106722%2F3c84249e-2bdf-4448-955c-75af9d5cd380.jpeg</url>
      <title>Forem: Samuel Andreo</title>
      <link>https://forem.com/samuanv</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/samuanv"/>
    <language>en</language>
    <item>
      <title>Dockerized PHP application with SSL</title>
      <dc:creator>Samuel Andreo</dc:creator>
      <pubDate>Mon, 03 Dec 2018 14:43:12 +0000</pubDate>
      <link>https://forem.com/samuanv/dockerized-php-application-with-ssl-3a38</link>
      <guid>https://forem.com/samuanv/dockerized-php-application-with-ssl-3a38</guid>
      <description>&lt;p&gt;Hello everyone!&lt;/p&gt;

&lt;p&gt;I am migrating an old system I developed some years ago to a containerized environment and I need some help with SSL to serve it through HTTPS. My knowledge about this topic is quite low.&lt;/p&gt;

&lt;p&gt;The system is composed by two containers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Frontend. AngularJS app served above a NGINX image.&lt;/li&gt;
&lt;li&gt;Backend. PHP API REST served above the image &lt;a href="https://github.com/docker-library/php/blob/c77c579341cfbfee90e669535ea3057679a1005b/5.6/stretch/apache/Dockerfile"&gt;php:5.6-apache&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Both containers are running in a EC2 instance orchestated by Docker Swarm. The instance is linked to a domain. I know that I could get a certificate from &lt;a href="https://letsencrypt.org/"&gt;Let's Encrypt&lt;/a&gt; but my questions are the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Should I use the same certificate for the frontend and the backend (both in same domain but different ports)?&lt;/li&gt;
&lt;li&gt;Is there a way to renew it automatically or integrate it in my pipeline? Or what is the way to deal with this in a container environment.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Finally, if anyone have read something explaining this, please write it in the comments :)&lt;/p&gt;

&lt;p&gt;Many thanks for your help!&lt;/p&gt;

</description>
      <category>help</category>
      <category>php</category>
      <category>docker</category>
      <category>ssl</category>
    </item>
    <item>
      <title>Tracking and saving updates in a collection in MongoDB</title>
      <dc:creator>Samuel Andreo</dc:creator>
      <pubDate>Tue, 30 Oct 2018 11:30:52 +0000</pubDate>
      <link>https://forem.com/samuanv/tracking-and-saving-updates-in-a-collection-in-mongodb-25e7</link>
      <guid>https://forem.com/samuanv/tracking-and-saving-updates-in-a-collection-in-mongodb-25e7</guid>
      <description>&lt;p&gt;Hello everyone! I am Samuel and I am a young web developer. Actually I am working in a project to help my family's business. &lt;br&gt;
The system is about access control to a vehicle with QR codes. It is composed by a web application (Angular6), mobile application (Ionic3) and REST API (NodeJS) connected to a noSQL DB (MongoDB).&lt;/p&gt;

&lt;p&gt;One of my collections is Reservations and the document is structured as follows:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;{&lt;br&gt;
    _id: number,&lt;br&gt;
    serviceId: number,&lt;br&gt;
    datetimePaid: Date,&lt;br&gt;
    responsible: Person,&lt;br&gt;
    state: string,&lt;br&gt;
    tickets: Tickets[],&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;And Tickets is something like:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;{&lt;br&gt;
    price: number,&lt;br&gt;
    passenger: Person,&lt;br&gt;
    roundtrip: boolean&lt;br&gt;
}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;A reservation could be modified by users with differente roles (with higher or lower privileges) but I need to track whenever an user has modified some field of the document to give the administrator a good way to solve possible problems.&lt;br&gt;
The operations or fields that could be updated are: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;datetimePaid&lt;/li&gt;
&lt;li&gt;responsible (replace it with another Person)&lt;/li&gt;
&lt;li&gt;state&lt;/li&gt;
&lt;li&gt;tickets[i].passenger&lt;/li&gt;
&lt;li&gt;Add or remove elements from the tickets array&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I haven't find any native solution provided by MongoDB to it, and I have couple of ideas but I would like to hear your strategies or ways to do it.&lt;/p&gt;

&lt;p&gt;Many thanks in advance&lt;/p&gt;

</description>
      <category>mongodb</category>
      <category>db</category>
      <category>nosql</category>
      <category>help</category>
    </item>
  </channel>
</rss>
