<?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 Yosep Novento Nugroho on Medium]]></title>
        <description><![CDATA[Stories by Yosep Novento Nugroho on Medium]]></description>
        <link>https://medium.com/@yosepnoventon?source=rss-5ecd23183256------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*MEGrkdjUjgup7l-CqXzlFA.jpeg</url>
            <title>Stories by Yosep Novento Nugroho on Medium</title>
            <link>https://medium.com/@yosepnoventon?source=rss-5ecd23183256------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 07:51:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@yosepnoventon/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[Public Key Infrastructure Crash Course with OpenSSL]]></title>
            <link>https://medium.com/@yosepnoventon/public-key-infrastructure-crash-course-with-openssl-d69d43fbcfbf?source=rss-5ecd23183256------2</link>
            <guid isPermaLink="false">https://medium.com/p/d69d43fbcfbf</guid>
            <dc:creator><![CDATA[Yosep Novento Nugroho]]></dc:creator>
            <pubDate>Fri, 11 Apr 2025 03:16:47 GMT</pubDate>
            <atom:updated>2025-04-11T07:50:15.692Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is Cryptography?</h3><p>Cryptography is the science of securing information so that only intended parties can understand it. It protects data <em>at rest</em> and <em>in transit</em> using mathematical techniques.</p><p>Let’s look at the three components of it:</p><h4>Encryption</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MJwEv63hD9Udy0Lr" /></figure><p><strong>Encryption</strong> is the process of converting readable information, known as <strong>plaintext</strong>, into an unreadable format called <strong>ciphertext</strong>. This transformation is performed using a specific algorithm and a <strong>key</strong>.</p><p>The primary goal of encryption is to protect data confidentiality. Even if someone intercepts the data, they will not be able to understand its contents without the appropriate key.</p><pre>Hello → [Encrypt with Key] → sfl23j23#@1$@ (Ciphertext)</pre><h4>Decryption</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*h1FR9h_9tttf8Q8P" /></figure><p><strong>Decryption</strong> is the reverse of encryption. It involves converting <strong><em>ciphertext</em></strong> back into its original <strong><em>plaintext</em></strong> form using a key.</p><p>Only parties with the correct key should be able to decrypt and read the data.</p><pre>sfl23j23#@1$@ → [Decrypt with Key] → Hello</pre><h4>Key</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4jXPJ_Bhqf1Dt2Ii" /></figure><p>A <strong>key</strong> is a piece of information (often a long string of bits) used by a cryptographic algorithm to transform plaintext into ciphertext and vice versa.</p><p>The <strong>strength</strong> of encryption depends on both the algorithm used and the length and randomness of the key. Keys must be kept secure — if a key is compromised, so is the data it protects.</p><h3>Symmetric Cryptosystems</h3><p>A <strong>symmetric cryptosystem</strong> is a type of encryption in which the <em>same</em> secret key is used for both <strong>encryption</strong> and <strong>decryption</strong> of data. The sender and receiver must both possess this key and keep it confidential.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*f0y4bzseLzsf4h_bNSlI3g.png" /></figure><p>We use the same <strong><em>key</em></strong> both for encryption and for decryption. This is why these approaches are symmetric. So we use the same key both for encryption and for decryption.</p><p>Symmetric cryptosystems use just <strong><em>a single key</em></strong> both for encryption and for decryption as well</p><p><strong><em>THIS IS WHY IT IS CALLED PRIVATE KEY CRYPTOSYSTEM OR SYMMETRIC CRYPTOSYSTEM !!!</em></strong></p><p>We can use a key in order to generate the cipher text. And we can use the same key in order to generate the plaintext from the cipher text.</p><p>Disadvantages of this approach:</p><ul><li>The main problem is that this <strong><em>private key must be exchanged</em></strong> and there are a huge number of keys in a network of users.</li></ul><p>Symmetric encryption is often used when:</p><ul><li><strong>Speed</strong> is essential: symmetric algorithms are generally faster and more efficient than asymmetric ones.</li><li><strong>The communication is between trusted parties</strong>: where secure key exchange is feasible (e.g., internal systems, secure file storage, VPN tunnels).</li></ul><p>Examples:</p><ul><li><strong>Encrypting local data</strong> at rest (e.g., database fields, files, backups).</li><li><strong>Securing communication</strong> over a private channel.</li><li><strong>Streaming media encryption</strong> where performance is a priority.</li></ul><p>Algorithm that uses symmetric cryptosystem / private keys:</p><ul><li>Caesar cipher</li><li>Vigenere cipher</li><li>Data Encryption Standard</li><li>Advanced Encryption Standard</li></ul><p>Caveat:</p><ul><li>If we use symmetric cryptosystems, then we have to use an extremely large amount of unique private keys. That is not the best approach possible. This is why we can use different keys for encryption and for decryption. And this how we can reduce the number of keys in the network. And this is exactly what happens with cryptocurrencies.</li></ul><h3>Asymmetric Cryptosystems</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*pBeCJnbXxhu7cmQYmUmBpg.png" /></figure><p>An <strong>asymmetric cryptosystem</strong> (also known as <strong>public-key cryptography</strong>) uses a <strong>pair of cryptographic keys</strong>:</p><ul><li>A <strong>public key</strong>, which can be shared openly.</li><li>A <strong>private key</strong>, which must be kept secret.</li></ul><p>Key principle:</p><ul><li>What one key encrypts, only the other key can decrypt.</li></ul><p>Summary:</p><ul><li>We must keep the <strong>private key</strong> private.</li><li>The <strong>public key</strong> is known to anyone in the network</li><li>If <strong>Vento</strong> wants to send a message to <strong>Deco</strong> then <strong>Vento</strong> encrypts the message with <strong>Deco’s</strong> public key and Deco can decrypt the message with his own private key.</li></ul><p>Asymmetric cryptography solves the <strong>key distribution problem</strong> found in symmetric systems. It is commonly used in scenarios where secure key exchange and identity verification are critical.</p><p>Common use cases include:</p><ul><li><strong>Secure key exchange</strong> (e.g., TLS/SSL)</li><li><strong>Digital signatures</strong> (e.g., document verification, software integrity)</li><li><strong>Authentication and identity</strong> (e.g., SSH login, JWT tokens)</li><li><strong>Certificate-based trust models</strong> (e.g., Public Key Infrastructure)</li></ul><h3>How to Generate Private Key and Public Key using OpenSSL</h3><p>Before we look at OpenSSL commands, it’s important to understand <strong>what</strong> you’re generating — and <strong>why</strong> the algorithm matters.</p><h4>RSA (Rivest–Shamir–Adleman) Cryptosystem</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/675/0*yFXXpPG-pKg3onuO.png" /><figcaption><a href="https://samsclass.info/141/proj/C402a.htm">https://samsclass.info/141/proj/C402a.htm</a></figcaption></figure><p>RSA is one of the earliest and most well-established public-key cryptographic algorithms. It is based on the mathematical challenge of factoring large prime numbers.</p><p>RSA’s security depends on the difficulty of factoring the product of <strong><em>two large prime numbers</em></strong>. The private and public keys are mathematically linked, and key sizes typically range from <strong>2048 to 4096 bits</strong> for strong security.</p><p><strong><em>Caveats</em></strong></p><ul><li><strong>Performance</strong>: RSA is relatively <strong>slow</strong> and is generally used to encrypt small payloads (e.g., symmetric keys, hashes).</li><li><strong>Key size</strong>: Requires <strong>larger keys</strong> than ECC for equivalent security. For example, RSA-2048 offers roughly the same security level as ECC with a 224-bit key.</li><li><strong>Quantum threat</strong>: RSA is more vulnerable to future quantum attacks than ECC (e.g., Shor’s algorithm).</li></ul><p><strong><em>Generate RSA Key Pair using OpenSSL</em></strong></p><pre>// to generate the private key<br>$ openssl genrsa -out rsa-key.pem 2048<br><br>// check the private key base64 encoded value<br>$ cat rsa-key.pem<br>-----BEGIN PRIVATE KEY-----<br>MIICdgIBADANBgkqhkiG.......<br>-----END PRIVATE KEY-----<br><br><br>// generate public key<br>$ openssl rsa -in rsa-key.pem -pubout -out rsa-pub.pem<br><br>// check public key base64 encoded value<br>$ cat rsa-pub.pem<br>-----BEGIN PUBLIC KEY-----<br>MIIBIj.......<br>-----END PUBLIC KEY-----<br><br>// to check the private key details components<br>$ openssl rsa -text -in rsa-key.pem -noout<br>Private-Key: (2048 bit, 2 primes)<br>modulus:<br>    00:e3:...<br>publicExponent: 65537 (0x10001)<br>privateExponent:<br>    28:29:...<br>prime1:<br>    00:fe:...<br>prime2:<br>    00:e5:...<br>exponent1:<br>    53:73:...<br>exponent2:<br>    00:82:...<br>coefficient:<br>    00:81:...</pre><p><strong><em>Data communication using RSA</em></strong></p><pre>// create dummy data<br>$ echo &quot;Hello World&quot; &gt; input.txt<br><br>// encrypt data using public key<br>$ openssl pkeyutl -encrypt -inkey rsa-pub.pem -pubin -in input.txt -out encrypted-file.txt<br><br>// check encrypted data<br>$ cat encrypted-file.txt<br>Y&#39;�].....<br><br>// decrypt data using private key<br>$ openssl pkeyutl -decrypt -inkey rsa-key.pem -in encrypted-file.txt -out result.txt<br><br>// check decrypted data<br>$ cat result.txt<br>Hello World</pre><h4>Elliptic Curve Cryptography (ECC)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/354/0*HLgDOdL18QCCT9Sj.jpeg" /><figcaption><a href="https://blog.cloudflare.com/a-relatively-easy-to-understand-primer-on-elliptic-curve-cryptography/">https://blog.cloudflare.com/a-relatively-easy-to-understand-primer-on-elliptic-curve-cryptography/</a></figcaption></figure><p>ECC is a modern public-key cryptography system based on the algebraic structure of <strong>elliptic curves</strong> over finite fields. It achieves similar levels of security to RSA but with <strong>much smaller key sizes</strong> and <strong>better performance</strong>.</p><p>Instead of relying on prime factorization, ECC relies on the <strong>Elliptic Curve Discrete Logarithm Problem</strong>, which is computationally hard to solve.</p><h4>Caveats</h4><ul><li><strong>Implementation complexity</strong>: ECC is more difficult to implement correctly, and poor implementation can lead to vulnerabilities.</li><li><strong>Interoperability</strong>: Not all systems or protocols support ECC, although adoption is growing.</li><li><strong>Curve choice</strong>: You must carefully choose a <strong>trusted curve</strong> (e.g., prime256v1, secp384r1). Some curves are deprecated or considered insecure.</li></ul><p><strong><em>Generate ECC Key Pair using OpenSSL</em></strong></p><pre>// to generate the private key<br>$ openssl ecparam -genkey -name prime256v1 -out ecc-key.pem<br><br>// check the private key base64 encoded value<br>$ cat ecc-key.pem<br>-----BEGIN EC PARAMETERS-----<br>Bggq.....<br>-----END EC PARAMETERS-----<br>-----BEGIN EC PRIVATE KEY-----<br>MHcC....<br>-----END EC PRIVATE KEY-----<br><br>// generate public key<br>$ openssl ec -in ecc-key.pem -pubout -out ecc-pub.pem<br><br>// check public key base64 encoded value<br>$ cat ecc-pub.pem<br>-----BEGIN PUBLIC KEY-----<br>MIIBIj.......<br>-----END PUBLIC KEY-----<br><br>// to check the private key details components<br>$ openssl ec -in ecc-key.pem -text --noout<br>read EC key<br>Private-Key: (256 bit)<br>priv:<br>    8c:b6:...<br>pub:<br>    04:66:...<br>ASN1 OID: prime256v1<br>NIST CURVE: P-256<br><br></pre><p><strong><em>Data communication using ECC</em></strong></p><p>ECC (Elliptic Curve Cryptography) is not typically used for direct encryption. Instead, it is commonly used to <strong>establish a shared secret key</strong> (e.g., for AES) between the sender and receiver. This shared key is then used for actual encryption and decryption. In most use cases, ECC is primarily employed for <strong>digital signatures</strong>, where the goal is to verify the sender’s identity rather than encrypt data directly.</p><p>Let’s break for some time and criticize the article above, we will have a lot of questions, right? Some of them are</p><ol><li>What is PEM?</li></ol><p><strong><em>PEM (Privacy Enhanced Mail)</em></strong> format refers to the base64 wrapper for a binary format contained within but does not specify any type of format for the binary data so that a PEM file may contain almost anything base64 encoded and wrapped with BEGIN and END lines.</p><p>2. Why does AES use a public key to encrypt the data? and not using the private key?</p><p>Actually it depends on the main goals. Let’s break it down:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/845/1*WoFROiYT1BQUEZs1TYp7EA.png" /></figure><p>So, when someone encrypts a message with your <strong>public key</strong>, only you can decrypt it with your <strong>private key</strong>. This is useful for <strong>secure key exchange</strong> and <strong>identity verification</strong>. So, now it matters to know about the confidentiality of the sender, and how we prove it. The term of identity verification is usually we can call it certificate. What is Certificate then?</p><h3>Certificates</h3><h4>What is a Certificate?</h4><p>A <strong>digital certificate</strong> is a cryptographically signed document that <strong>binds a public key to an entity</strong> (such as a person, organization, or website). It ensures that the public key <strong>belongs</strong> to that entity and hasn’t been tampered with.</p><p>In simpler terms:</p><blockquote><em>A certificate acts like a </em><strong><em>digital passport</em></strong><em> that proves the </em><strong><em>identity</em></strong><em> of someone (or something) and securely shares their </em><strong><em>public key</em></strong><em>.</em></blockquote><p>Certificates are typically issued by a <strong>Certificate Authority (CA)</strong> and follow the <strong>X.509 standard</strong>.</p><p>Certificates in a public key cryptosystem, every member of the network has 2 keys: <strong><em>public key</em></strong> and <strong><em>private key.</em></strong></p><p><strong><em>OTHERS CAN USE MY PUBLIC KEY TO ENCRYPT A MESSAGE THAT CAN BE DECRYPTED BY MY PRIVATE KEY!!!</em></strong></p><p>and we can use public and private keys for <strong><em>digital signature algorithms</em></strong> (verify that a given message belongs to a given user in the network).</p><h4>Why do We Need a Certificate?</h4><p>We could identify the members of the network with public keys exclusively — but sometimes we need additional information (and it adds another layer of security)</p><p>A public key certificate is a digitally signed document that serves to validate the sender’s authorization and name.</p><p><strong><em>A CERTIFICATE IS GENERATED AND ISSUED BY A TRUSTED THIRD PARTY (CERTIFICATE AUTHORITY)</em></strong></p><p>It uses a cryptographic structure that binds a public key to an entity such as a user or organization.</p><h3>Real-World Example</h3><p>Let’s say you visit https://medium.com. Your browser checks the certificate presented by the website to ensure:</p><ul><li>It was issued by a <strong>trusted CA</strong> (like Let’s Encrypt, DigiCert, etc.)</li><li>It is <strong>still valid</strong> (not expired or revoked).</li><li>The certificate’s <strong>domain name</strong> matches the site you’re visiting.</li><li>It has not been <strong>tampered with</strong> (validated by the signature).</li></ul><p>If all checks pass, the connection is marked secure.</p><h3>Root Certificate</h3><p>A <strong><em>root certificate</em></strong> is a public key certificate that identifies the root certificate authority (CA).</p><p><strong><em>A ROOT CERTIFICATE IS SELF-SIGNED SO THE SIGNATURE IS GENERATED BY ITS OWN PRIVATE KEY !!!</em></strong></p><p>So we can verify these certificates by their own public keys — essentially <strong>we trust these certificates by default</strong> (Apple, Google, Komdigi, etc.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/338/1*JpTjuKsbH7VoK05Inzl8mA.png" /></figure><p>Because the root certificate is self-signed, so it will sign the certificate using its own private key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/338/1*uCPQhfKqvqzNdQzExBXKoQ.png" /></figure><p>And we can verify the certificate validation using their own public key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/389/1*c93KRWU7zNXRfBOZGa4wgg.png" /></figure><h4>Intermediate Certificate</h4><p>An intermediate certificate is a public key certificate that is signed and accepted by a certificate authority (CA)</p><p><strong><em>AN INTERMEDIATE CERTIFICATE IS SIGNED BY A ROOT CERTIFICATE !!!</em></strong></p><p>so we can verify these certificates by the public keys of the issuers (root certificates)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*MH8_rQTIXM6FEbVynMAxXg.png" /></figure><p>To sign the intermediate certificate we need to use private key issuer (root certificate) and give some details like distinguished name (organization name, person name, location, etc.) also the public key itself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/1*4m9sEjMESXAT5j4vh1NREQ.png" /></figure><p>Then we can verify the validity of the intermediate certificate using the root certificate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/1*CE4SqiW3p8zfv_68gk8qVA.png" /></figure><h3>How to Create Root and Intermediate a Certificate?</h3><h4>Create a Root Certificate (Self-Signed) using OpenSSL</h4><pre><br>// create ca private key<br>$ openssl genrsa -out ca-key.pem 2048<br><br>// create certificate configuration<br>$ vi certificate.conf<br>```code<br>distinguished_name = req_distinguished_name<br>x509_extensions = v3_extensions<br>prompt = no<br><br>[ req_distinguished_name ]<br>countryName = ID<br>stateOrProvinceName = Jakarta<br>localityName = Jakarta<br>organizationName = GoTo<br>organizationalUnitName = GoTo<br>commonName = ventodeco-root.my.id<br><br>[ v3_extensions ]<br>subjectKeyIdentifier = hash<br># copies the subject key identifier (or if it fails then it uses the issuer and serial number)<br>authorityKeyIdentifier = keyid:always<br># whether the certificate is a root or not<br>basicConstraints = critical, CA:TRUE, pathlen:2<br># key usage - use the certificate for signing or key encipherment<br>keyUsage = keyCertSign, digitalSignature, keyEncipherment<br>```<br><br>// generate certificate<br>$ openssl req -x509 -sha256 -days 365 -key ca-key.pem -out ca-root-cert.pem -config certificate.conf<br><br>// Check certificate details<br>$ openssl x509 -in ca-root-cert.pem -text -noout<br>Certificate:<br>    Data:<br>        Version: 3 (0x2)<br>        Serial Number:<br>            44:86:...<br>        Signature Algorithm: sha256WithRSAEncryption<br>        Issuer: C=ID, ST=Jakarta, L=Jakarta, O=GoTo, OU=GoTo, CN=ventodeco-root.my.id<br>        Validity<br>            Not Before: Apr 11 06:20:19 2025 GMT<br>            Not After : Apr 11 06:20:19 2026 GMT<br>        Subject: C=ID, ST=Jakarta, L=Jakarta, O=GoTo, OU=GoTo, CN=ventodeco-root.my.id<br>        Subject Public Key Info:<br>            Public Key Algorithm: rsaEncryption<br>                Public-Key: (2048 bit)<br>                Modulus:<br>                    00:a7:....<br>                Exponent: 65537 (0x10001)<br>        X509v3 extensions:<br>            X509v3 Subject Key Identifier:<br>                DA:43:...<br>            X509v3 Authority Key Identifier:<br>                DA:43:...<br>            X509v3 Basic Constraints: critical<br>                CA:TRUE, pathlen:2<br>            X509v3 Key Usage:<br>                Digital Signature, Key Encipherment, Certificate Sign<br>    Signature Algorithm: sha256WithRSAEncryption<br>    Signature Value:<br>        77:e6:....<br><br>// Since this is self signed, we can verify it with same file<br>$ openssl verify -CAfile ca-root-cert.pem ca-root-cert.pem<br>```output<br>ca-root-cert.pem: OK<br><br></pre><h4>Create an Intermediate Certificate</h4><pre>// create ca private key<br>$ openssl ecparam -genkey -name prime256v1 -out ecc-key.pem<br><br>// create CSR configuration<br>$ vi certificate-csr.conf<br>```code<br>[ req ]<br>distinguished_name = req_distinguished_name<br>prompt = no<br><br>[ req_distinguished_name ]<br>countryName = ID<br>stateOrProvinceName = Wonogiri<br>localityName = Wonogiri<br>organizationName = Mi Ayam Wonogiri Uyee!!!<br>organizationalUnitName = Mi Ayam Wonogiri Uyee!!<br>commonName = ventodeco-intermediate.my.id<br>```<br><br>// create CSR<br>$ openssl req -key ecc-key.pem -new -out ecc-inter-cert-csr.pem -config certificate-csr.conf<br><br><br>// check details of CSR<br>$ openssl req -in ecc-inter-cert-csr.pem -text<br><br>// generate certificate using root private key<br>$ openssl x509 -req -CA ca-root-cert.pem -CAkey ca-key.pem -in ecc-inter-cert-csr.pem -out intermediate-cert.pem -days 365<br><br><br>// Check intermediate certificate details<br>$ openssl x509 -in intermediate-cert.pem -text -noout<br>Certificate:<br>    Data:<br>        Version: 3 (0x2)<br>        Serial Number:<br>            28:88:....<br>        Signature Algorithm: sha256WithRSAEncryption<br>        Issuer: C=ID, ST=Jakarta, L=Jakarta, O=GoTo, OU=GoTo, CN=ventodeco-root.my.id<br>        Validity<br>            Not Before: Apr 11 06:44:09 2025 GMT<br>            Not After : Apr 11 06:44:09 2026 GMT<br>        Subject: C=ID, ST=Wonogiri, L=Wonogiri, O=Mi Ayam Wonogiri Uyee!!!, OU=Mi Ayam Wonogiri Uyee!!, CN=ventodeco-intermediate.my.id<br>        Subject Public Key Info:<br>            Public Key Algorithm: id-ecPublicKey<br>                Public-Key: (256 bit)<br>                pub:<br>                    04:2d:...<br>                ASN1 OID: prime256v1<br>                NIST CURVE: P-256<br>        X509v3 extensions:<br>            X509v3 Subject Key Identifier:<br>                2F:B3:...<br>            X509v3 Authority Key Identifier:<br>                DA:43:...<br>    Signature Algorithm: sha256WithRSAEncryption<br>    Signature Value:<br>        32:17:...<br><br>// Since this is intermediate certificate, we need to verify it with root certificate<br>$ openssl verify -CAfile ca-root-cert.pem ca-root-cert.pem<br>```output<br>intermediate-cert.pem: OK</pre><h3>Chain of Trust</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*n-HSc4A-bJbmZ7jI.png" /><figcaption><a href="https://en.wikipedia.org/wiki/Chain_of_trust">https://en.wikipedia.org/wiki/Chain_of_trust</a></figcaption></figure><p>The <strong>Chain of Trust</strong> is a hierarchical model used to validate digital certificates. It starts with a <strong>trusted Root Certificate Authority (CA)</strong> and ends with an <strong>end-entity certificate</strong> (e.g., a website’s SSL/TLS cert / User). Each certificate in the chain is signed by the private key of the certificate above it in the hierarchy.</p><p>So basically we don’t directly trust in the <strong><em>end-entity certificate</em></strong>. Instead, we trust the <strong><em>root certificate</em></strong>, which is explicitly trusted and stored in our system’s trust store.</p><p>We then use the <strong>root certificate’s public key</strong> to verify the signature of the <strong>intermediate certificate</strong>. If the verification is successful, we can trust the intermediate certificate.</p><p>Next, we use the <strong>intermediate certificate’s public key</strong> to verify the <strong>end-entity certificate</strong>.</p><p>In this way, trust is established step-by-step, forming a verifiable chain — from the root, through intermediates, down to the end entity — hence the name <strong>“chain of trust.”</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d69d43fbcfbf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is PAdES?]]></title>
            <link>https://medium.com/@yosepnoventon/what-is-pades-3fb62f0973d1?source=rss-5ecd23183256------2</link>
            <guid isPermaLink="false">https://medium.com/p/3fb62f0973d1</guid>
            <category><![CDATA[digital-signature-online]]></category>
            <category><![CDATA[pades]]></category>
            <dc:creator><![CDATA[Yosep Novento Nugroho]]></dc:creator>
            <pubDate>Mon, 24 Feb 2025 02:22:56 GMT</pubDate>
            <atom:updated>2025-02-24T02:22:56.206Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="What is PAdES?" src="https://cdn-images-1.medium.com/max/1024/1*wOJv0XRHBt0zGMIEKJ7I_w.jpeg" /></figure><p>PAdES (PDF Advanced Electronic Signatures) is a set of standards for creating secure, legally binding electronic signatures on PDF documents. It’s part of the broader ETSI (European Telecommunications Standards Institute) standards for electronic signatures and is designed specifically to ensure that signed PDFs remain valid and secure over time.</p><p><strong><em>Key Aspects of PAdES Signing:</em></strong></p><p><strong>Legal Compliance</strong>: PAdES is compliant with European Union eIDAS regulations, which provide a legal framework for electronic signatures. This makes PAdES signatures legally binding across the EU.</p><p><strong>Long-Term Validation</strong>: PAdES includes support for long-term validation (LTV), which ensures that the electronic signatures remain valid for years, even if the certificate used to sign the document expires or is revoked. This involves embedding time stamps and validation data within the document.</p><p><strong>Different Levels</strong>: PAdES has several levels, each with increasing levels of security:</p><ul><li><strong>PAdES-BES</strong> (Basic Electronic Signature): Basic level, which verifies the signature but doesn’t include additional time stamps.</li><li><strong>PAdES-EPES</strong> (Explicit Policy Electronic Signature): Similar to BES but includes an explicit policy that specifies signing requirements.</li><li><strong>PAdES-LTV</strong> (Long-Term Validation): Ensures the signature is valid over a long period by embedding time stamps and validation info.</li><li><strong>PAdES-A</strong> (Archival): Provides maximum preservation of the signed PDF, even as technology evolves.</li></ul><p><strong>Tamper-Proof</strong>: Like most digital signatures, PAdES signatures are tamper-evident, meaning any changes to the document after signing will invalidate the signature.</p><p><strong>Use Cases</strong>: PAdES is widely used in various sectors, including finance, government, and legal industries, where documents need to be secure, traceable, and legally valid over time.</p><p>Overall, PAdES signing is ideal for securing important documents that require long-term retention and compliance with legal standards.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3fb62f0973d1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Glimpse of Engineering BootCamp GoTo Financial]]></title>
            <link>https://medium.com/@yosepnoventon/a-glimpse-of-engineering-bootcamp-goto-financial-b8dd5833c820?source=rss-5ecd23183256------2</link>
            <guid isPermaLink="false">https://medium.com/p/b8dd5833c820</guid>
            <dc:creator><![CDATA[Yosep Novento Nugroho]]></dc:creator>
            <pubDate>Sun, 20 Nov 2022 10:30:37 GMT</pubDate>
            <atom:updated>2022-11-20T10:30:37.235Z</atom:updated>
            <content:encoded><![CDATA[<p>Hi, I’m Yosep Novento Nugroho, and you can call me Vento. Here, I want to share a glimpse of the engineering BootCamp held by GoTo Financial.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6iH2Uiy8cgDqgsEk9gzatg.jpeg" /><figcaption>Engineering Bootcamp GoTo Financial Batch 03</figcaption></figure><p>This Bootcamp is held for new employees from Goto Financial and lasts for 1 month and 2 weeks, with a composition of the core engineering module and the DevOps module.</p><p><strong>Core Engineering Module</strong></p><p>In Core Engineering Module, we learn more deeply about coding in a disciplined manner. An example is doing git commits as often as possible with predetermined specifications. Besides that, we also learn about BDD (Behavior Driven Development).</p><p>BDD (Behavior Driven Development) is an agile software development process that encourages collaboration among developers, quality assurance experts, and customer representatives in a software project.</p><p>On BDD, we need to make a unit test first with the simplest thing to handle, and after that, we need to make a logic with the dumbest solution that fulfills the unit test. We need to repeat those things until all specifications for the product are fulfilled. So in the end we produce the simplest code that handles all of the specifications. In my opinion, BDD is the best thing that I have learned so far because we have documented the spec on the commit message, so when we have something else to do and go back to that code, we can just read the commit message and continue the progress. Cool, right?</p><p><strong>DevOps Module</strong></p><p>In DevOps Module, we learn more about how we can deliver our code to production the hard way using a manual provision in Vagrant. After that, we learn how to use an ansible playbook to make it easier if there are many VM that we want to provision.</p><p>We also learn about docker to prepare the environment that the code needed for running. We also learn about:</p><ul><li>Dockerfile describes how to <em>create</em> and <em>build</em> a Docker image</li><li>docker-compose is a command that runs Docker containers based on settings described in a <em>docker-compose.yaml</em> file</li><li>Kubernetes, also known as K8s, is an open-source system for automating the deployment, scaling, and management of containerized applications.</li><li>Helm</li><li>CI/CD</li><li>Observability</li></ul><p>And many more.</p><p>From this Bootcamp, I learned a lot. First I was forced to use English during the Bootcamp because this company is a multinational company. So, like it or not we have to be fluent in English.</p><p>Apart from that, there are many other things, namely the way of thinking in dealing with a problem. And here I get acquainted with what is called a logical fallacy in arguing. Also, learn about how we articulate arguments so that our colleagues understand what we want to do in dealing with a problem.</p><p>I think that’s all that I can share about this program. And I think you that read this article, maybe is the person that will walk on this program. Fighting!!!</p><p>Thank you!!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b8dd5833c820" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Explain Blockchain as Simple as Possible]]></title>
            <link>https://medium.com/@yosepnoventon/how-i-explain-blockchain-as-simple-as-possible-96b5e473e06?source=rss-5ecd23183256------2</link>
            <guid isPermaLink="false">https://medium.com/p/96b5e473e06</guid>
            <category><![CDATA[blockchain]]></category>
            <dc:creator><![CDATA[Yosep Novento Nugroho]]></dc:creator>
            <pubDate>Wed, 02 Nov 2022 23:29:58 GMT</pubDate>
            <atom:updated>2022-11-03T01:25:55.848Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ufRR1cbG2VDUTQEkplaogA.jpeg" /><figcaption>engineering bootcamp</figcaption></figure><p>Say one day there is an engineering Bootcamp in a company that has been running for almost a month. Bootcamp participants here are called bootcampers. Here they learn about core engineering, to form a mindset to become a flexible and efficient product engineer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LxgMqr1nQ0OXKEQr71gA-g.jpeg" /><figcaption>coach explain</figcaption></figure><p>Bootcamp has many training sessions. There are coding drills, speaking drills, and so on. At one time the coach gave a written exam session to bootcampers which had to be written on paper.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ay3eW1h3SqpYpPhiZHHd0w.jpeg" /><figcaption>bootcampers ask</figcaption></figure><p>One of the bootcampers finally asked about the limitations they could do in the exam.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SAQaq4xoqS4VAMLecLd-iQ.jpeg" /><figcaption>coach explain</figcaption></figure><p>Our coach replied that we can do anything in this exam.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e3XU0jtF2NR67YDcVUazUA.jpeg" /><figcaption>discussion between bootcampers</figcaption></figure><p>Bootcampers finally teamed up for this test. Eventually, they make rules that :</p><ol><li>Their answer should all be the same.</li><li>All bootcampers work on questions simultaneously and sequentially.</li><li>There is 1 cheat sheet is distributed to all bootcampers as cheating material.</li><li>Bootcampers who successfully answer a question must first write their answers on the cheat sheet and give the name of the author of the answer. For example [1. A — Vento]</li><li>Paper is spread all over the bootcampers. Each bootcampers copies the answers on the exam paper, and also copies [1. A — Vento] on their own personal paper.</li><li>When all bootcampers have copied from the cheat sheet, then continue working on the next number question.</li><li>Repeat process numbers 4 and 6 until all questions are answered.</li><li>In point 5 add a checking process between the cheat sheet and personal paper before copying. If it’s the same then do a copy. If it’s different, ignore it. After completing all the questions, you will get a list of cheats. For example, the end result is like this:</li></ol><p>No 1. A — Vento</p><p>No 2. B — Fang</p><p>No 3. D — Adam</p><p>…</p><p>No 16. B — Fajri</p><p>This list of records will be in every bootcampers, the order and contents are the same. So, that is Blockchain. <strong>Information is not centered on 1 person, but is distributed to all parties and is valid (same)</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rLjyGJH-_ytVSjNuypazBQ.jpeg" /><figcaption>group photo on lunch break</figcaption></figure><p>In the end, the exams were finished faster and everyone got perfect scores. Bootcampers can take their lunch break earlier than usual.</p><p>Okay, so in conclusion, Blockchain is actually more complex than the story above, because the system is programmed, private papers are encrypted, and the names of users can be disguised. On the blockchain itself, the order uses a timestamp recording time.</p><p>However, I hope you can understand the simple concept of how blockchain works.</p><p>Thank you!!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=96b5e473e06" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Wanna be The Next Iron Man?]]></title>
            <link>https://medium.com/@yosepnoventon/wanna-be-the-next-iron-man-647891008cb2?source=rss-5ecd23183256------2</link>
            <guid isPermaLink="false">https://medium.com/p/647891008cb2</guid>
            <category><![CDATA[mindset]]></category>
            <category><![CDATA[iron-man-2]]></category>
            <category><![CDATA[iron-man-3]]></category>
            <dc:creator><![CDATA[Yosep Novento Nugroho]]></dc:creator>
            <pubDate>Mon, 24 Oct 2022 08:52:45 GMT</pubDate>
            <atom:updated>2022-10-24T08:52:45.148Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*Fh1-o_-PL9CrU1tktDCo5A.jpeg" /><figcaption>source: <a href="https://bobo.grid.id/">https://bobo.grid.id/</a></figcaption></figure><p>Iron man is one of the heroes in the Marvel universe. I think all of you already know he is. His name is Tony Stark, and attended MIT at age 15 and got his Masters&#39;s in Physics and engineering at age 20. At 21 and after an unfortunate accident, he inherited Stark Industries, a company that he managed to turn into one of the largest weapons and ammo suppliers of the American government. He is one of the founders of Avengers that have a purpose to avoid attack from other planet and also to bring peace to the world.</p><p>His knowledge and skills allowed him to develop technologies that are still fiction nowadays (but we’re getting there) as prosthetic armored suits (Iron Man), ultra-advanced artificial intelligence (HELEN and JARVIS), or even flying aircraft carriers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*DUBQPcMsJN98SkcW7Iosyg.jpeg" /><figcaption><a href="https://www.bbvaopenmind.com/">https://www.bbvaopenmind.com/</a></figcaption></figure><p>He is an omnidisciplinary scientist who focuses more on inventing machines but can work miracles in any field when he puts his mind to it. For example, he glanced at Maya Hanson’s biological work while drunk, and casually invented the equation she’d been searching for her entire career, then he scribbled it on the back of his nametag and forgot he’d even done it. He’s so brilliant he can casually advance the science of fields he doesn’t even usually focus on.</p><h4>How to be the next iron man?</h4><ol><li>You need to focus on being more of an engineer than a scientist. Build more than getting lost in dry theory. Building things get you more hands-on with the creation process and you’ll learn the corresponding science better.</li><li>Become a generalist than a specialist. Don&#39;t be afraid to learn new things. Given enough focus, learning 80% of anything takes just a month, and the rest 20% takes a lifetime. Be infinitely curious and open to everything including stuff considered awkward.</li><li>You need to have an infinite urge to work all the time. This is possible only if work involves creating the toys you are so curious to want to play with.</li><li>After creating a lot of different things, you’ll understand general patterns in creation. At that point, boundaries between different disciplines start to blur and you’ll be confident to approach anything. Understand that the difference between a genius and a retard is the level of focus. There are no doors in the universe that doesn&#39;t open if you give enough attention.</li><li>Learn an ancient martial art. They train both the mind and body for strength, balance, focus, speed, and flexibility. You’ll be more physical to engage in fights, sports, dance, etc when required than be just a classical geek. Martial arts is meditation in motion. All meditations lead to spiritual enlightenment, which will make you see the world as it is, to engage it better.</li><li>Learn about psychological disorders to understand mental traps. This will keep you away from depression, panic, fear, lack of motivation, traumas, addictions, and negativity. You cannot succeed in life without having respect and love for all life, including yourself. Empathy is the greatest sign of intelligence.</li><li>Understand that you’ve limited time in life. So you cannot afford to loiter. Set absolute deadlines for everything you do. This is the only habit you need to form.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/853/1*UGsbxR3mulwB_OImhP0Pfg.jpeg" /><figcaption><a href="https://ilhamrizqi.com/">https://ilhamrizqi.com/</a></figcaption></figure><p>So I think that’s all that I can share about him. He is a great role model because there are many things that we can learn from him, some of them are, he is a great problem solver that I know, although he is only a fictional character, and also his growth mindset is so great to our daily basis.</p><p>Thank you for reading my article!</p><p>Source:</p><ul><li><a href="https://www.bbvaopenmind.com/en/science/leading-figures/8-brilliant-fictional-scientist-6/">https://www.bbvaopenmind.com/en/science/leading-figures/8-brilliant-fictional-scientist-6/</a></li><li><a href="https://en.wikipedia.org/wiki/Iron_Man">https://en.wikipedia.org/wiki/Iron_Man</a></li><li><a href="https://www.quora.com/Which-type-of-scientist-is-Tony-Stark-in-the-Iron-Man-series">https://www.quora.com/Which-type-of-scientist-is-Tony-Stark-in-the-Iron-Man-series</a></li><li><a href="https://www.quora.com/Iron-Man-Marvel-character-Is-it-possible-to-become-like-Tony-Stark-in-real-life">https://www.quora.com/Iron-Man-Marvel-character-Is-it-possible-to-become-like-Tony-Stark-in-real-life</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=647891008cb2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The End of Build a PC Gaming!! Time to Move on to Xbox Series S]]></title>
            <link>https://medium.com/@yosepnoventon/the-end-of-build-a-pc-gaming-time-to-move-on-to-xbox-series-s-978ec47e1b90?source=rss-5ecd23183256------2</link>
            <guid isPermaLink="false">https://medium.com/p/978ec47e1b90</guid>
            <dc:creator><![CDATA[Yosep Novento Nugroho]]></dc:creator>
            <pubDate>Wed, 19 Oct 2022 20:01:58 GMT</pubDate>
            <atom:updated>2022-10-20T01:25:21.527Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/540/1*9Og3kjzs6ogMkIogABZjRQ.jpeg" /><figcaption>source: https://google.com/</figcaption></figure><p>Whatever the problems? The answer remains RAKIT PC!! The word RAKIT PC itself has been widely shaded some time ago. Precisely during yesterday’s pandemic when people worked from home, they were competing to assemble their own PC with fierce specifications. For many of them, however, the hidden purpose of assembling a pc is to play heavy games. They need to buy games at a high price for just one game. If in total how much money has come out just for playing games, let’s assume that assembling a PC that is medium to high is around 10–20 million rupiah. For one game, for example, 100.000–500.000 rupiah, and also it’s impossible for us to only buy one game, right?</p><p>So is there any other way?</p><p>To answer all the problems above, I will introduce the <strong>Xbox Series S</strong> game console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SJqMy9orRICexyOrqI4O-g.png" /><figcaption>source: https://fin.co.id/</figcaption></figure><p>The price is cheaper in the pocket than a Rakit PC, it’s only $400~ or about 4 million rupiah. And also worth it in the long term because Microsoft claims that this console can still run new (Next Gen) games in the future.</p><p>Xbox is worth it because there are so many games available on <strong>GamePass.</strong></p><p><strong>GamePass</strong>: We subscribe which we will need to pay each month, but we can play all available games. It was only 200.000 a month. This system is like a Netflix subscription.</p><p>But we don’t have the game physically? It’s oke. Let’s take a look at the price comparison of subscriptions.</p><p>It’s one of the biggest features that is why we need to buy the Xbox Series S. Instead of buying physical cassettes with the same budget, let’s say one cassette is 400.000 rupiah or buy in st**m, so assuming we just can only buy 5 games with 2.400.000 million rupiahs. But with the same amount, we can play all the games on Xbox for a year.</p><p>We no longer need to save games here, the <strong>Quick Resume</strong> feature is very helpful when we are forced to turn off the console suddenly or really want to do other things. And after a while maybe a few days. We can continue the games we’ve played directly after we turn on the Xbox with these features. And the most surprising thing, we can quickly resume several games directly, so for example when we play one game and want to switch to another game, we can also take advantage of this feature without the need to reload from the beginning of the game.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GeCYQmM-j5rTsESjuDQiEA.png" /><figcaption>source: personal screenshot on review youtube</figcaption></figure><p>The <strong>Remote Play</strong> feature allows us to play Xbox games from our cell phones. Imagine us playing Xbox games while hanging out outside. Interesting right?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bevqwWrxfReG12EVgQHrSQ.png" /><figcaption>source: personal screenshot on review youtube</figcaption></figure><p>So Xbox is the right choice when we want to play a lot of games at an affordable price. Last, I hope you enjoy my article and the meme below. Thank you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xc2i-YGmP9a4TSFQBlY0MA.png" /><figcaption>source: <a href="https://www.gamelivestory.com/">https://www.gamelivestory.com/</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=978ec47e1b90" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cara Menghindari Deadlock Transaction Concurrent Database]]></title>
            <link>https://medium.com/@yosepnoventon/cara-menghindari-deadlock-transaction-concurrent-database-9473c81ed789?source=rss-5ecd23183256------2</link>
            <guid isPermaLink="false">https://medium.com/p/9473c81ed789</guid>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[deadlock]]></category>
            <category><![CDATA[database-transaction]]></category>
            <dc:creator><![CDATA[Yosep Novento Nugroho]]></dc:creator>
            <pubDate>Fri, 30 Sep 2022 09:47:05 GMT</pubDate>
            <atom:updated>2022-09-30T09:47:05.791Z</atom:updated>
            <content:encoded><![CDATA[<p>Pada artikel ini saya ingin membagikan tutorial cara menghindari deadlock ketika melakukan DB Transaction secara concurrent.</p><p>Sebelum itu kita perlu menyiapkan data praktiknya menggunakan PostgreSQL. Cukup dengan satu table saja misal users.</p><ul><li>id : primary_key</li><li>name : varchar</li><li>balance : int</li></ul><p>Setelah memiliki table diatas dan dengan column yang telah dibuat, isi dengan data cukup dua saja, misal seperti berikut.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_-jGmUTQZLKZEwRQliFf9w.png" /></figure><p>Setalah memiliki data seperti diatas, kita siapkan studi kasus. Jadi ceritanya vento akan mengirim ke deco 10, dan begitu juga sebaliknya. Namun aktivitas ini sama-sama dilakukan secara parallel.</p><h4>Experiment</h4><p>Urutan query nya adalah :</p><ul><li>Membuka Database Transaction</li><li>Update balance dari pengirim dikurangi sejumlah yang dikirim</li><li>Update balance dari penerima ditambah sejumlah yang dikirim</li><li>Melakukan commit transaction</li></ul><p>Query yang akan kita execute seperti dibawah ini, dan akan dilakukan secara parallel.</p><pre>-- Transaksi 1: transfer 10 dari user 1 ke user 2 </pre><pre>BEGIN;</pre><pre>UPDATE users SET balance = balance - 10 WHERE id = 1 RETURNING *;<br>UPDATE users SET balance = balance + 10 WHERE id = 2 RETURNING *;</pre><pre>COMMIT;</pre><pre>-- Transaksi 2: transfer 10 dari user 2 ke user 1 </pre><pre>BEGIN;</pre><pre>UPDATE users SET balance = balance - 10 WHERE id = 2 RETURNING *;<br>UPDATE users SET balance = balance + 10 WHERE id = 1 RETURNING *;</pre><pre>COMMIT;</pre><p>Lets try this!</p><p>Dimulai dari query dari transaksi yang pertama dengan mengurangi 10 pada balance user 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SzRpekBC7TMLEJV9dof6Kg.png" /></figure><p>Seperti yang kita lihat data user 1 terupdate. Sekarang kita membuat DB Transaction baru supaya bisa dijalankan secara parallel. Lanjut execute query di transaksi 2 dengan update balance user 2 dikurangin 10</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ur5b9UDC0scRv43GbV1r0w.png" /></figure><p>Lalu balik lagi ke transaksi 1 dengan update balance user 2 ditambah 10.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LWqiV-BdLKztepw027haoQ.png" /></figure><p>Tapi seperti yang kita lihat, query ke block, karena transaksi 2 juga sedang update user 2. Mari kita lihat list yang query nya terlock dengan query dibawah ini.</p><pre>SELECT<br>	a.application_name,<br>	l.relation::regclass,<br>	l.transactionid,<br>	l.mode,<br>	l.locktype,<br>	l.GRANTED,<br>	a.usename,<br>	a.query,<br>	a.pid<br>FROM pg_stat_activity a <br>JOIN pg_locks l ON l.pid = a.pid<br>WHERE a.application_name = &#39;psql&#39;<br>ORDER BY a.pid;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*le6j9Yjig8acUzi_hYhvug.png" /></figure><p>Ada update user 2 di transaksi pertama sedang mencoba untuk mendapatkan ShareLock pada ID transaksi 2032, tetapi belum diberikan karena transaksi 2 sudah memegang ExclusiveLock pada ID transaksi yang sama. Oleh karena itu, transaksi 1 harus menunggu transaksi 2 selesai sebelum melanjutkan.</p><p>Oke, mari kita lanjut running query kedua, user 1 ditambah 10 balancenya, di transaksi 2</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gqF0C7jG1K0zlJEclrzjuA.png" /></figure><p>Dan kita dapakan deadlock karena akun 1 ini sedang diupdate oleh transaksi 1, maka transaksi 2 juga harus menunggu transaksi 1 selesai sebelum mendapatkan hasil query ini karena user 1 ini sedang diupdate oleh transaksi 1, maka transaksi 2 juga harus menunggu transaksi 1 selesai sebelum mendapatkan hasil query ini. Deadlock terjadi karena 2 transaksi bersamaan ini keduanya harus menunggu yang lain.</p><p>Oke sekarang mari kita rollback 2 transaksi ini.</p><p>Sekarang mari kita pelajari how to fix it!</p><p>Seperti yang telah Anda lihat dalam contoh yang kita jalankan di terminal, alasan terjadinya kebuntuan adalah karena urutan yang berbeda di mana 2 transaksi bersamaan memperbarui balance user. dimana transaksi 1 memperbarui user 1 sebelum user 2, sedangkan transaksi lainnya memperbarui user 2 sebelum user 1.</p><p>Jadi ini memberi kita gambaran tentang bagaimana deadlock dapat dihindari dengan membuat kedua transaksi memperbarui balance user dalam urutan yang sama. Mari kita coba menjalankannya di terminal untuk melihat apa yang akan terjadi.</p><pre>-- Transaksi 1: transfer 10 dari user 1 ke user 2 </pre><pre>BEGIN;</pre><pre>UPDATE users SET balance = balance - 10 WHERE id = 1 RETURNING *;<br>UPDATE users SET balance = balance + 10 WHERE id = 2 RETURNING *;</pre><pre>COMMIT;</pre><pre>-- Transaksi 2: transfer 10 dari user 2 ke user 1 </pre><pre>BEGIN;</pre><pre>UPDATE users SET balance = balance + 10 WHERE id = 1 RETURNING *;<br>UPDATE users SET balance = balance - 10 WHERE id = 2 RETURNING *;</pre><pre>COMMIT;</pre><p>Mari kita jalankan transaksi 1 dengan query pertama dimana update balance user 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5UMJSYXJwlUyPqxzchpKJg.png" /></figure><p>Lanjut jalankan transaksi 2 dengan query pertama juga update balance user 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*blbyufwBi_wA2qUHztpdQg.png" /></figure><p>Sekarang tidak seperti sebelumnya, kali ini query langsung diblokir, karena transaksi 1 sudah memegang exclusive lock untuk memperbarui user yang sama yaitu user 1.</p><p>Mari kita kembali ke transaksi 1 dan jalankan query kedua dimana update balance user 2</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7B85xblCnUzJ3CqfrWr8aA.png" /></figure><p>Hasilnya segera dikembalikan. Dan transaksi 2 masih diblokir. Sekarang mari kita commit transaksi 1 ini untuk release the lock.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y7QbkEDZBo7YHrVxrQdx8Q.png" /></figure><p>Setelah melakukan commit maka transaksi 2 sudah tidak terblokir. Dan kita bisa melanjutkan untuk melanjutkan query kedua di transaksi 2 lalu melakukan commit. Sehingga data terupdate.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ILr9ls6kHM6Ep-ltg24T8w.png" /></figure><p>Semuanya berakhir, dan tidak terjadi deadlock seperti pada percobaan pertama.</p><h4>Conclusion</h4><p>Kesimpulannya kita dapat menghindari deadlock pada transaksi yang berjalan parallel dengan mengurutkan transaksi dengan key yang sama secara konsisten, pada kasus ini kita mengurutkan berdasarkan ID.</p><p>Terima kasih dan semoga bermanfaat.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9473c81ed789" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Memahami Transaction Isolation Level dan Read Phenomena di MySQL]]></title>
            <link>https://medium.com/@yosepnoventon/memahami-transaction-isolation-level-dan-read-phenomena-di-mysql-8d794cb1b2aa?source=rss-5ecd23183256------2</link>
            <guid isPermaLink="false">https://medium.com/p/8d794cb1b2aa</guid>
            <category><![CDATA[database]]></category>
            <category><![CDATA[isolation-level]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[code]]></category>
            <dc:creator><![CDATA[Yosep Novento Nugroho]]></dc:creator>
            <pubDate>Fri, 23 Sep 2022 08:34:32 GMT</pubDate>
            <atom:updated>2022-09-23T08:34:32.003Z</atom:updated>
            <content:encoded><![CDATA[<p>Saat bekerja dengan database transaction, satu hal penting yang harus kita lakukan adalah memilih tingkat isolasi yang sesuai untuk aplikasi kita. Meskipun ada standar yang terdefinisi dengan baik, setiap mesin database mungkin memilih untuk mengimplementasikannya dengan cara yang berbeda, dan dengan demikian dapat berperilaku berbeda di setiap tingkat isolasi.</p><p>Jadi hari ini kita akan mengeksplorasi secara mendalam bagaimana setiap level isolasi bekerja di MySQL dan Postgres dengan menjalankan beberapa kueri SQL konkret. Tapi pertama-tama, mari kita bicara sedikit tentang teorinya. Seperti yang telah kita pelajari di kuliah sebelumnya, transaksi database harus memenuhi properti ACID, yang merupakan singkatan dari Atomicity, Consistency, Isolation, dan Durability.</p><p>Isolation adalah salah satu dari empat properti database transaction, di mana pada level tertingginya, isolasi sempurna memastikan bahwa semua transaksi bersamaan tidak akan saling mempengaruhi. Ada beberapa cara agar suatu transaksi dapat terganggu oleh transaksi lain yang berjalan bersamaan dengannya. Gangguan ini akan menyebabkan sesuatu yang kita sebut “read phenomena”. Berikut adalah beberapa fenomena baca yang mungkin terjadi jika database berjalan pada tingkat isolasi transaksi yang rendah.</p><h3>Read Phenomena</h3><ul><li>Dirty Read</li></ul><p>Sebuah transaksi <strong>read</strong> data yang ditulis oleh transaksi lain yang <strong>uncommited</strong> secara bersamaan</p><ul><li>Non-Repeatable Read</li></ul><p>Sebuah transaksi <strong>reads row/baris yang sama</strong> dua kali dan melihat nilai yang berbeda karena telah <strong>dimodifikasi</strong> oleh transaksi lainnya yang telah di <strong>commit</strong>.</p><ul><li>Phantom Read</li></ul><p>Transaksi <strong>re-execute</strong> query untuk <strong>menemukan row/baris</strong> yang memenuhi suatu kondisi dan melihat <strong>kumpulan baris yang berbeda</strong>, karena perubahan oleh transaksi lain yang telah di <strong>commit</strong>.</p><ul><li>Serialization Anomaly</li></ul><p>Hasil dari <strong>sekelompok transaksi</strong> yang <strong>commit</strong> <strong>secara bersamaan</strong> <strong>tidak mungkin dicapai</strong> jika kita mencoba menjalankannya <strong>secara berurutan</strong> dalam urutan apa pun tanpa tumpang tindih</p><h3>4 Standard Isolation Levels</h3><p>American National Standards Institute — ANSI</p><p>Saya akan mengurutkan dari yang paling rendah hingga paling tinggi</p><ol><li>Read Uncommitted : dapat melihat data yang ditulis oleh transaksi yang <strong>uncommitted</strong></li><li>Read Committed : hanya melihat data yang ditulis oleh transaksi yang telah di <strong>commit</strong></li><li>Repeatable Read : Permintaan <strong>read</strong> yang sama selalu mengembalikan hasil yang sama</li><li>Serializable : Dapat mencapai hasil yang sama dari mengeksekusi transaksi secara berurutan dalam beberapa urutan alih-alih secara bersamaan</li></ol><h3>Isolation Levels in MySQL</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-aamSxyiXwx57DxZviLlJQ.png" /></figure><p>Untuk mengisi tabel diatas kita perlu melakukan eksperimen secara langsung</p><h3>Experiment</h3><p>Pertama kita perlu mempersiapkan table dengan nama users dan data seperti dibawah ini</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FfHOClbgziE7W6o0fJGCLw.png" /></figure><p>Setelah itu buka terminal dan masuk ke MySQL-nya dan dilanjutkan untuk mengecek transaction isolation level di session yang sekarang.</p><pre>select @@transaction_isolation</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sryKQZST7UtedAsCaaaSoQ.png" /></figure><p>Default isolation level dari MySQL adalah repeatable read seperti di screenshot diatas.</p><p>Level ini hanya berlaku untuk console session MySQL khusus. Ada juga global isolation level, yang diterapkan ke semua sesi saat pertama kali dimulai. Kita bisa mendapatkan nilainya dengan menambahkan global ke query pemilihan sebelumnya.</p><pre>select @@transaction_isolation</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*koysqyGtWSwYBUy4h4IYJw.png" /></figure><p>Secara default, ini juga repeatable read.</p><p>Sekarang untuk mengubah tingkat isolasi sesi saat ini, kita dapat menggunakan query dibawah</p><pre>set session transaction isolation level &lt;the_level_that_we_want_to_set&gt;;</pre><h3>Read Uncommitted</h3><p>Misal kita ingin mengubah ke isolation level read uncommitted</p><pre>set session transaction isolation level read uncommitted;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/942/1*p06BmnZ1-2tgWpqQ7muUQw.png" /></figure><p>Perhatikan bahwa perubahan ini hanya akan berpengaruh pada semua transaksi yang sama dari sesi saat ini, tetapi tidak pada transaksi yang berjalan pada sesi lain dari MySQL console.</p><p>Baiklah, sekarang untuk mendemonstrasikan interferensi antara 2 transaksi bersamaan, mari kita coba untuk membuka terminal lain, letakkan berdampingan dengan terminal yang sebelumnya. Dan mulai MySQL console baru di dalamnya. Kemudian mari kita salin perintah set isolation level untuk mengatur isolation level sesi ini untuk membaca read uncommitted juga. Kemudian jalankan isolasi transaksi pilih untuk memastikannya berhasil diubah.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dwd3s5x1lcF6XCFxm6U0lA.png" /></figure><p>Oke, sekarang kedua console berjalan pada isolation level read uncommitted. Kita sekarang dapat memulai transaksi baru.</p><p>Mari kita jalankan query pemilihan sederhana dari akun dalam transaksi 1 dan 2</p><pre>-- terminal 1<br>begin;<br>select * from users;</pre><pre>-- terminal 2<br>begin;<br>select * from users where id = 1;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xyvtudCALQCm53hKT-xSBg.png" /></figure><p>selanjutnya kita coba update balance dari user dengan id 1</p><pre>-- terminal 1<br>update users set balance = balance - 10 where id = 1;</pre><pre>select * from users where id = 1;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/1*PJWE0IeHU_JHlj_QxX5mUA.png" /></figure><p>kita akan melihat bahwa balance telah diubah menjadi 90. Tetapi bagaimana jika kita menjalankan pernyataan pilih yang sama di transaksi 2?</p><pre>-- terminal 2<br>select * from users where id = 1;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*goasUxoi0B7k5nGT-cx40A.png" /></figure><p>Nilai balance user 1 juga berubah di terminal 2 (sebelah kanan) menjadi 90.</p><p>Perhatikan bahwa transaksi 1 belum di commit, tetapi transaksi 2 dapat melihat perubahan yang dilakukan oleh transaksi 1. Jadi ini adalah <strong>dirty read</strong>, dan itu terjadi karena kita menggunakan isolation level <strong>read uncommitted</strong>.</p><p>Mari kita rollback transaction sebelumnya, lalu masuk ke pembahasan selanjutnya.</p><h3>Read Committed</h3><p>Mari kita mulai dengan transaksi baru tapi menggunakan urutan query yang sama seperti yang sebelumnya.</p><pre>-- terminal 1<br>set session transaction isolation level read committed;<br>select @@transaction_isolation;<br>begin;<br>select * from users;</pre><pre>-- terminal 2<br>set session transaction isolation level read committed;<br>select @@transaction_isolation;<br>begin;<br>select * from users where id = 1;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YxF15KMnGtUSq8lcJg4P7Q.png" /></figure><p>Lalu kita coba update user 1 dengan mengurangi balancenya. Dan kita lihat apa yang terjadi di terminal 2.</p><pre>-- terminal 1<br>update users set balance = balance - 10 where id = 1;<br>select * from users where id = 1;</pre><pre>-- terminal 2<br>select * from users where id = 1;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VJY_5t5GUU-M7W2qXmo9HQ.png" /></figure><p>Balance masih sama: 100 seperti sebelumnya seperti terlihat di terminal 2 (sebelah kanan). Ini karena kita menggunakan isolation level read-committed, dan karena transaksi 1 belum di commit, data tertulisnya tidak dapat dilihat oleh transaksi lain. Jadi isolation level read-committed mencegah dirty read phenomena.</p><p>Bagaimana dengan non-repeatable dan phantom read?</p><p>Setelah itu kita coba commit transaksi 1, lalu running query di transaksi 2 untuk melihat user dengan id 1</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7h7pfD-D1SCneAgWIDvzEw.png" /></figure><p>Dan kita lihat user id 1 balance berkurang menjadi 90</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/1*TyRWOzSJEAP3xH9A7rGVoQ.png" /></figure><p>Dan jika dilihat hasil dari query diatas dan dibawah berbeda, ini yang disebut <strong>non-repeatable read phenomenon</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*F7F3z4-qiYHkPxcWu2KtWA.png" /></figure><p>Jika kita menjalankan kembali query untuk mendapatkan semua akun dengan balance minimal 100, Kali ini kita hanya mendapatkan 1 row, bukan 2 seperti sebelumnya, karena balance user 1 berkurang menjadi 90 setelah transaksi 1 di commit. Query yang sama dieksekusi, tetapi baris yang berbeda di return, satu baris hilang karena transaksi lain telah di commit. Ini disebut <strong>phantom-read phenomena</strong>.</p><p>Jadi kita tau bahwa read-committed isolation level hanya bisa mencegah <strong>dirty read</strong>. Tapi masih membiarkan <strong>non-repeatable read</strong> dan <strong>phantom-read phenomena</strong>.</p><p>Mari kita commit kedua transaksi diatas, dan lanjut ke eksperimen selanjutnya.</p><h3>Repeatable Read</h3><p>Pertama kita perlu merubah isolation level ke repeatable read</p><pre>-- terminal 1<br>set session isolation level repeatable read;<br>select @@transaction_isolation;<br>begin;<br>select * from users;</pre><pre>-- terminal 2<br>set session isolation level repeatable read;<br>select @@transaction_isolation;<br>begin;<br>select * from users where id = 1;<br>select * from users where balance &gt;= 90;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vpo9ldQI_n2R9cENX5tXXA.png" /></figure><p>Query di terminal 2 yang melihat balance user ≥ 90 digunakan untuk mengecek apakah phantom read masih terjadi atau sudah terhandle.</p><pre>-- terminal 1<br>update users set balance = balance - 10 where id = 1;<br>select * from users;<br>commit;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d0kbb03fsjd9FBhq-N_EXQ.png" /></figure><p>Sekarang kita update balance user dengan id 1, lalu commit transaksi yang pertama. Kita lihat lagi balance user id 1 tapi di transaksi yang kedua (sebelah kanan) dan balance tetap 90, padahal di terminal 1 (sebelah kiri), balance user id 1 sudah berkurang menjadi 80.</p><p>Ini dikarenakan <strong>repeatable-read</strong> isolation level memastikan bahwa semua query read dapat diulang, yang berarti akan selalu menghasilkan return read yang sama. Bahkan jika ada perubahan yang dibuat di committed transaction lain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*AyJltbtLYJwKYLzt-r7Dfg.png" /></figure><p>Kita lihat juga query yang melihat data balance ≥ 90 di transaksi 2. Kita lihat bahwa return nya masih sama ada 2 row. Jadi <strong>phantom read</strong> phenomena juga dicegah di <strong>repeatable-read isolation level.</strong></p><p>Tapi bagaimana misal di transaksi 2 kita coba untuk meng-update balance dari user id 1, misal dikurangi 10. Apakah balance akhir menjadi 80 atau 70? Lets try this!</p><pre>-- terminal 2<br>update users set balance = balance - 10 where id = 1;<br>select * from users where id = 1;<br>select * from users where balance &gt;= 90;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/872/1*RcABtMcRVxFsovd1QpTfYA.png" /></figure><p>Balance dari user id 1 berubah menjadi 70, dimana yang awalnya 90. Dan juga hasil dari query balance ≥ 90 juga menjadi 1 saja.</p><p>Matematika tidak berfungsi di sini karena transaksi ini masih diganggu oleh pembaruan bersamaan dari transaksi lain. Saya kurang tau mengapa MySQL memilih untuk menerapkan repeatable-read isolation level dengan cara ini, mungkin akan lebih masuk akal untuk raising the error perubahan dengan memunculkan kesalahan, hal ini dapat dilakukan untuk memastikan konsistensi data transaksi.</p><p>Mari kita rollback data transaksi 2 diatas, lalu masuk ke eksperimen selanjutnya.</p><h3>Serializable</h3><p>Pertama kita coba ganti isolation levelnya di terminal 1 dan 2 menjadi serializable. Lalu running query lanjutannya seperti dibawah ini.</p><pre>-- terminal 1<br>set session transaction isolation level serializable;<br>begin;<br>select * from users;</pre><pre>-- terminal 2<br>set session transaction isolation level serializable;<br>begin;<br>select * from users where id = 1;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gdE9CcLyQNzruffWkv9A9w.png" /></figure><p>Selanjutnya kita coba untuk update balance dari user id 1 dengan dikurangi 10.</p><pre>-- terminal 1<br>update users set balance = balance - 10 where id = 1;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0gqyh4xwKxRZDC8Q1eih5Q.png" /></figure><p>Kali ini, yang menarik, UPDATE query diblokir. Jadi pada dasarnya SELECT query dalam transaksi 2 memblokir UPDATE query ini dalam transaksi 1. Alasannya adalah, pada serializable isolation level, MySQL secara implisit mengubah semua SELECT query biasa menjadi SELECT FOR SHARE. Dan transaksi yang menyimpan SELECT FOR SHARE hanya mengizinkan transaksi lain untuk READ baris, tetapi tidak UPDATE atau DELETE-nya. Jadi dengan locking mechanism ini, skenario data yang tidak konsisten yang telah kita lihat sebelumnya tidak mungkin terjadi lagi. Namun, mechanism lock ini memiliki durasi waktu habis, seperti yang terlihat dibawah ini.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*mHHHJnLefI0KDOAiKglVeQ.png" /></figure><p>Namun, apa yang terjadi misal ketika locking mechanism terjadi di transaksi 1, terus kita coba untuk melakukan update balance user id 1 di transaksi 2?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-83_ekKHdL15a1xcLX6_7w.png" /></figure><p>Ini terjadi karena transaksi 2 juga perlu menunggu lock yang terjadi di transaksi 1. Jadi perlu diketahui bahwa selain lock wait timeout, kita juga perlu menjaga kemungkinan situasi deadlock.</p><p>Mari kita coba untuk rollback dan restart kedua transaksi. Dan lakukan query dibawah dijalankan secara bersamaan.</p><pre>-- terminal 1<br>begin;<br>select * from users where id = 1;<br>update users set balance = balance - 10 where id = 1;<br>select * from users where id = 1;</pre><pre>-- terminal 2<br>begin;<br>select * from users where id = 1;<br>commit;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S9dF4GYl3H9CvJcfiPG2Rw.png" /></figure><p>Seperti kita lihat update pada transaksi 1 berhasilh dan tidak terkena locking mechanism dikarenakan transaksi 2 telah melakukan commit.</p><p>Oke, jadi itulah 4 isolation level yang telah kita coba bersama, sekarang kita dapat mengisi table yang sebelumnya kosong diatas.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9Z-CvmdNKPOLfsTMh6it2w.png" /></figure><h3>Isolation Levels in MySQL</h3><p>Untuk mengisi tabel diatas kita perlu melakukan eksperimen secara langsung</p><p>Yang perlu kita garis bawahi adalah terkait retry mechanism, karena mungkin akan terjadi deadlock atau timeout seperti saat kita eksperimen diatas. Selain itu, kita perlu juga untuk membaca dokumentasi dari setiap database, karena setau saya setial database engine memiliki isolation level yang berbeda-beda.</p><p>Terima kasih dan semoga bermanfaat.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8d794cb1b2aa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to resolve Deploy App Engine get Error Response: [4] DEADLINE_EXCEEDED]]></title>
            <link>https://medium.com/@yosepnoventon/how-to-resolve-deploy-app-engine-get-error-response-4-deadline-exceeded-b6700462d8fa?source=rss-5ecd23183256------2</link>
            <guid isPermaLink="false">https://medium.com/p/b6700462d8fa</guid>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[app-engine]]></category>
            <dc:creator><![CDATA[Yosep Novento Nugroho]]></dc:creator>
            <pubDate>Fri, 03 Sep 2021 01:38:08 GMT</pubDate>
            <atom:updated>2021-09-03T01:38:08.569Z</atom:updated>
            <content:encoded><![CDATA[<h3>How to resolve Deploy Apps Engine get Error Response: [4] DEADLINE_EXCEEDED</h3><p>First thing that you need to know is time limit when deploy apps on apps engine is 10 minutes. If you have many big package that need to install first on your web apps, you will get this error, because you don’t have enough time to deploy it.</p><p>So how to handle it? You just need to increase the timeout with this command. For increase until 2000 seconds, you can follow the command below.</p><blockquote>gcloud config set app/cloud_build_timeout 2000</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b6700462d8fa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cara Deploy Laravel Project ke Cloud Apps Engine di Google Cloud Platform]]></title>
            <link>https://medium.com/@yosepnoventon/cara-deploy-laravel-project-ke-cloud-apps-engine-di-google-cloud-platform-f18cad48bbcc?source=rss-5ecd23183256------2</link>
            <guid isPermaLink="false">https://medium.com/p/f18cad48bbcc</guid>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[deploy]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[app-engine]]></category>
            <dc:creator><![CDATA[Yosep Novento Nugroho]]></dc:creator>
            <pubDate>Thu, 03 Jun 2021 10:15:07 GMT</pubDate>
            <atom:updated>2021-07-31T11:08:40.856Z</atom:updated>
            <content:encoded><![CDATA[<p>Kali ini saya akan membuat tutorial cara inisiasi laravel project ke Apps Engine di Google Cloud Platform. Tanpa basa basi lagi mari kita langsung ke prakteknya.</p><p>Pertama kita masuk ke <a href="https://console.cloud.google.com/">https://console.cloud.google.com/</a> lalu buka Cloud Shell pada</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6GQBMf7CbiSx8_ycndB8Qg.png" /></figure><p>Setelah terminal cloud shell telah aktif, lalu inisiasi project laravel dengan command yang tersedia di docs laravel.</p><pre>composer create-project laravel/laravel nama-folder</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6fVQg-X6IPtrfmCWBFr-jg.png" /></figure><p>Tunggu hingga selesai. lalu masuk ke dalam folder, dan coba lakukan command berikut untuk melihat apakah sudah dapat dijalankan sebelum di deploy.</p><pre>&gt; cd nama-folder</pre><pre>&gt; php artisan serve</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MLP-Dw_1f3-31Nwu9R4pIQ.png" /></figure><p>Terus cari di pojok kanan dari terminal dan ganti port ke 8000, lalu klik Change and Preview.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VQ_YaIFNApCqWJg-vWh1Mg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g0AUJM1PQrvcbaQWc6bxvA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ew8xFR7MuxbtnQMLaJrQXQ.png" /></figure><p>Oke sekarang project kita berhasil dijalankan, lalu balik lagi ke terminal cloud shell dan tekan ctrl+c untuk menghentikan command yang berjalan.</p><p>Langkah selanjutnya adalah kita mencoba untuk deploy project kita supaya bisa diakses oleh semua orang.</p><p>Pertama lakukan command berikut dan catat hasilnya karena kita akan menggunakannya untuk config app engine.</p><pre>php artisan key:generate --show</pre><p>Selanjutnya buat file baru lalu bernama app.yaml</p><pre>nano app.yaml</pre><p>Konfigurasikan seperti berikut.</p><pre>runtime: php72 # bisa sesuaikan php versionnya</pre><pre>env_variables:<br>  APP_KEY: &lt;LARAVEL_KEY&gt; # copy output dari key generate kesini<br>  APP_STORAGE: /tmp<br>  VIEW_COMPILED_PATH: /tmp<br>  SESSION_DRIVER: cookie</pre><p>Untuk keluar ctrl+o untuk save terus ctrl+c untuk exit, setelah itu kita perlu tambah line untuk setting base dari storagenya.</p><pre>nano bootstrap/app.php</pre><p>Lalu masukkan konfigurasi dibawah ini didalam file tersebut</p><pre>/*<br>|--------------------------------------------------------------------------<br>| Set Storage Path<br>|--------------------------------------------------------------------------<br>|<br>| This script allows you to override the default storage location used by<br>| the  application.  You may set the APP_STORAGE environment variable<br>| in your .env file,  if not set the default location will be used<br>|<br>*/<br>$app-&gt;useStoragePath(env(&#39;APP_STORAGE&#39;, base_path() . &#39;/storage&#39;));</pre><p>Terus klik ctrl+o untuk save dan ctrl+x untuk keluar dari file, dan running command dibawah untuk meng remove laravel dump server</p><pre>composer remove –dev beyondcode/laravel-dump-server</pre><p>Project kita pun sudah siap di deploy dengan running command berikut</p><pre>gcloud app deploy</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VTsx1thWhseZE9iW4ev_gA.png" /></figure><p>Tunggu hingga selesai dan yeayy, kita pun dapat mengakses project laravel yang telah kita buat secara public dan untuk url bisa cek dengan command berikut.</p><pre>gcloud app browse</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xkvw4jzISrcpXLR770Hszg.png" /></figure><p>Terima kasih telah membaca tutorial dari saya, semoga dapat bermanfaat.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f18cad48bbcc" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>