<?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 Alif on Medium]]></title>
        <description><![CDATA[Stories by Alif on Medium]]></description>
        <link>https://medium.com/@alliefn?source=rss-bcd0f39ecc71------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*kXarfPphJM48bW1RRjrXaQ.jpeg</url>
            <title>Stories by Alif on Medium</title>
            <link>https://medium.com/@alliefn?source=rss-bcd0f39ecc71------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 21:17:16 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alliefn/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[Various Nginx Config for Serving React SPA]]></title>
            <link>https://alliefn.medium.com/various-nginx-config-for-serving-react-spa-eb17122861cb?source=rss-bcd0f39ecc71------2</link>
            <guid isPermaLink="false">https://medium.com/p/eb17122861cb</guid>
            <dc:creator><![CDATA[Alif]]></dc:creator>
            <pubDate>Tue, 20 Aug 2024 16:41:23 GMT</pubDate>
            <atom:updated>2024-08-20T16:41:23.696Z</atom:updated>
            <content:encoded><![CDATA[<p>One for local files, one for reverse proxy access to docker</p><h3>Serving Local Files</h3><p>For most scenarios, serving a React SPA from local files (Exactly in the same server) is straightforward. The Nginx configuration ensures that all requests are routed to the index.html file, allowing React Router to handle client-side routing. Here&#39;s a typical Nginx configuration:</p><pre>server {<br>    listen 80;<br>    server_name example.com;<br><br>    location / {<br>        root /usr/share/nginx/html;<br>        index index.html;<br>        try_files $uri /index.html;<br>    }<br>}</pre><p>In this configuration:</p><ul><li>root /usr/share/nginx/html; points to the directory containing your static files.</li><li>index index.html; specifies the entry file for your SPA.</li><li>try_files $uri /index.html; ensures that any request not matching a file is redirected to index.html.</li></ul><h3>Reverse Proxy Access to Docker</h3><p>When your React SPA is served by a Docker container, Nginx needs to act as a reverse proxy. This setup allows Nginx to forward incoming requests to the Docker container running your application. Below is a Nginx configuration that handles this scenario:</p><pre>server {<br>    server_name your-domain.com;<br><br>    location / {<br>        proxy_pass http://localhost:3000;<br>        proxy_set_header Host $host;<br>        proxy_set_header X-Real-IP $remote_addr;<br>        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br>        proxy_set_header X-Forwarded-Proto $scheme;<br>        proxy_redirect off;<br>        proxy_intercept_errors on;<br>        recursive_error_pages on;<br>        error_page 404 = @rewrite_proxy;<br>    }<br><br>    location @rewrite_proxy {<br>        rewrite ^/(.*)$ /index.html?$1 break;<br>        proxy_pass http://localhost:3000;<br>        proxy_set_header Host $host;<br>    }<br><br>    listen 443 ssl; # managed by Certbot<br>    ssl_certificate /etc/letsencrypt/live/your-domain.com/fullchain.pem; # managed by Certbot<br>    ssl_certificate_key /etc/letsencrypt/live/your-domain.com/privkey.pem; # managed by Certbot<br>    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot<br>    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot<br>}<br><br>server {<br>    if ($host = your-domain.com) {<br>        return 301 https://$host$request_uri;<br>    } # managed by Certbot<br><br>    listen 80;<br>    server_name your-domain.com;<br>    return 404; # managed by Certbot<br>}</pre><p><strong>Why This Configuration Works:</strong></p><ul><li><strong>Proxy Settings</strong>: The proxy_pass http://localhost:3000; directive forwards requests to the Docker container. The additional proxy_set_header directives ensure that the forwarded requests maintain the correct headers, preserving the original client&#39;s IP address and protocol.</li><li><strong>Custom Error Handling</strong>: The error_page 404 = @rewrite_proxy; directive intercepts 404 errors and routes them to the @rewrite_proxy location block. This is crucial for SPAs where client-side routing handles paths that Nginx might otherwise consider non-existent.</li><li><strong>SSL/TLS Configuration</strong>: This setup includes SSL/TLS termination, managed by Certbot, which is essential for securing the communication between clients and your server.</li><li><strong>Redirection to HTTPS</strong>: The second server block handles redirection from HTTP to HTTPS, ensuring all traffic is encrypted.</li></ul><p>That’s all, I hope this configuration will be useful to all of you that tries to arrange Nginx, React SPA, and it’s docker container.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb17122861cb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying a Website on AWS S3 and AWS CloudFront]]></title>
            <link>https://alliefn.medium.com/deploying-a-website-on-aws-s3-and-aws-cloudfront-532089907e7c?source=rss-bcd0f39ecc71------2</link>
            <guid isPermaLink="false">https://medium.com/p/532089907e7c</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[website]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[deployment]]></category>
            <dc:creator><![CDATA[Alif]]></dc:creator>
            <pubDate>Sat, 03 Aug 2024 10:54:10 GMT</pubDate>
            <atom:updated>2024-08-03T10:56:11.914Z</atom:updated>
            <content:encoded><![CDATA[<p>Simple, to-the-point, and with less blablabla.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*54UJRJNUAByxzStnBvG0lw.png" /><figcaption>Cloud Storage and its variants</figcaption></figure><p><strong>What can we learn from this article?</strong></p><ul><li>Reasons to deploy on S3 (Cloud Storage) instead of traditional server</li><li>How to setup a website on S3 and CloudFront</li></ul><p>We’ll start with why: Why we’re doing this? Instead of using traditional server like EC2, or AWS EKS, or other things?</p><p>CDN.</p><p>Let’s say a website has grown big, grow international, and it will be accessed by various people across the world. Or let’s say that the website will be accessed by countless people (Whether it’s across the world or mostly in one region or nation). And let’s assume that website is static, it is better to deploy it on S3 or other Cloud Storage if you are using other Cloud Services (Cloud Storage for GCP, or Azure Storage for Azure, or OSS for Alibaba Cloud). Why is it better? It is better because in traditional server, it will mostl likely be overloaded with requests and you’ll need to scale it up to keep the uptime. That applies to Kubernetes services too.</p><p>Meanwhile, on the other hand, using Cloud Storage means it is unlikely to have a problem with not-enough-resources, as we fully use the infrastructure of the Cloud Services. Which means resources problem is solved by the S3/Cloud Storage-equivalent.</p><p>Though sometimes this raises a problem with caching: Using CloudFront/CDN-equivalent platform in other Cloud Services means caching the S3 content to make the other users around the world can access your site easier. But if you make any changes, it will need to take some time for the changes to be updated. However, most CDN has Caching Invalidation feature to avoid the delays in deploying the changes, so we can simply use the Caching Invalidation feature.</p><p>Now, let’s talk about how to deploy it.</p><p><strong>Setting up the S3 for storing the website content</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/673/1*EKR4WVCArZ5hKe4HSljDkg.png" /></figure><p>First, we navigate to the S3 section in the AWS console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/414/1*ZQO_Jy8u45pnDk-8KaJ2oQ.png" /></figure><p>Second, we create the bucket.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/831/1*omgu34DI5EqDECVUw07Fzw.png" /></figure><p>Use these configurations:</p><p>Bucket name: <em>your.own.domain — </em>for this article, we will use my own domain: s3.alliefnuriman.com. Use your own domain for your own website.</p><p>You can keep all things in default configuration by the AWS.</p><p>Click the Create bucket button, and your bucket has been created.</p><p>Next is to upload your site to the bucket. You can use the “Upload” section in the S3 console.</p><p>After you upload the website, its time to adjust the permission.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/660/1*SyCrnJh4Dcacj-oqnSWaUw.png" /></figure><p>Go to the permissions configurations of your bucket, and uncheck “Block all public access” and all of its sub-options. We need to do this so that the bucket, since it was meant to be for public access, can be accessed by everyone.</p><p>Also, add this in the bucket policy, it’s a configuration to allow public to see your site:</p><pre>{<br>    &quot;Version&quot;: &quot;2012-10-17&quot;,<br>    &quot;Statement&quot;: [<br>        {<br>            &quot;Sid&quot;: &quot;PublicAccess&quot;,<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Principal&quot;: &quot;*&quot;,<br>            &quot;Action&quot;: &quot;s3:GetObject&quot;,<br>            &quot;Resource&quot;: &quot;arn:aws:s3:::{YOUR BUCKET NAME}/*&quot;<br>        }<br>    ]<br>}```</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vPucoa6U0aQjftGfL-r7TQ.png" /></figure><p><strong>Setting up the CloudFront for the website</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gwyx8K-clhuy-GkKBzlWCg.png" /></figure><p>Navigate to the CloudFront section and then click “Create distribution”.</p><p>Here’s the configuration for you to fill, make sure to adjust it to your own website and bucket.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/843/1*UGTg3gEWLtmRo6Ua_jH7pQ.png" /></figure><p><strong>Origin domain</strong>: <em>your bucket name.s3-{region}.amazonaws.com</em></p><p><strong>Name</strong>: will be filled automatically once you fill the origin domain, don’t change it.</p><p><strong>Viewer protocol policy</strong>: Redirect HTTP to HTTPS</p><p><strong>Web Application Firewall</strong>: <em>your choice</em> (Though I prefer to enable it)</p><p><strong>Alternate domain name</strong>: <em>your.own.domain </em>(We need this configuration so that we can simply use our own domain to access the website instead of the ugly Cloudfront domain).</p><p><strong>Custom SSL certificate</strong>: the certificate you generated for your domain (If you don’t have it, generate it. It’s pretty easy to create, check this article: <a href="https://console.aws.amazon.com/acm/home?region=us-east-1#/certificates/request">https://console.aws.amazon.com/acm/home?region=us-east-1#/certificates/request</a>)</p><p><strong>Default root object</strong>: index.html</p><p>After we created the CloudFront distribution, there will be a distribution domain name like in the below picture.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TaEXgDNGHhl16uMwG81OoQ.png" /></figure><p>Navigate to your DNS management, and then create a new record.</p><p>Type of Record: CNAME</p><p>Hostname: <em>your.own.domain</em></p><p>Value: <em>distribution.domain.name </em>(Usually in dSOMETHING.cloudfront.net)</p><p>Wait for a few minutes, and after the DNS has been propagated through the net, you can finally access your website via its domain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/1*-SqCGFx_nUAFLd-BJLUd4Q.png" /><figcaption><a href="https://archive.is/1AKjh">React App (archive.is)</a></figcaption></figure><p><em>Wait, this is just in AWS S3. I need to know how to do the same in Alibaba Cloud, GCP, Azure, Huawei, and &lt;inset cloud here&gt;. What about for *that* cloud?</em></p><p>Well, most cloud has way to do this, if you can do this in AWS, you’ll have no trouble doing this for other cloud :)</p><p>That’s all for this article folks! Thank you for reading ‘till this point!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=532089907e7c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting Up a React App with Virtual Machine and Deployment Automation]]></title>
            <link>https://alliefn.medium.com/setting-up-a-react-app-with-virtual-machine-and-deployment-automation-part-1-923915704332?source=rss-bcd0f39ecc71------2</link>
            <guid isPermaLink="false">https://medium.com/p/923915704332</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[deployment-automation]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <dc:creator><![CDATA[Alif]]></dc:creator>
            <pubDate>Thu, 01 Aug 2024 02:04:01 GMT</pubDate>
            <atom:updated>2024-08-02T02:08:56.972Z</atom:updated>
            <content:encoded><![CDATA[<p>DNS, GitHub Action, and Server/Virtual Machine</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZzdYYJdZNMF6D8kHgl72pA.png" /><figcaption>Cloud Virtual Machine and its variants</figcaption></figure><p><strong>What can we learn from this article?</strong></p><ul><li>Deploying our app in-depth, normally we use platform-as-a-service like Netlify, or Heroku. But in this article, we will use an infrastructure-as-a-service which is more complicated than those two platforms.</li><li>The integration between GitHub, a server, DNS, Letsencrypt, Nginx, and Cloud services to deploy our app.</li></ul><p><strong>Note: This article is cloud-agnostic, which means that no matter what Cloud Platform you’re using, this article still valid and you can replicate each step that I do.</strong></p><p><strong>Create the GCP Compute Engine/AWS EC2/Alibaba Cloud ECS/Azure VM</strong></p><p>Alibaba Cloud ECS: <a href="https://www.alibabacloud.com/help/en/ecs/getting-started/create-and-manage-an-ecs-instance-by-using-the-ecs-console">Create and manage an ECS instance in the console — Elastic Compute Service — Alibaba Cloud Documentation Center</a></p><p>GCP Compute Engine: <a href="https://cloud.google.com/compute/docs/instances/create-start-instance">Create and start a Compute Engine instance | Compute Engine Documentation | Google Cloud</a></p><p>AWS EC2: <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EC2_GetStarted.html">Get started with Amazon EC2 — Amazon Elastic Compute Cloud</a></p><p>Azure VM: <a href="https://learn.microsoft.com/en-us/azure/virtual-machines/linux/quick-create-portal?tabs=ubuntu">Quickstart — Create a Linux VM in the Azure portal — Azure Virtual Machines | Microsoft Learn</a></p><p>In this article, we will use Ubuntu for the operating system. If you don’t use Ubuntu, then the next point will be pointless since the command would probably different.</p><p>Here’s a step-by-step for the AWS EC2:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/337/1*HLClzypFzQmxbKOM5T8-1A.png" /><figcaption>Launch instance AWS EC2</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/804/1*tzrZt4R4dsgQ_UOJBLNPBA.png" /><figcaption>Choose Ubuntu operating system</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*La5wfKi6atPpg1o9IIEZLg.png" /><figcaption>For this, we will use t3.micro to keep things cheap, choose others if you want more resources</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/794/1*II6apySBT_uJDyDuQHVYKg.png" /><figcaption>Also use key pair so we can ssh to the server</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/654/1*_UEyQkXSquA_VZ5KoXfoKw.png" /><figcaption>Security group</figcaption></figure><p>I wouldn’t suggest you use Anywhere to allow ssh traffic from, there should be a limited IP range that can SSH to your server, this is to avoid any bad actors from trying to get into your system.</p><p>Also, you need to allow the HTTPS and HTTP traffic so that we can access your site/app later.</p><p><strong>Configure the DNS</strong></p><p>After we launch the server and got the public IP of the server, we just need to add the following record to the DNS configuration.</p><p>Record: A</p><p>Data: @</p><p>IP Address: &lt;public ip address of the server&gt;</p><p>We need to do this so then we can deploy the app with our domain instead of only the public IP address.</p><p>Here’s an example in Domainesia’s DNS Management:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fvedngPhQdC0ycDhCTzlrg.png" /><figcaption>I censor the domain and IP for security reasons</figcaption></figure><p><strong>Install Git, Nginx, Certbot, NodeJS, and NPM</strong></p><pre>sudo apt update<br>sudo apt upgrade -y<br>sudo apt install git nginx -y<br>sudo apt install snapd -y<br>sudo snap install certbot --classic</pre><p>Let&#39;s break down each of what we installed:</p><ul><li>Git: For cloning the repository</li><li>Nginx: For the web server</li><li>Certbot, python3-certbot-nginx: For generating the SSL certificate so the app will be in https</li></ul><p><strong>Install Deploy Keys (For Private Repository only)</strong></p><p>SSH to the created server first,</p><pre>ssh &lt;username&gt;@&lt;public-ip&gt;</pre><p>Then, generate a keys,</p><pre>ssh-keygen -t ecdsa</pre><p>Just keep press enter and enter until its done.</p><p>Then copy the results, use <strong>cat ~/.ssh/id_ecdsa.pub</strong> and then navigate to deploy keys in GitHub (Settings -&gt; Deploy keys), add the keys. We need this so the server can access our repository.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*DB4ytcLOgr75pPGgCHcdIw.png" /><figcaption>Deploy keys in GitHub</figcaption></figure><p><strong>Add GitHub Secrets</strong></p><p>We will need this later to setup our CI/CD to deploy it automatically if there’s any commit in the repository code.</p><p>Use <strong>cat ~/.ssh/id_ecdsa.pub</strong> and then navigate in GitHub to Settings -&gt; Secrets &amp; variables -&gt; Actions -&gt; click New Repository Secrets. The name of the secrets should be SSH_PRIVATE_KEY.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*qtgCNeSB2qfCzsZI5bkuQQ.png" /><figcaption>Adding GitHub Secrets</figcaption></figure><p><strong>Copy public key to ~/.ssh/authorized_keys</strong></p><pre>cat ~/.ssh/id_ecdsa.pub &gt;&gt; ~/.ssh/authorized_keys</pre><p>We need to do this so that the GitHub Actions can SSH to the server.</p><p><strong>Deploying the Application</strong></p><p>After we do this, now’s the time to clone the repository.</p><pre>git clone git@github.com:&lt;username&gt;/&lt;reponame&gt;</pre><p>After we clone the repository — We need to install some tools to run the application, for this app in this article, it would be a React app. So that the tools would be things like NodeJS, and npm. We will use node version 20.13.1 for this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kSUOYIGXwnn-ZLTdEqrogw.png" /><figcaption>nvm install 20.13.1</figcaption></figure><pre>sudo apt install nodejs npm -y<br>curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.0/install.sh | bash<br>nvm install 20.13.1</pre><pre>sudo npm -g install pm2</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/1*NeDK9r65OyvMpr68Gp3T-w.png" /></figure><p>Now, time to add the deploy script.</p><pre>#!/bin/bash<br><br># Variables<br>APP_DIR=&quot;/home/&lt;user&gt;/&lt;repo-directory&gt;&quot;  # Change to your app directory<br>REPO_URL=&quot;git@github.com:&lt;username&gt;/&lt;repo-directory&gt;.git&quot;<br><br># Ensure the app directory exists<br>if [ ! -d &quot;$APP_DIR&quot; ]; then<br>  git clone $REPO_URL<br>fi<br><br># Navigate to app directory<br>cd $APP_DIR<br><br>git restore .<br><br># Pull latest changes<br>git pull origin main<br><br># Install dependencies and build the app<br>npm install<br>#npm run build<br><br># Restart the app with pm2<br>pm2 restart &lt;appname&gt; ||  pm2 start &quot;npm start&quot; --name &lt;appname&gt;</pre><p>We need that deploy script on home directory and make sure to add execute permission on that deploy script.</p><pre>cd ~<br>vim deploy_script.sh<br>(Copy that script, change the appname, user, username, and repo-directory with the correct name)<br>chmod +x deploy_script.sh</pre><p>Now, run that deploy script.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dX-vSuamRtudwmcMXJWf6A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bxZdF7ZX4j3JGuAjwXv78A.png" /></figure><p>After this, the app is now running, but its running on port 3000, we wanted it to be in a domain.</p><p>That’s where Nginx come in, navigate to:</p><pre>sudo vim /etc/nginx/sites-available/default</pre><p>Delete everything and replace with this:</p><pre>server {<br>    listen 80;<br>    server_name &lt;your-domain&gt;;<br><br>    location / {<br>        proxy_pass http://localhost:3000;<br>        proxy_http_version 1.1;<br>        proxy_set_header Upgrade $http_upgrade;<br>        proxy_set_header Connection &#39;upgrade&#39;;<br>        proxy_set_header Host $host;<br>        proxy_cache_bypass $http_upgrade;<br>    }<br>}</pre><p>Then restart,</p><pre>sudo systemctl reload nginx</pre><p>We can finally access the website via the IP (Archive: <a href="https://archive.is/8AZtM">React App (archive.is)</a>).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kVDaCoyaeMOYZ5SUqSN-Gw.png" /></figure><p>However, it has no SSL certificate, and it</p><p>Here’s how we install the SSL certificate:</p><pre>sudo certbot -d test.alliefnuriman.com --nginx</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xbbda9VH8QJDJdyHCUAZgQ.png" /></figure><p>That command, will use certbot to install an SSL cert, so now it looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MoigoCC_3U6dvZBw4kA-2w.png" /></figure><p>Now we have setup the website and now it&#39;s up and running: <a href="https://archive.is/Mi4Lz">React App (archive.is)</a>.</p><p>Now let&#39;s talk about automation to deploy this.</p><p>Since we’re on GitHub, we’ll need to use GitHub Actions, GitHub Actions is basically an automation platform for GitHub. In this article we will use it to automatically update our application.</p><p>Get to the repo, and add file in .github/workflows/deploy.yaml</p><pre>name: Deploy Next.js App<br><br>on:<br>  push:<br>    branches:<br>      - main<br><br>jobs:<br>  deploy:<br>    runs-on: ubuntu-latest<br><br>    steps:<br>    - name: Checkout code<br>      uses: actions/checkout@v2<br><br>    - name: Install SSH key<br>      run: |<br>        mkdir -p ~/.ssh<br>        echo &quot;${{ secrets.SSH_PRIVATE_KEY }}&quot; &gt; ~/.ssh/id_ecdsa<br>        chmod 600 ~/.ssh/id_ecdsa<br>        ssh-keyscan -H &lt;server&#39;s ip address&gt; &gt;&gt; ~/.ssh/known_hosts<br><br>    - name: Deploy to VM<br>      run: |<br>        ssh ubuntu@&lt;server&#39;s ip address&gt; &#39;./deploy_script.sh&#39;</pre><p>Replace &lt;branch&gt; and &lt;server’s ip address&gt; with appropriate values. Branch usually filled with main, and server’s ip address is depending on what the IP address of your created server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/935/1*FwVYoFpXnV3njYKLo-eK9w.png" /><figcaption>GitHub Action Pipeline</figcaption></figure><p>After this, we have setup the website, and setup the automation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=923915704332" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pembuatan Website dengan Virtual Machine di Azure (Part 3): Git Repo, Git Server, Git Hooks (+…]]></title>
            <link>https://alliefn.medium.com/pembuatan-website-hanya-dengan-virtual-machine-di-azure-part-3-git-repo-git-server-git-hooks-39c61cc0ec26?source=rss-bcd0f39ecc71------2</link>
            <guid isPermaLink="false">https://medium.com/p/39c61cc0ec26</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[nginx]]></category>
            <category><![CDATA[virtual-machine]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[azure]]></category>
            <dc:creator><![CDATA[Alif]]></dc:creator>
            <pubDate>Thu, 23 Dec 2021 10:17:28 GMT</pubDate>
            <atom:updated>2022-11-17T21:57:22.831Z</atom:updated>
            <content:encoded><![CDATA[<h3><a href="https://alliefn.medium.com/pembuatan-website-hanya-dengan-menggunakan-virtual-machine-di-azure-part-1-setup-azure-d32177657aa7?source=your_stories_page----------------------------------------">Pembuatan Website dengan Virtual Machine di Azure (Part 3): </a>Git Repo, Git Server, Git Hooks (+ Bonus)</h3><p><em>Git gud lmao</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/1*aq2mlA-X4qflGilL__GTJg.jpeg" /></figure><p>Jadi, <em>at this point</em>, seharusnya PostgreSQL sudah jalan, Nginx sudah fungsional dan juga terintegrasi dengan PHP, <em>good.</em></p><p>Sekarang apa? <em>Well</em>, sekarang ialah waktunya Anda melakukan integrasi dengan Git. Apa tujuannya? Tujuannya ialah membuat website Anda dapat diupdate secara otomatis ketika Anda melakukan <em>push </em>ke repository yang dibuat, <em>isn’t that great</em>? Sehingga, kita akan membuat VM tersebut bukan hanya sebuah web server, namun juga, sebuah <strong>Git server</strong>.</p><p>Bukankah sudah ada Github? <em>Well</em>, repository yang disimpan di server <strong>relatif</strong> lebih aman daripada di Github, selain itu, Anda juga mempunyai kebebasan lebih banyak, walaupun dengan <em>cost</em> pengetahuan teknikal yang lebih besar, tentunya.</p><p>Cukup dengan pengantarnya, kita langsung saja.</p><h3>Git Server</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/479/1*2uJHynUQGF2pAvNqOThZlA.png" /></figure><p>Jalankan perintah sudo adduser git untuk menambahkan user baru bernama git. Anda akan diminta untuk membuat passwordnya, pastikan passwordnya cukup aman untuk digunakan.</p><p>Lalu, segera lakukan perintah berikut:</p><p>su git</p><p>Perintah tersebut akan membuat Anda dapat menggunakan VM sebagai ‘git’, buatlah folder .ssh &amp; ubah permission pada folder tersebut menjadi 700.</p><pre>mkdir .ssh &amp;&amp; chmod 700 .ssh</pre><p>Lalu, segera buat file authorized_keys, ubah permission pada file tersebut menjadi 600.</p><pre>touch .ssh/authorized_keys &amp;&amp; chmod 600 authorized_keys</pre><p>Import public key SSH Anda ke file tersebut, salin public key tersebut ke file authorized_keys, use vim/nano/emacs/whatever you like.</p><p><em>You’re done</em>?<em> Great</em>!</p><p>Sekarang, cobalah untuk buat sebuah repo dengan user git tersebut. Segera lakukan hal berikut:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/615/1*oD1AaPxRxMf4Mu9CfKsJgA.png" /></figure><p>mkdir project.git &amp;&amp; cd project.git &amp;&amp; git init --bare</p><p>Anda akan membuat repo bernama project, dan Anda telah menginisialisasi segala hal yang diperlukan agar repo tersebut operasional, <em>good</em>.</p><p>Sekarang, di komputermu (bukan VM), lakukan hal berikut:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/505/1*XGoDW8NguVOqypYC_9_IXA.png" /></figure><pre>mkdir project &amp;&amp; cd project &amp;&amp; git init</pre><p>Setelah ini, buatlah sebuah file bernama index.php dan salinlah “kode” HTML (dan PHP) berikut ini:</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;head&gt;<br>&lt;title&gt;Welcome to nginx!&lt;/title&gt;<br>&lt;style&gt;<br> body {<br> width: 35em;<br> margin: 0 auto;<br> font-family: Tahoma, Verdana, Arial, sans-serif;<br> }<br>&lt;/style&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>&lt;h1&gt;Welcome to nginx!&lt;/h1&gt;<br>&lt;p&gt;If you see this page, the nginx web server is successfully installed and<br>working. Further configuration is required.&lt;/p&gt;</pre><pre>&lt;p&gt;For online documentation and support please refer to<br>&lt;a href=”<a href="http://nginx.org/">http://nginx.org/</a>&quot;&gt;nginx.org&lt;/a&gt;.&lt;br/&gt;<br>Commercial support is available at<br>&lt;a href=”<a href="http://nginx.com/">http://nginx.com/</a>&quot;&gt;nginx.com&lt;/a&gt;.&lt;/p&gt;</pre><pre>&lt;p&gt;&lt;em&gt;Thank you for using nginx.&lt;/em&gt;&lt;/p&gt;<br>&lt;?php phpinfo(); ?&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>Bila sudah, lakukan hal berikut:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/306/1*7bbv2tUsSYyLSQwNpy2Afg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*BkABABSnAQG3UyEDVT_mbg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/1*ByVXU0bI3ELoGsSlY1YTkg.png" /></figure><pre>git add . &amp;&amp; git commit -m &#39;Initial commit&#39;<br>git remote add origin git@{IP VM ANDA}:{LOKASI FOLDER PROJECT.GIT}<br>git push origin master</pre><p>Artinya, Anda akan membuat sebuah repo git, menambahkan beberapa file lalu menset pesan commit dengan “Initial commit”, lalu menambah <em>remote</em> (Lokasi repo)-nya. Terakhir, Anda mempush ke server (In which the server is your VM).</p><p>At this point Anda telah sukses membuat Git server sederhana.</p><p>Untuk mengamankan git server Anda, silahkan baca dokumentasi berikut: <a href="https://git-scm.com/book/en/v2/Git-on-the-Server-Setting-Up-the-Server">Git — Setting Up the Server (git-scm.com)</a></p><h3>Git Repo pada VM</h3><p>Sekarang kita akan mengclone repo VM pada… VM itu sendiri, yang akan kita jadikan sebagai root folder dari Nginx. Mengapa repo VM yang <em>prime</em> tidak kita jadikan root folder dari website? Lihatlah gambar berikut:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/494/1*xReXrwM21WCMISgUe0NHPQ.png" /></figure><p>Tidak cocok untuk dijadikan root folder, bukan?</p><p>Maka dari itu, kita akan melakukan cloning pada repo ini di VM ini.</p><p>Sebelum itu, kita akan menggenerate SSH key (Masih dengan user yang sama, Git). Gunakan perintah berikut:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*B25cwEig4T4ZONeq3Ffsig.png" /></figure><p>ssh-keygen</p><p>Leave everything as it is, lalu segera tambahkan isi dari ~/.ssh/id_rsa.pub ke ~/.ssh/authorized_keys, mungkin perintah ini akan membantu:</p><p>cat ~/.ssh/id_rsa.pub &gt;&gt; ~/.ssh/authorized_keys</p><p>Sekarang gunakan perintah berikut untuk mengclone repo:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*1waprhUWj2Ahga7-_nX80Q.png" /></figure><p>git clone git@{IP ADDRESS VM}:{LOKASI FOLDER PROJECT.GIT}</p><h3>Nginx Root Folder</h3><p>Defaultnya, website pada folder Nginx disimpan pada /var/www/html, kita akan menggantinya ke /home/git/project (Tempat kita melakukan cloning tadi).</p><p>Navigate ke konfigurasi Nginx, yaitu /etc/nginx/sites-available/default, buka dengan vim/nano.</p><p>sudo vim /etc/nginx/sites-available/default</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/539/1*2yDeR3KL9JLDySnYJTToKA.png" /></figure><p>You see that line? root /var/www/html</p><p>Kita akan menggantinya ke root /home/git/project</p><p>Setelah Anda, menggantinya, keluar dari teks editor Anda dan segera restart Nginx, gunakan perintah berikut (Restart pada user ‘kane’):</p><p>sudo systemctl restart nginx</p><p>Konfigurasi baru telah digunakan.</p><p>Cobalah untuk melakukan</p><p>Untuk memeriksa apakah konfigurasi baru dapat digunakan, jalankan ini di browser Anda</p><p><a href="http://{vm/">http://{</a>IP VM ANDA}/</p><p>Seharusnya websitenya masih sama spt sebelumnya dan masih bisa diakses. Bila belum yakin, coba lakukan edit pada index.php di /home/git/project dan ubah apapun yang Anda mau.</p><p>Note: Terdapat cara tambahan untuk mengecek apakah web sudah dapat diakses: Coba akses link <a href="http://{ip/">http://{IP</a> VM ANDA}/.git, hasilnya seharusnya Forbidden.</p><h3>Git Hooks: Auto Change ketika <em>Repo Prime berubah</em></h3><p>Ketika Anda melakukan perubahan pada repo prime (e.g. mempush di komputer Anda), root folder tidak akan langsung berubah. Konsekuensinya? Tentu saja ini akan merepotkan Anda karena Anda terpaksa login ke server hanya untuk melakukan update secara terus-menerus.</p><p>Solusi untuk permasalahan ini apa?</p><p>Git Hooks.</p><p>Git Hooks adalah tools yang membuat aksi tertentu dilakukan ketika suatu event terjadi, yang kita inginkan, adalah update otomatis repo yang berfungsi sebagai root folder ketika repo prime mengalami perubahan. In which, aksi tersebut dapat dilakukan sebagai berikut:</p><p>Lakukan pengeditan pada file post-receive pada folder hooks di repo prime (project.git), tambahkan line berikut:</p><pre>#!/bin/sh<br>GIT_WORK_TREE=/home/git/project git checkout -f</pre><p>Gunakan nano/emacs/vim untuk melakukan pengeditan.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*Z_Gw62GkqWVLTwRuhCKEGw.png" /></figure><p>Jangan lupa untuk membuat skrip <em>executable</em> sehingga bisa dijalankan (Gunakan chmod +x)</p><p>Cobalah untuk melakukan pengeditan pada komputer Anda dan lakukan push ke server, cek lagi apakah website telah berubah.</p><p>Sebagai contoh, disini saya melakukan pengubahan pada filenya, lihat “kode” berikut</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;head&gt;<br>&lt;title&gt;Welcome to the Brotherhood of Nod!&lt;/title&gt;<br>&lt;style&gt;<br>    body {<br>        width: 35em;<br>        margin: 0 auto;<br>        font-family: Tahoma, Verdana, Arial, sans-serif;<br>    }<br>&lt;/style&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>&lt;h1&gt;Welcome to the Brotherhood of Nod!&lt;/h1&gt;<br>&lt;p&gt;Welcome to The Brotherhood of Nod&#39;s Website.<br>This site was made by Kane, the Founder of the brotherhood.&lt;/p&gt;</pre><pre>&lt;p&gt;For more informaton about the Brotherhood of Nod please refer to<br>&lt;a href=&quot;<a href="https://cnc.fandom.com/wiki/Command_%26_Conquer_Wiki">https://cnc.fandom.com/wiki/Command_%26_Conquer_Wiki</a>&quot;&gt;cnc.fandom.com&lt;/a&gt;.&lt;br/&gt;</pre><pre>&lt;p&gt;&lt;em&gt;DOWN WITH GDI!&lt;/em&gt;&lt;/p&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/499/1*ehxM7gHMcLDoFmoul8fxNw.png" /></figure><p>Ubah file index.php sesuai dengan skrip ini, lalu push, cek juga apakah website telah berubah.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1W5eGfDZri69k3dzyNWNCw.png" /></figure><p>Anda sudah sukses menyiapkan environment development seperti PHP, PostgreSQL, Anda juga telah sukses membuat website Anda terupdate otomatis ketika Anda melakukan pengubahan pada repo website. Happy coding!</p><blockquote>Part 3 ini mengakhiri serial pembuatan website dengan VM Azure</blockquote><p>Oh, Anda masih membaca sampai disini? Hehe, saya punya sedikit bonus untuk Anda:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5helyAH8AoJdHmzsi4weBw.png" /></figure><p>Anda tahu Onion routing? TOR browser? Apakah pernah menggunakan TOR browser dan mengakses <em>hidden services</em> di situ?</p><p>Penjelasan mengenai TOR network akan membuat artikel ini terlalu panjang, sehingga, silahkan cari sendiri di internet.</p><p>Disini kita akan membuat suatu <em>hidden service</em>, berikut tutorialnya:</p><blockquote>Catatan singkat: Website pada dark web itu biasanya digunakan untuk hal yang ilegal, rancu secara hukum (daerah abu-abu), walaupun tidak semua hal ilegal di dark web. Saya tidak mengendorse tindakan ilegal seperti membuat <a href="https://en.wikipedia.org/wiki/Silk_Road_(marketplace)">Silk Road</a> kedua dan saya tidak bertanggung jawab atas apa yang Anda lakukan dengan hidden service ini.</blockquote><p>Secara garis besar, ada dua langkah utama:</p><ul><li>Instalasi tor</li><li>Konfigurasi tor untuk membuat Hidden Service</li></ul><h3>Install TOR</h3><p>Untuk instalasi TOR mungkin ada berpikir untuk menggunakan command sudo apt install tor -y, namun ini tidak direkomendasikan, karena ada kemungkinan tor yang Anda install bukanlah versi terbaru sehingga lebih rentan dari sisi security. Sehingga, ikuti instruksi berikut:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/381/1*A4G2bgLnTGHsk61afhT0xw.png" /></figure><p>dpkg --print-architecture</p><p>Untuk mengetahui arsitektur VM</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*glr41sCkkgkx0lmuzKviQQ.png" /></figure><p>sudo apt install apt-transport-https -y</p><p>Agar koneksi yang dibuat oleh apt dilakukan melalui https</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/253/1*EaFX_ddj9cC7bA6bYaK3fA.png" /></figure><p>lsb_release -c</p><p>Untuk mengetahui codename dari distribusi Linux Anda</p><p>Selanjutnya, buatlah file /etc/apt/sources.list.d/tor.list, lalu insert entry berikut:</p><pre>deb     [signed-by=/usr/share/keyrings/tor-archive-keyring.gpg] https://deb.torproject.org/torproject.org &lt;DISTRIBUTION&gt; main<br>deb-src [signed-by=/usr/share/keyrings/tor-archive-keyring.gpg] https://deb.torproject.org/torproject.org &lt;DISTRIBUTION&gt; main</pre><p>Ganti &lt;DISTRIBUTION&gt; dengan codename Linux Anda, jika &lt;DISTRIBUTION&gt; == focal however…</p><p>Entry tersebut yang harus dimasukkan:</p><pre>deb     [arch=&lt;ARCHITECTURE&gt; signed-by=/usr/share/keyrings/tor-archive-keyring.gpg] https://deb.torproject.org/torproject.org focal main<br>deb-src [arch=&lt;ARCHITECTURE&gt; signed-by=/usr/share/keyrings/tor-archive-keyring.gpg] https://deb.torproject.org/torproject.org focal main</pre><p>Ganti &lt;ARCHITECTURE&gt; sesuai temuan Anda pada dpkg --print-architecture .</p><p>Lalu, tambahkan kunci gpg untuk memverifikasi package tor yang akan diinstall dengan menjalankan perintah berikut:</p><pre>sudo wget -O- https://deb.torproject.org/torproject.org/A3C4F0F979CAA22CDBA8F512EE8CBC9E886DDD89.asc | gpg --dearmor | sudo tee /usr/share/keyrings/tor-archive-keyring.gpg &gt;/dev/null</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*prS2FEa3PqM0JSCLmXyrJw.png" /></figure><p>Terakhir, install Tor dengan menjalankan perintah berikut:</p><pre>sudo apt update<br>sudo apt install tor deb.torproject.org-keyring -y</pre><h3>Konfigurasi TOR</h3><p>File konfigurasi tor ada pada /etc/tor/torrc, carilah line berikut pada file tersebut:</p><pre>#HiddenServiceDir /var/lib/tor/hidden_service/<br>#HiddenServicePort 80 127.0.0.1:80</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/756/1*ddzPfswepdkhvymm2W-fLQ.png" /></figure><p>Setelah Anda menemukannya, hilangkan tanda ‘#’.</p><p>Restart tor dan nginx setelah Anda mengubah konfigurasinya,</p><p>sudo systemctl restart tor</p><p>Setelah itu, navigate ke folder /var/lib/tor menggunakan ls -l (Dengan sudo juga tentunya)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/1*YWUDHgbdJIknRDZsObJz1A.png" /></figure><p>Perhatikan bahwa ada folder hidden_service pada /var/lib/tor, dan ada file hostname pada /var/lib/tor/hidden_service, periksa isinya.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/589/1*ECr7ATqhTqYtOeyddxx7Gg.png" /></figure><p>Onion link untuk website kita adalah <a href="http://i4q5vj474daeb6ufax434ccz4bsmkog4665rl62hkuluv6k2fypfqd.onion/">mbi4q5vj474daeb6ufax434ccz4bsmkog4665rl62hkuluv6k2fypfqd.onion</a> dan website sudah dapat diakses pada “domain” tersebut (hanya melalui TOR network, unfortunately…).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*I7Dg6iHzjtH2aW08NoJkTg.png" /></figure><p>Notice bahwa auto update dari Git masih berjalan dan TOR tidak melakukan intervensi terhadap apa yang telah susah-susah kita setup.</p><p>Happy coding! Hati-hati dengan aktivitasmu di hidden service yang telah kamu buat :).</p><blockquote><em>Selamat tinggal, see you </em><a href="https://www.youtube.com/watch?v=DZrGIIIBhNg"><em>after</em></a><em> the first Nod reunification war</em></blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FzBvOeQF_S-I%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DzBvOeQF_S-I&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FzBvOeQF_S-I%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/13ffe5e4dd1a6c343659cb66928ef87f/href">https://medium.com/media/13ffe5e4dd1a6c343659cb66928ef87f/href</a></iframe><p><em>Vielen Dank</em>!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=39c61cc0ec26" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pembuatan Website dengan Virtual Machine di Azure (Part 2): Nginx, PostgreSQL, PHP]]></title>
            <link>https://alliefn.medium.com/pembuatan-website-hanya-dengan-virtual-machine-di-azure-part-2-nginx-postgresql-php-b7433b03839b?source=rss-bcd0f39ecc71------2</link>
            <guid isPermaLink="false">https://medium.com/p/b7433b03839b</guid>
            <category><![CDATA[nginx]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[postgres]]></category>
            <category><![CDATA[virtual-machine]]></category>
            <dc:creator><![CDATA[Alif]]></dc:creator>
            <pubDate>Thu, 23 Dec 2021 07:29:21 GMT</pubDate>
            <atom:updated>2022-11-17T22:00:00.059Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Semi “from scratch” production</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*I9xw3W6zPESc4A2D0BLO3A.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hYpg_LUz_3M-Hqw918fkzA.jpeg" /></figure><p>Tujuan dari tutorial part 2:</p><ul><li>Setup Nginx agar VM dapat menjadi semacam web server</li><li>Setup PostgreSQL di VM</li><li>Setup agar Nginx dapat memproses PHP</li></ul><p>Melanjutkan dari <a href="https://alliefn.medium.com/pembuatan-website-hanya-dengan-menggunakan-virtual-machine-di-azure-part-1-setup-azure-d32177657aa7">tutorial sebelumnya</a>, lakukan SSH ke VM Anda.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/657/1*vcS9Tfrwl3AWcTyDzMjYyQ.png" /></figure><p>Lakukan update &amp; upgrade terlebih dahulu dengan perintah berikut:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/933/1*-JIOn1WFqFfQ1EGSJNsDNg.png" /></figure><pre>sudo apt update &amp;&amp; sudo apt upgrade -y</pre><p>Penjelasan: sudo adalah command agar Anda mendapatkan <em>administrator privilege</em>, apt adalah command untuk package manager di linux turunan Debian (CMIIW), update ialah perintah agar apt melakukan update pada remote repositories, lalu, upgrade ialah perintah untuk melakukan… upgrade. Tag -y digunakan agar tidak ada prompt untuk menekan y/n karena Anda akan ditanya apakah yakin untuk melakukan upgrade.</p><h3>Nginx</h3><p>Instalasi Nginx dapat dilakukan sesederhana menggunakan perintah:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/1*3NcXKWPh2-F-C3g6mLY9Ew.png" /></figure><pre>sudo apt install nginx -y</pre><p>Setelah instalasi selesai, cobalah buka IP address website Anda di port 80 (Cukup buka IP addressnya di browser, Anda tidak perlu <em>menspecify</em> apa portnya, karena default port dari HTTP ialah 80). Perhatikan protokol yang digunakan adalah http, bukan https.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HCwC2Lu2U1xmEkjTuPv_HQ.png" /></figure><p>Voila! VM Anda sudah dapat membroadcast sebuah website.</p><p>Selanjutnya? <em>Well</em>, kita setup dulu development untuk websitenya, in which kita akan menginstall PostgreSQL dan php agar website yang dibuat bisa dinamis.</p><h3>PostgreSQL</h3><p>Untuk menginstall PostgreSQL, gunakan skrip berikut:</p><pre>sudo sh -c &#39;echo &quot;deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main&quot; &gt; /etc/apt/sources.list.d/pgdg.list&#39;<br>wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -<br>sudo apt-get update<br>sudo apt-get -y install postgresql</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/763/1*pPRTQjSr9-SQ4B9VDwnxKA.png" /></figure><p>Perhatikan postgresql berapa yang diinstall. Dalam hal ini, yang diinstall ialah versi 14.</p><p>Lalu, jalankan:</p><pre>sudo nano /etc/postgresql/14/main/pg_hba.conf</pre><p>Anda akan masuk ke konfigurasi PostgreSQL, lalu carilah LINE berikut:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*64MAdaNsAjwTFqkiZVAQvw.png" /></figure><p>Ubah peer menjadi md5.</p><p>Untuk menyimpan progress, Anda, Ctrl-S lalu Ctrl-X untuk exit.</p><p>Sekarang restart service PostgreSQL Anda, gunakan perintah berikut:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/414/1*cW1UiJqZcoLvUxfn9_EcrQ.png" /></figure><pre>sudo service postgresql restart</pre><p>Cobalah untuk masuk ke database Anda sebagai admin,</p><pre>sudo -u postgres psql</pre><p>PostgreSQL Anda sudah bisa digunakan, untuk penggunaan lebih lanjut, gunakan help atau baca dokumentasi <a href="https://www.postgresql.org/docs/14/index.html">PostgreSQL ke-14</a>.</p><p>Langkah awal untuk Anda, paling:</p><ul><li>Mengganti password user postgres agar database Anda lebih aman dari ancaman pihak yang tidak berwenang, gunakan \password.</li><li>Pembuatan database baru, gunakan CREATE DATABASE &lt;namadb&gt;;</li></ul><p>Untuk keluar dari lingkungan PostgreSQL, gunakan \q.</p><h3>PHP</h3><p>Nginx tidak mempunyai pemroses PHP yang <em>built-in</em>, sehingga, kita perlu menginstall php-fpm agar Nginx dapat memproses PHP.</p><p>Untuk memasang PHP, install php-fpm dengan sudo apt install php-fpm . Perhatikan versi berapa yang terinstall. Lalu segera edit file /etc/nginx/sites-available/default , gunakan perintah sudo nano /etc/nginx/sites-available/default . Lalu pastikan konfigurasinya sudah seperti ini:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/687/1*SrcIDN1PIburgI0IowdK5g.png" /></figure><p>Yang penting ialah adanya line:</p><pre>location ~ \.php$ {</pre><pre>    include snippets/fastcgi-php.conf;</pre><pre>    fastcgi_pass unix:/var/run/php/php<strong>7.4</strong>-fpm.sock;</pre><pre>}</pre><p>Perhatikan <strong>7.4</strong>, karena inilah Anda harus memeriksa versi berapa dari php-fpm yang Anda install. Bila 8.0, ubahlah 7.4 dengan 8.0, begitu pula dengan versi lain.</p><p>Selain itu tambahkan index.php pada line yang berisi index.*</p><p>Setelah ini, editlah /var/www/html/index.nginx-debian.html, tambahkan line berikut pada bagian ini:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/535/1*oKgXfNO_J8a20i9uhJzApg.png" /></figure><p>Bagaimana cara mengeditnya?</p><p>Saya yakin Anda sudah tahu bagaimana, hehehe.</p><p>Lalu, ganti nama index.nginx-debian.html menjadi index.php, gunakan perintah berikut:</p><p>sudo mv /var/nginx/www/html/index.nginx-debian.html /var/nginx/www/html/index.php</p><p>Setelah itu lakukan restart pada Nginx dengan perintah sbb.</p><pre>sudo systemctl restart nginx</pre><p>Segera akses lagi VM Anda (Ingat IP addressnya!) <strong>melalui browser.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J_S5Dwea1KCPtFun2RRQaw.png" /></figure><p>Apakah tampilannya sekarang seperti itu? Jika ya, selamat! PHP sudah dapat diproses di website Anda.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b7433b03839b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Pembuatan Website dengan Virtual Machine di Azure (Part 1): Setup Azure]]></title>
            <link>https://alliefn.medium.com/pembuatan-website-hanya-dengan-menggunakan-virtual-machine-di-azure-part-1-setup-azure-d32177657aa7?source=rss-bcd0f39ecc71------2</link>
            <guid isPermaLink="false">https://medium.com/p/d32177657aa7</guid>
            <category><![CDATA[website-development]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[website]]></category>
            <category><![CDATA[virtual-machine]]></category>
            <dc:creator><![CDATA[Alif]]></dc:creator>
            <pubDate>Wed, 22 Dec 2021 15:38:40 GMT</pubDate>
            <atom:updated>2022-11-17T22:00:00.790Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Semi “from scratch” production</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*xdBHfLs2B6Y7dzp-iLHPHg.png" /></figure><p>Artikel ini adalah dokumentasi ketika saya ingin membuat suatu situs web (<em>Unfortunately</em>, sekarang hanya dapat diakses <em>via</em> IP address saja, bukan domain).</p><p>Dalam melakukan ini, kita memerlukan hal-hal berikut:</p><ul><li>Akun Azure yang dapat membuat VM (Virtual Machine)</li><li>Pengetahuan dasar untuk konfigurasi VM (di Azure)</li><li>Pengetahuan dasar mengenai Apache2 ataupun Nginx (agar VMnya dapat berfungsi seperti web server)</li><li>Pengetahuan dasar mengenai cara penggunaan SSH</li><li>Pengetahuan <em>intermediate</em> tentang Git (seperti konfigurasi VM menjadi git server)</li></ul><p>Tanpa basa-basi lagi, kita langsung saja:</p><p>Pertama-tama, kita akan membuat suatu VM di Azure, <em>instance</em> VM tersebut akan dinamakan “kane”, berikut tangkapan layar pembuatan VM tersebut dan penjelasannya.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*Cil1wgPGno7w7SqFpXTHRA.png" /><figcaption>instance details</figcaption></figure><p>Dapat dilihat bahwa nama dari instance ialah kane, dengan <em>image</em> dari OS ialah Ubuntu Server 20.04 LTS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*cbeihn-sNaYZK0lxua92oA.png" /></figure><p>Beberapa hal untuk Anda pertimbangkan: Apakah autentikasi untuk login ke remote server itu password atau SSH key? <em>Well</em>, itu terserah Anda, namun perhatikan hal berikut:</p><ul><li>SSH key lebih aman karena dengan menggunakan SSH key, orang harus punya kunci privat Anda untuk login ke server. Namun akan merepotkan Anda karena Anda harus punya kunci privat dan publik SSH dulu (Jika belum ada), dan Anda harus mengimport kunci publik rekan Anda (If any) yang akan mengakses VM yang telah Anda buat.</li><li>Bila Anda menggunakan password, persoalannya ialah Anda harus memastikan password yang Anda gunakan itu aman, karena password rentan untuk di<em>compromise </em>pihak lain. Namun, persoalan ketika rekan Anda harus akses server Anda menjadi lebih mudah untuk diselesaikan.</li></ul><p>Dalam hal ini, saya memilih SSH public key karena hanya saya saja yang akan mengakses instance tersebut dan saya telah punya public key di perangkat saya.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*T1JAhtsacMgVQuVtpqztyQ.png" /></figure><p>Selanjutnya: Setelan inbound port rules. Disini saya melakukan hal berikut:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/773/1*OddYvD5k4rMCBA6JqQ9frg.png" /><figcaption>Apa perbedaannya dengan gambar di atas?</figcaption></figure><p>Mengapa hal ini perlu dilakukan? Karena nanti kita akan membuat VM Anda menjadi sebuah web server, sehingga akses ke port 80 dan 443 diperlukan karena protokol http, <em>default</em>nya menggunakan port 80, begitu pula dengan https, hanya saja https menggunakan port 443.</p><p>Tinggalkan setelan berikutnya sesuai default.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*Fzle6EiAYfd-gRqV-Qop3g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/815/1*WkOTI4_UTQWpyV3rfxCqEg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*BNzCw60UfEFEGy00ZKz2yg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*03HpbsVfvgCeU9bTmtPkHg.png" /></figure><p>Setelah itu, cobalah untuk melakukan login via SSH ke server yang telah dibuat, gunakan command berikut</p><pre>ssh &lt;ip address VM&gt;</pre><p>IP address VM ada di bagian profil resource (instance) yang telah dibuat</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w3lqdm2GLXgbQQR2eaaNGw.png" /></figure><p>Lihat di bagian networking, dan di public IP address, IP tersebut yang akan kita gunakan, yaitu 20.212.219.180. Sesuaikan perintah SSH dengan IP instance Anda.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*9Dyo0aIZZOg5xJllWx9fdw.png" /></figure><p>Anda telah sukses login ke perangkat Anda.</p><p>Dengan ini, menandakan selesainya part 1 dari serial pembuatan website sederhana hanya dengan VM Azure. Sampai jumpa di part selanjutnya!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d32177657aa7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cara Mengakses Server Remote melalui SSH]]></title>
            <link>https://alliefn.medium.com/cara-mengakses-server-remote-melalui-ssh-fc576a606622?source=rss-bcd0f39ecc71------2</link>
            <guid isPermaLink="false">https://medium.com/p/fc576a606622</guid>
            <dc:creator><![CDATA[Alif]]></dc:creator>
            <pubDate>Tue, 28 Sep 2021 07:30:58 GMT</pubDate>
            <atom:updated>2021-10-04T03:30:14.373Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*wD9S1VSev8fyblY_6R2iPA.png" /><figcaption>Sumber gambar: Hostinger.co.id</figcaption></figure><p>Bagaimana cara kita mengakses suatu perangkat apabila perangkat tersebut (<em>Physically</em>) jauh dari tempat kita? <em>Well</em>, pilihannya banyak sekali. Salah satu caranya ialah dengan menggunakan protokol SSH (<em>Secure Shell</em>). SSH sendiri merupakan suatu protokol untuk mengakses suatu komputer menggunakan CLI (<em>Command line interface</em>).</p><p>Dalam tutorial ini, kita akan mempelajari cara untuk menggunakan SSH terutama dalam menggunakannya untuk mengakses suatu perangkat <em>remote</em>.</p><p>Karena SSH sendiri biasanya ada di sistem operasi Linux, kita akan menggunakan sistem operasi tersebut dalam mengakses server target. Server target juga diasumsikan menggunakan Linux (Spesifiknya: <em>Debian-based</em>).</p><p><strong>Asumsi awal dalam artikel ini:</strong></p><ul><li>Anda tidak mempunyai sistem operasi Linux (Sehingga akan dipaparkan juga cara instalasinya), dan sistem operasi <em>host</em> Anda tidak menggunakan Linux (Sehingga akan menggunakan WSL).</li></ul><p><strong>Batasan dalam artikel ini:</strong></p><ul><li>Perangkat target &amp; perangkat host berada dalam jaringan Wi-Fi yang sama.</li></ul><h3><strong>Persiapan Awal</strong></h3><h4>Instalasi WSL</h4><p>Host machine yang akan kita gunakan untuk mengakses SSH adalah WSL (Windows Subsystem for Linux). Hal ini digunakan agar kita tidak perlu menggunakan <em>dual boot</em> ataupun menginstall sistem operasi Linux <em>natively</em> ke laptop/PC kita.</p><p>Langkah pertama dalam menginstall WSL ialah membuka powershell (Pastikan dijalankan sebagai <em>root/</em>administrator) dan mengetikkan perintah berikut:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/589/1*-E7kKRtbxORxiZs4ImJo9A.png" /><figcaption>Hasil ketika perintah sudah di<em>enter</em></figcaption></figure><pre>dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart</pre><p>Pastikan untuk merestart komputer Anda setelah ini.</p><p>Langkah kedua, unduhlah kernel linux di link berikut: <a href="https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi">https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi</a></p><p>Langkah ketiga, lakukan instalasi ke berkas yang telah Anda unduh.</p><p>Langkah keempat, buka powershell dan (Sekali lagi, sebagai administrator) dan jalankan perintah berikut:</p><pre>wsl --set-default-version 2</pre><p>Perintah ini dilakukan untuk mensetting versi dari WSL ke versi terbaru yaitu versi 2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/617/1*GpGu0IF10woE2SYpk9VZ8w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*eCgSFHyysTWSfhOVnejTHw.png" /></figure><p>Langkah kelima, buka Microsoft Store (Iya, Microsoft Store) dan pilih distribusi Linux yang ingin diinstall, penulis memilih Ubuntu agar lebih sederhana untuk digunakan. Ketika download sudah selesai, install.</p><p>Langkah keenam, set username &amp; passwordnya. WSL bisa digunakan. Yay.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/447/1*4_VTA7x4OYZTUi6TiPzIMw.png" /><figcaption>Hasil wslfetch</figcaption></figure><p>Bonus: Agar Anda terlihat seperti <em>hacker</em>, jalankan wsl lalu jalankan “wslfetch” pada terminalnya.</p><h4>Instalasi OS Target</h4><p>Saya asumsikan Anda sudah mempunyai Virtualbox pada perangkat Anda (Jika belum, silahkan diunduh &amp; dipasang terlebih dahulu). Tutorial ini tidak akan mengajarkan Anda untuk itu.</p><p>OS target ialah Debian yang dapat Anda unduh pada tautan berikut: (Lagi, saya membuat asumsi arsitektur prosessor Anda ialah AMD64) <a href="https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/debian-live-11.0.0-amd64-xfce.iso">https://cdimage.debian.org/debian-cd/current-live/amd64/iso-hybrid/debian-live-11.0.0-amd64-xfce.iso</a></p><p>ISO tersebut akan mengunduh Debian versi 11.0 untuk arsitektur prosessor AMD64 dan Desktop Environment XFCE (Jelek, tetapi highly customizable dan sangat ringan).</p><p><strong>Proses setup Virtualbox</strong></p><p><em>Let the pictures speak for you</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/465/1*L4fLYhTwOIc-Oew1rCkQnQ.png" /><figcaption>Bikin instance VM</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/1*jEOhFBOxbbsbr9y9UsMRVg.png" /><figcaption>Alokasi RAM</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/433/1*m1iI-c-esyeV7sKrvNnNqQ.png" /><figcaption>Insert .iso debian</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*VY7Es9o6t6O5P-AphHvlYg.png" /><figcaption>Set jaringan dalam VB</figcaption></figure><p>Sedikit penyebab mengapa langkah tersebut harus dilakukan: Coba ketikkan “hostname -I” pada terminal Debian setelah diinstall. Bandingkan <em>output-</em>nya jika Anda meninggalkan setting ini dalam default atau dimodifikasi seperti gambar diatas, bandingkan juga dengan IPv4 address lokal pada perangkat host kalian, gunakan “hostname -I” :)</p><p><strong>Instalasi Debian</strong></p><p>Instalasi Debian pada Virtualbox (Menurut saya) cukup intuitif &amp; mudah sehingga tidak memerlukan tutorialnya pada artikel ini.</p><p>Hanya saja, terdapat konfigurasi tambahan yang harus Anda lakukan (Tepat setelah instalasi), yaitu memodifikasi file /etc/sudoers (Edit sebagai root, gunakan “su -” untuk menggunakan terminal sebagai <em>rootuser</em>) dan menambahkan baris berikut, yaitu,</p><pre>alif ALL=(ALL:ALL) ALL</pre><p>(Perhatikan bahwa alif dapat disesuaikan dengan username yang Anda set saat instalasi)</p><p>setelah baris:</p><pre>root    ALL=(ALL:ALL) ALL</pre><p>Mengapa hal ini harus dilakukan? Coba untuk menjalankan suatu perintah dengan “sudo” (Contoh: sudo apt), bandingkan hasilnya sebelum &amp; sesudah modifikasi pada /etc/sudoers.</p><p><strong>Note:</strong></p><p><em>Sebelum ke tahap berikutnya penulis melakukan modifikasi besar-besaran pada Debiannya sehingga Debiannya menjadi lebih bagus untuk dilihat. Sehingga jangan terkejut jika Debian yang Anda punya berbeda dengan Debian pada section selanjutnya.</em></p><h3>Remote SSH</h3><h4>Akses server menggunakan SSH</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*kVGgnwM2L4iVuQsAXsQpFA.png" /><figcaption>Instalasi openssh-server</figcaption></figure><p>Langkah pertama: Instalasi openssh-server. Debian tidak mempunyai <em>built-in ssh</em> server, sehingga pasang terlebih dahulu. Gunakan perintah berikut:</p><pre>sudo apt install openssh-server -y</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*wSqAyoYRg373KVA846PvfA.png" /></figure><p>Langkah kedua: Modifikasi file /etc/ssh/sshd_config, ubah line “#Port 22” menjadi “Port 22” (Iya, hilangkan ‘#’ saja). Hal ini dilakukan agar port 22 dapat diakses protokol ssh. Restart servernya setelah ini dengan:</p><pre>sudo /etc/init.d/ssh restart</pre><p>Langkah ketiga: Periksa IP address (Lokal) dari server, jalankan baris berikut pada terminal:</p><pre>hostname -I</pre><p>Keluarannya — jika Anda mengkonfigurasi Virtualbox dengan benar (Benar == Sesuai artikel) &amp; host-server pada Wi-Fi yang sama, seharusnya telah memberi informasi yang cukup untuk SSH ke server.</p><p>Kita anggap keluaran dari hostname -I ialah 192.168.0.114 (Mungkin berbeda untuk Anda).</p><p>Langkah keempat: Pada host (WSL), jalankan perintah berikut pada WSL</p><pre>ssh -l alif 192.168.0.114 -p 22</pre><p>Artinya:</p><p>Lakukan ssh ke <strong>192.168.0.114</strong> dengan login sebagai <strong>alif</strong> pada port <strong>22</strong>.</p><p><strong>Bold</strong>: Variabel, mungkin berbeda untuk Anda :)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/1*PvnFp7wakfr_aSIG5t6uvA.png" /><figcaption>Perintah alternatif, outputnya sama kok</figcaption></figure><p>Anda akan diminta password, berikut tutorial menghilangkan kewajiban menggunakan password ketika ssh ke server.</p><h4>Akses server menggunakan SSH tanpa password</h4><p>Untuk mengakses server dengan protokol SSH tanpa perlu memasukkan password terus-menerus, kita memerlukan suatu tambahan, tambahan yang dimaksud ialah SSH Key. SSH key sendiri sederhananya bekerja seperti kunci pada di dunia nyata.</p><p>Bagaimana cara kerja SSH key dalam mengakses server lewat protokol SSH tanpa password? Singkatnya, SSH key terdiri dari dua komponen, file publik dan file privat. File privat akan disimpan pada host machine. Sedangkan, file publik akan disimpan pada server. Ketika kita ingin login ke server, file publik server, layaknya sebuah kunci, akan dicocokkan (Peringatan: <em>Don’t take this too literal</em>) dengan file privat pada perangkat kita layaknya sebuah kunci yang dihubungkan dengan ‘lubang’ kunci.</p><p>Anda diasumsikan belum mempunyai SSH key pada perangkat yang Anda gunakan untuk mengakses target, sehingga saya akan mengajarkan bagaimana men<em>generate</em> SSH key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/368/1*nAlAiXXgaPBj9NxCQ9pm9Q.png" /></figure><p>SSH Key akan digenerate di mesin yang akan digunakan untuk mengakses server, untuk menggenerate SSH Key, gunakan perintah berikut:</p><pre>ssh-keygen</pre><p>Setelah perintah berikut dimasukkan, terminal meminta penulis untuk memasukkan nama file yang digunakan sebagai SSH Key, defaultnya, nama dari SSH keynya adalah id_rsa dan disimpan ke folder ~/.ssh</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/176/1*kv5EFs7O9RJf3ZXxaGFRiA.png" /></figure><p>Sehingga akan ada dua file yang digenerate pada direktori ~/.ssh, yaitu <strong>id_rsa</strong> sebagai private key, dan <strong>id_rsa.pub</strong> sebagai public key.</p><p>Kita akan memindahkan file id_rsa.pub ke server.</p><p>Untuk memindahkan file id_rsa.pub ke server, kita gunakan perintah berikut:</p><pre>ssh-copy-id -i ~/.ssh/id_rsa.pub alif@192.168.0.114 -p 22</pre><p>Maksud dari perintah berikut adalah, kita akan menggunakan <strong>ssh-copy-id</strong> dengan paramater i untuk menunjukkan bahwa kita ingin memindahkan suatu file, dalam hal ini <strong>id_rsa.pub</strong> pada folder ~/.ssh ke server dengan username alif dan IP address lokal 192.168.0.114 yang diakses melalui port 22 (Seperti tadi, jika pada <em>step</em> sebelumnya port 22 diubah ke port X, maka perintah disini harus menyesuaikan dengan perubahan tersebut).</p><p>Setelah kita menjalankan perintah tersebut, kita akan mencoba login ke server, dengan menggunakan perintah yang telah tertulis pada gambar.</p><pre>ssh -p 22 alif@192.168.0.114</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/583/1*iyB51URiFwLUKjko6rt0tg.png" /></figure><p>Dapat dilihat bahwa kita telah login tanpa server meminta kita untuk mengetikkan password.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc576a606622" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Types of Machine Learning Algorithms — Explained]]></title>
            <link>https://alliefn.medium.com/types-of-machine-learning-algorithms-explained-cbfe0447cd03?source=rss-bcd0f39ecc71------2</link>
            <guid isPermaLink="false">https://medium.com/p/cbfe0447cd03</guid>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Alif]]></dc:creator>
            <pubDate>Sat, 05 Jun 2021 18:26:06 GMT</pubDate>
            <atom:updated>2021-06-05T18:26:06.472Z</atom:updated>
            <content:encoded><![CDATA[<h3>Types of Machine Learning Algorithms — Explained</h3><p>Supervised, unsupervised, and others</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*hIq9Oj_KyIf7DNK4Rdl13g.jpeg" /><figcaption>Image source: <a href="https://simenteknindo.com/news/machine-learning/">https://simenteknindo.com/news/machine-learning/</a></figcaption></figure><p>Machine Learning informally defined as how the program improves itself gradually without manually/explicitly programmed. For example, an AI in email can identify which of the received messages is spam or not spam gradually.</p><p>The formal definition of Machine Learning is a computer program is said to learn (which is why it’s called “Machine Learning”) from experience E with respect to task T and some performance measure P, if its performance on T, as measured by P, improves with experience E. What does it mean? Lets return to the previous example, when an AI is observing us mark email as spam, it is said as the experience E, when the AI identify the spam emails, it is the task T. What is the performance measure? The performance measure (P) is emails that are correctly identified as spam. If the performance of T is increasing after E, that means we can infer that the AI is learning, hence, it is Machine Learning.</p><p>There are some types of Machine Learning algorithms, which I will explain on this article.</p><h3>Supervised Learning</h3><p>At its core, supervised learning is basically how a machine can learn if we give it many inputs of dataset and observation with a certain label (that are already correct). The machine will attempt to learn the dataset and recognize new input and categorized it correctly.</p><p>One of the example of supervised learning is this housing price prediction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/685/1*-yM6hUlWRAdjrhjP4x92gg.png" /><figcaption>Housing price predition. Image source: <a href="https://www.youtube.com/watch?v=bQI5uDxrFfA">https://www.youtube.com/watch?v=bQI5uDxrFfA</a></figcaption></figure><p>Let’s say, given this data, we wanted to sell a house with a 750 feet². How much we can get from this 750 feet² house?</p><p>The learning algorithm — the supervised algorithm will attempt to make prediction by drawing a straight line over the graph. However, the straight line prediction isn’t forever, eventually, it will recognize another “good” prediction, like drawing a quadratic polynomial line or some other line that are closer to the shape of the graph.</p><p>The idea is, we give the “right answers” to the machine, and the machine will learn how the right answer is.</p><p>This housing price problem, is also called <strong>regression problem </strong>(which is one of the types of supervised learning), where we predict continous problem valued output.</p><p>Another example of supervised learning is the animal labelling problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t6Y0Ao4WQ6KD6yGI3vLkFA.jpeg" /><figcaption>Image source: <a href="https://towardsdatascience.com/what-is-machine-learning-a-short-note-on-supervised-unsupervised-semi-supervised-and-aed1573ae9bb">https://towardsdatascience.com/what-is-machine-learning-a-short-note-on-supervised-unsupervised-semi-supervised-and-aed1573ae9bb</a></figcaption></figure><p>Given a set of pictures of cats and dogs — and we already label the pics as either cat and dog, we give this dataset to the machine. After the data is processed, we test the machine by giving it a picture (still, it’s either a cat or dog), and let the machine decide it is dog or cat.</p><p>This type of problem is called <strong>classification problem</strong> (Discrete valued output), and it is one of the types of supervised learning.</p><p><em>Summary: The idea of supervised learning is making the machine learnt by giving it a dataset, the output we expect can be discrete (It usually about classification problem) or continue (It usually about regression problem)</em></p><h3>Unsupervised Learning</h3><p>Unsupervised learning is when we doesn’t give the labels on the input we gives to the machine, we only give it the dataset and let it identify any structure of pattern inside. We don’t have any target or outcome to predict nor estimate. One of the uses of this type of algorithm is for segmenting customers based on a certain category.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/301/1*_8bdDKv-p6VcGGxj_HEpMg.png" /><figcaption>Image source: <a href="https://www.youtube.com/watch?v=jAA2g9ItoAc&amp;list=PLLssT5z_DsK-h9vYZkQkYNWcItqhlRJLN&amp;index=3">https://www.youtube.com/watch?v=jAA2g9ItoAc</a></figcaption></figure><p><strong>Cocktail party problem</strong></p><p>Let’s say we’re in a party where many people talk at the same time, obviously there are many overlapping voices and it’s hard to hear what the person in front of you.</p><p>Okay, maybe it was to extreme, let’s say there are only two person inside, with a two microphone, if we listen to the microphone, of course we willl hearing two distinct voices! This unsupervised learning will get rid of the other voice so we can hear the two distinct voices separately. This is one of the example of unsupervised learning.</p><h3><strong>Reinforcement Learning</strong></h3><p>By using this type of algorithm, the machine will exposed to an environment where it trains itself with using a trial-and-error method. It will learn from pass experiences and capture the best knowledge to used.</p><p>The machine will be put in a game-like situation where the gets rewards or penalties (But not both) for the action it performs. The goal is to maximize the reward and penalties.</p><p>To explain it more simple, let’s take a look at this example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*uS8D4m4qR_VQ6LF3PsgFvQ.png" /><figcaption>Image source: <a href="https://www.geeksforgeeks.org/what-is-reinforcement-learning/">https://www.geeksforgeeks.org/what-is-reinforcement-learning/</a></figcaption></figure><p>The AI is the robot, the goal is to move to diamond with fewer steps as possible and avoiding fire. Each step will give reward for the robot (If the step is right) and wrong step will reduce it. When it reach the diamond, the total reward will be calculated.</p><p>Important elements in reinforced learning:</p><ul><li>Input: Initial state of the model</li><li>Output: Variety of the solutions, effect of the input to the machine</li><li>Training: Based on the input, the model will return a state and the AI will be rewarded/punished based on the output</li><li>Best solution: Solution that make up for the most reward</li><li>One last thing (And its quite obvious): The model will learn gradually</li></ul><h3><strong>References</strong></h3><ul><li>Artificial Intelligence — All in One, 2016. <em>Lecture 1.1 — What Is Machine Learning — [ Machine Learning | Andrew Ng ]</em>. [video] Available at: &lt;<a href="https://www.youtube.com/watch?v=PPLop4L2eGk">https://www.youtube.com/watch?v=PPLop4L2eGk</a>&gt; [Accessed 5 June 2021].</li><li>Loukas, S., 2020. <em>What is Machine Learning: A Short Note on Supervised, Unsupervised, Semi-Supervised and…</em>. [online] Medium. Available at: &lt;<a href="https://towardsdatascience.com/what-is-machine-learning-a-short-note-on-supervised-unsupervised-semi-supervised-and-aed1573ae9bb">https://towardsdatascience.com/what-is-machine-learning-a-short-note-on-supervised-unsupervised-semi-supervised-and-aed1573ae9bb</a>&gt; [Accessed 5 June 2021].</li><li>Ray, S., 2017. <em>Commonly used Machine Learning Algorithms (with Python and R Codes)</em>. [online] Analytics Vidhya. Available at: &lt;<a href="https://www.analyticsvidhya.com/blog/2017/09/common-machine-learning-algorithms/">https://www.analyticsvidhya.com/blog/2017/09/common-machine-learning-algorithms/</a>&gt; [Accessed 5 June 2021].</li><li>Artificial Intelligence — All in One. 2016. <em>Lecture 1.2 — Supervised Learning — [ Machine Learning | Andrew Ng ]</em>. [online] Available at: &lt;<a href="https://www.youtube.com/watch?v=bQI5uDxrFfA">https://www.youtube.com/watch?v=bQI5uDxrFfA</a>&gt; [Accessed 5 June 2021].</li><li>Artificial Intelligence — All in One. 2016. <em>Lecture 1.3 — Unsupervised Learning — [ Machine Learning | Andrew Ng]</em>. [online] Available at: &lt;<a href="https://www.youtube.com/watch?v=jAA2g9ItoAc">https://www.youtube.com/watch?v=jAA2g9ItoAc</a>&gt; [Accessed 5 June 2021].</li><li>GeeksforGeeks. 2020. <em>Reinforcement learning — GeeksforGeeks</em>. [online] Available at: &lt;<a href="https://www.geeksforgeeks.org/what-is-reinforcement-learning/">https://www.geeksforgeeks.org/what-is-reinforcement-learning/</a>&gt; [Accessed 5 June 2021].</li><li>Osiński, B. and Budek, K., 2018. <em>What is reinforcement learning? The complete guide — deepsense.ai</em>. [online] deepsense.ai. Available at: &lt;<a href="https://deepsense.ai/what-is-reinforcement-learning-the-complete-guide/">https://deepsense.ai/what-is-reinforcement-learning-the-complete-guide/</a>&gt; [Accessed 5 June 2021].</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cbfe0447cd03" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Covid-19: Globalisasi dan Masa Depannya]]></title>
            <link>https://alliefn.medium.com/dunia-pasca-covid-19-spekulasi-futurisme-globalisasi-3b2bae19c0a6?source=rss-bcd0f39ecc71------2</link>
            <guid isPermaLink="false">https://medium.com/p/3b2bae19c0a6</guid>
            <category><![CDATA[coronavirus]]></category>
            <category><![CDATA[politics]]></category>
            <category><![CDATA[globalization]]></category>
            <category><![CDATA[economics]]></category>
            <category><![CDATA[world]]></category>
            <dc:creator><![CDATA[Alif]]></dc:creator>
            <pubDate>Sun, 16 Aug 2020 14:30:43 GMT</pubDate>
            <atom:updated>2020-08-16T18:00:54.241Z</atom:updated>
            <content:encoded><![CDATA[<p>Akankah Covid-19 mengakhiri hegemoni globalisasi dan memicu deglobalisasi masif?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*DoST9h7qtoBZgSMx1W8TiQ.jpeg" /></figure><p>Bicara mengenai Covid-19 tidak ada habis-habisnya. Virus ini berhasil mengelilingi dunia dalam waktu beberapa bulan dan mendisrupsi kehidupan manusia sampai-sampai manusia pun terpaksa melakukan restrukturisasi kehidupan. Seperti sistem pembelajaran yang dengan terpaksa harus dilakukan secara virtual, pekerjaan yang dilakukan melalui lapangan internet, dan juga, ekonomi yang berbasis konsumerisme agak terhambat karena <em>physical distancing</em>.</p><p>Perubahan-perubahan tersebut mungkin bersifat sementara, tetapi apakah memang begitu (sementara)? Kalaupun memang sementara, apakah Anda yakin itu tidak akan membuat suatu impact? Mengingat, dalam setiap peristiwa yang berpengaruh dalam skala global — seperti Perang Dunia 2, selalu ada <em>impact</em> setelah peristiwa-peristiwa tersebut.</p><p>Sekarang, bicara mengenai perubahan, mari kita mengarah ke suatu topik, topik yang mungkin terdengar kompleks, berat, tidak [terlalu] relevan dengan kehidupan sehari-hari, tetapi bagi saya cukup menarik buat dibahas: Globalisasi. Akankah Covid-19 ini mengubah aspek ini secara masif? Hmm.</p><p>Sebagaimana kita ketahui, saat artikel ini ditulis, dunia ini dilanda oleh pandemi Covid-19. Pandemi tersebut bermula dari sebuah kota yang dulunya tidak sehits sekarang, Wuhan. Walaupun umat manusia sudah pernah mengalami pandemi dan sukses melewatinya, pada masa ini, globalisasi sangat mempermudah virus ini untuk mengelilingi dunia dan menambah pengidapnya dalam waktu yang relatif singkat. Sejak April 2020, pandemi ini telah mempengaruhi 181 negara dan sebanyak 58.000 kematian [4].</p><p>Saya ingin menyoroti satu kata yang berada pada paragraf sebelumnya, yaitu <strong>globalisasi</strong>. Ada apa memang dengan globalisasi?</p><p>Oh ya, mengenai deglobalisasi, sebenarnya tren itu sudah dimulai sejak Donald Trump menjadi presiden Amerika, kebijakannya yang isolasionis, obsesinya dengan perang dagang China, memulai tren ini [8]. Apalagi dengan dukungannya yang berasal dari <em>alt-right.</em></p><p>Mari kita tinjau hal ini dari negara pertama yang terkena wabah penyakit ini, China. Walaupun China sudah [sejauh ini] sukses menangani Covid-19, mereka masih berpotensi untuk terkena gelombang kedua, mengapa begitu? Hal tersebut merupakan suatu potensi, karena selama mereka masih membuka negaranya, dan mayoritas dari penduduknya belum ‘merasakan’ Covid-19, risiko gelombang kedua sangatlah besar [4].</p><p>Bagaimana dengan negara lain seperti negara-negara di Eropa dan Amerika Utara? Apa perbedaannya dengan China dalam hal penanganan pandemi ini? Metode China dalam menangani pandemi ini jauh lebih represif, tidak seperti negara-negara tersebut [4] [1] [5]. Walaupun tentu saja hal tersebut merupakan hal yang wajar dikarenakan perbedaan budaya dan sistem.</p><p>Hal yang menarik adalah, metode yang digunakan negara-negara seperti China, Polandia, Slovakia, Itali, dan Korea Selatan — yang kebijakan publiknya lebih radikal, skala besar, lebih efektif daripada cara yang digunakan di US, Britanita Raya, dan negara lainnya yang tidak seketat negara tersebut [1]. Bahkan, pemerintah Slovakia sempat mengesahkan UU yang membuat pemerintah dapat menggunakan data dari perusahaan telekomunikasi untuk melacak pergerakan korban dan memastikan mereka tetap mematuhi aturan karantina, dengan argumen bahwa dalam kondisi darurat seperti ini, privasi tidak bisa menjadi absolut [5]. Argumen yang melawan hal ini adalah, hal tersebut sangatlah dipengaruhi juga oleh kedisiplinan rakyat, efektifitas sistem kesehatan, dan efek pandemi terhadap ekonomi, negara-negara dengan koneksi sosial (sangat kolektif), jauh lebih berisiko terhadap Covid-19 [6].</p><p>Sementara itu, bahkan negara yang secara umum dianggap negara bebas, juga ikut menggunakan metode seperti ini. Pemerintah Perancis mengizinkan polisi untuk mengawasi apakah protokol kesehatan karantina tetap diikuti oleh warga negaranya, tentu saja hal ini melanggar privasi yang merupakan bagian dari hak asasi manusia (HAM) [5]. Suatu hal yang menarik untuk membahas kaitan apakah kesehatan publik sepadan dengan ketiadaan penjaminan HAM, namun itu tidak akan dibahas disini.</p><p>Tak terpungkiri, peran negara dalam penanganan pandemi ini sangatlah tinggi, bisa jadi hal ini mendorong berbagai negara melakukan proses yang secara tidak langsung menyebabkan de-globalisasi. Disisi lain, bilamana perlawanan terhadap Covid-19 lebih internasional, yang didukung dengan dibukanya akses jurnal medis tentang Coronavirus, bisa saja ini menjadi hal positif bagi globalisasi [1].</p><p>Sebenarnya bila kita lihat kondisi sekarang dari sudut pandang pariwisata, de-globalisasi sudah terjadi secara signifikan, tidak pernah ada kekuatan yang cukup besar untuk memundurkan globalisasi ini selain Covid-19 [2]. Dengan Covid-19 ini, jarak geografis lebih terasa dan tidak sekadar formalitas di aturan-aturan negara, jarak relatif sudah meningkat, dan tempat terpencil telah kembali menjadi terpencil lagi. Teknologi komunikasi yang maju tentu masih berperan, bahkan perannya semakin besar, walaupun hal tersebut tidak akan menggantikan kompresi jarak-waktu yang dilakukan oleh globalisasi. Pariwisata dan <em>tourism</em> telah mati suri (di berbagai negara) atau terpaksa berubah menjadi bentuk lainnya.</p><p>Dengan segala keburukan dan kebaikannya, globalisasi merupakan suatu keuntungan bagi umat manusia. Globalisasilah yang menghubungkan negara-negara yang ‘bermasalah’ dengan negara-negara ‘safe haven’, Covid-19 ini — untuk manusia, merupakan suatu pengingat bahwa penyakit, dan hal-hal buruk yang mengintai manusia lebih dekat daripada yang kita pikirkan. Umat manusia akan terombang-ambing antara globalisasi dan deglobalisasi [7].</p><p>Demikian artikel ini, efek Covid-19 terhadap globalisasi masih akan bersifat abu-abu — dengan kasus terbaik, ataupun merosot terjun bebas dalam kasus terburuk. Mengingat kita masih di fase pertengahan dalam menghadapi virus ini, ada baiknya jika pembaca mengkritisi penulis. Juga, artikel ini bersifat spekulatif dengan argumen dan data yang berasal dari jurnal ilmiah. Jangan dimakan mentah-mentah. Kritisi selagi masih bisa mengkritisi.</p><p>Sebagai penutup, silakan tonton video di bawah ini:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FXsArdIXgRTU%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DXsArdIXgRTU&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FXsArdIXgRTU%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/56cf7f1d59a569212c8bf86d3a32e7cb/href">https://medium.com/media/56cf7f1d59a569212c8bf86d3a32e7cb/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*0wGBiyqLFFaet5NiusbLvg.jpeg" /><figcaption>Tak terkecuali dengan pernyataan ini.</figcaption></figure><h3>DAFTAR PUSTAKA</h3><p>Tidak afdhol jika saya membuat artikel tanpa mencantumkan referensi data maupun temuan yang saya dapat ;).</p><p>[1] Sułkowski, Łukasz. “Covid-19 pandemic; recession, virtual revolution leading to de-globalization?.” <em>Journal of Intercultural Management</em> 12.1 (2020): 1–11.</p><p>[2] Niewiadomski, Piotr. “COVID-19: from temporary de-globalisation to a re-discovery of tourism?.” <em>Tourism Geographies</em> (2020): 1–6.</p><p>[3] Jackson, Emerson Abraham. “Emerging Innovative Thoughts on Globalization amidst the Contageon of COVID-19.” (2020): 1–17.</p><p>[4] S. Mas-Coma, M.K. Jones and A.M. Marty, COVID-19 and globalization, One Health (2020), <a href="https://doi.org/10.1016/j.onehlt.2020.100132">https://doi.org/10.1016/j.onehlt.2020.100132</a></p><p>[5] Jenny, Frederic. “Economic Resilience, Globalization and Market Governance: Facing the COVID-19 Test.” <em>Globalization and Market Governance: Facing the COVID-19 Test (March 28, 2020)</em> (2020).</p><p>[6] Farzanegan, Mohammad Reza, Mehdi Feizi, and Hassan F. Gholipour. “Globalization and outbreak of COVID-19: An empirical analysis.” (2020).</p><p>[7] Pross, Addy. “COVID‐19, Globalization, De‐globalization and the Slime Mold’s Lessons For Us All.” <em>Israel Journal of Chemistry</em> (2020).</p><p>[8] Tsegaye, Kebede Kassa. “Stay at home: Coronavirus (COVID-19), isolationism and the future of globalization.” <em>African Journal of Political Science and International Relations</em> 14.3 (2020): 84–90.</p><p>[9] Farrell, Henry, and Abraham Newman. “Will the Coronavirus End Globalization as We Know It?.” <em>Foreign Affairs</em> 16 (2020).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*ggBbt5ecWUrYkx--3l6e2w.jpeg" /><figcaption>Pil merah atau pil biru?</figcaption></figure><p><strong>SALAM PEMBEBASAN.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3b2bae19c0a6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bagaimana Cara Kerja dari Metode Saintifik? — Studi Komparatif antar Aliran Metode Berpikir]]></title>
            <link>https://alliefn.medium.com/bagaimana-cara-kerja-dari-metode-saintifik-studi-komparatif-antar-aliran-metode-berpikir-e52acdc8577b?source=rss-bcd0f39ecc71------2</link>
            <guid isPermaLink="false">https://medium.com/p/e52acdc8577b</guid>
            <category><![CDATA[sains]]></category>
            <category><![CDATA[filsafat]]></category>
            <category><![CDATA[berpikir]]></category>
            <dc:creator><![CDATA[Alif]]></dc:creator>
            <pubDate>Tue, 28 Jul 2020 02:09:36 GMT</pubDate>
            <atom:updated>2020-07-28T05:00:49.215Z</atom:updated>
            <content:encoded><![CDATA[<h3>Bagaimana Cara Kerja dari Metode Saintifik? — Studi Komparatif antar Aliran Metode Berpikir</h3><p>“…believe in justification, not by faith, but by verification.” — Thomas Huxley</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*KekYUQRIq4CMeM9oux4l7A.png" /><figcaption>Gambar hanya pemanis</figcaption></figure><p>Sepanjang sejarah, terdapat berbagai metode-metode berpikir sebagai sebuah cara untuk mendekatkan manusia pada kebenaran. Sebagai contoh, metode saintifik, metode rasional, dan metode empiris. Terdapat juga metode-metode lainnya yang akan dibahas di artikel ini.</p><p>Bicara tentang metode saintifik, atau dikenal dengan metode ilmiah, mungkin yang Anda bayangkan — Dengan mengasumsikan Anda mengingat pelajaran saat SMA atau SMP, mungkin Anda teringat dengan <em>flowchart</em> membosankan yang harus dihafal di bawah ini:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/415/1*C1v45TudscADxBfZxvB7_g.png" /><figcaption>Aduh, hafalan lagi, hafalan lagi</figcaption></figure><p>Terlepas dari seberapa membosankan <em>flowchart</em> ini, sebenarnya peran metode ilmiah dalam kehidupan modern ini sangatlah besar. Metode ilmiah bahkan menjadi suatu bahasa universal untuk studi ilmiah di seluruh dunia [4]. Mengutip Carl Sagan, seorang komunikator sains, “<em>In every country, we should be teaching our children the scientific method and the reasons for a Bill of Rights. With it comes a certain decency, humility and community spirit. In the demon-haunted world that we inhabit by virtue of being human, this may be all that stands between us and the enveloping darkness”.</em></p><p>Apa rahasia dari metode ilmiah ini? Jika kita telaah lebih jauh, sebenarnya metode ilmiah ini adalah metode terampuh dalam mengurangi bias ketika melakukan suatu riset ataupun menjawab pertanyaan. Bahkan tanpa kita sadari, metode ilmiah ini sudah merasuki cara kita, masyarakat intelektual, menjawab pertanyaan-pertanyaan yang membuat kita berkontemplasi ria.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*Uzl3u6-hHiQaGc8QTFv7tw.jpeg" /><figcaption>Sebenarnya metode saintifik itu tidak sesimpel yang diajarkan di sekolah formal</figcaption></figure><h4><strong>Ask a Question &amp; Research</strong></h4><p>Suatu penelitian ataupun kesimpulan tentunya bermula dari suatu rasa penasaran yang <em>exist</em> dalam sebuah kontemplasi makhluk <em>homo sapien</em>s. Apakah ada kriteria tertentu mengenai pertanyaan yang ditanyakan? Umumnya pertanyaan 5W1H yang diajukan. Walaupun dalam kasus <em>Natural Science</em>, pertanyaan yang biasa diajukan adalah pertanyaan yang bisa diukur secara kuantitatif [5]. Menanyakan pertanyaan yang baik bisa menjadi suatu hal yang sulit dan akan sangat berdampak dengan hasil penelitian.</p><p>Terkadang proses menanyakan pertanyaan dilakukan terlebih dahulu, dan juga terkadang proses yang dilakukan pertama kali adalah melakukan riset dan pengamatan. Pengamatan yang dilakukan tidak harus melalui pengamatan di laboratorium, ataupun di kelas. Pengamatan tersebut bisa juga dilakukan di alam / luar ruangan.</p><p>Selain pengamatan, riset juga bisa dilakukan pada step ini. Riset sendiri sebenarnya bentuk pengamatan yang dilakukan secara tidak langsung melalui studi dokumen, jurnal, dan lainnya.</p><h4><strong>Formulasi Hipotesis</strong></h4><p>Hipotesis adalah sebuah… hipotesis.</p><p>Oke mungkin itu tidak menyelesaikan pertanyaannya.</p><p>Hipotesis itu suatu dugaan berdasar yang dibangun atas pengamatan dan riset yang telah dilakukan. Umumnya dihasilkan oleh silogisme seperti deduktif ataupun induktif. Silogisme deduktif adalah menyimpulkan sesuatu atas suatu pernyataan umum yang dianggap benar. Sebagai contoh,</p><p><em>Manusia akan meninggal </em>(Pernyataan umum)</p><p><em>Socrates adalah manusia </em>(Pernyataan khusus)</p><p><em>Artinya, Socrates akan meninggal </em>(Kesimpulan)</p><p>Sedangkan, silogisme induktif adalah kebalikan dari silogisme deduktif, pernyataan-pernyataan khusus disimpulkan menjadi pernyataan umum. Sebenarnya pada dasarnya yang dilakukan sains adalah hal ini, karena itu sains itu sangat rentan berubah meskipun lama. Sebagai contoh:</p><p><em>Angsa di Australia putih</em></p><p><em>Angsa di Asia putih</em></p><p><em>Angsa di Afrika putih</em></p><p><em>Maka, semua angsa warnanya putih</em></p><p>Seperti biasa, suatu hipotesis haruslah dapat dites dan dibuktikan ataupun ditidakbuktikan pernyataannya. Hipotesis seperti “Saya berpikir bahwa ada sebuah teko yang beredar di antara Mars dan Bumi” tentu saja sulit untuk dibuktikan dan tidak bisa dijadikan sebagai suatu hipotesis yang mumpuni. Namun, hipotesis berupa “Jika balon ini saya jatuhkan, maka arah gerak dia akan menuju ke bawah” merupakan hipotesis yang cukup <em>pas</em> untuk diajukan.</p><h4><strong>Tahap Percobaan</strong></h4><p>Pada tahap ini mulai cukup menarik, pada dasarnya dalam melakukan percobaan, percobaan tersebut didesain dulu sedemikian rupa agar dapat diulangidan dapat diverifikasi dan <em>falsifiable. </em>Tujuan dari melakukan hal ini adalah untuk mengetes apakah pengamatan dari dunia nyata sesuai ataupun tidak sesuai dengan hipotesis yang telah dinyatakan. Jika sesuai, maka akurasi dari hipotesis meningkat, dan sebaliknya. Eksperimen yang dilakukan kelaknya tidak akan menjamin masalah tidak terjadi. Sejumlah kasus yang mendukung hipotesis bisa saja menjadi tidak valid apabila kasus tersebut didasarkan oleh percobaan yang riskan.</p><p>Mungkin di SMA Anda pernah mendengar mengenai variabel kontrol, bebas, maupun terikat. Ini merupakan contoh metode untuk meningkatkan akurasi hasil dan proses dari percobaan. Sementara itu, contoh lain dari hal ini adalah melakukan percobaan dimana subjek hanya mengikuti instruksi tanpa membuka mata (<a href="https://en.wikipedia.org/wiki/Blinded_experiment#Double-blind_trials">https://en.wikipedia.org/wiki/Blinded_experiment#Double-blind_trials</a>), atau biasa dikenal dengan <em>double blind trials</em>.</p><p>Eksperimen atau percobaan, dapat dilakukan di lab, dapur, <em>Large Hadron Collider</em> di CERN, dasar laut, Mars, dan lainnya. Selama <em>feasible</em> untuk dilakukan dan direplikasi, percobaan bisa dilakukan dimanapun.</p><h4><strong>Analisa &amp; Publikasi</strong></h4><p>Setelah melakukan tahap-tahap sebelumnya, yang selanjutnya dilakukan adalah menganalisa data yang telah diambil. Hal tersebut bisa berupa membandingkan dengan percobaan-percobaan lain dan hasil ideal percobaan berdasarkan hipotesis yang telah dinyatakan.</p><p>Pada beberapa kasus, eksperimen dilakukan berulang kali untuk menjamin suatu hasil yang konsisten dan mempunyai <em>error</em> yang sedikit. Apabila hal tersebut dilakukan, diperlukan suatu metode statistika. Disini itu tidak akan dibahas karena akan cukup panjang dan <em>off-topic</em>.</p><p>Bagaimana metode saintifik ini dapat bertahan selama ratusan tahun lamanya?</p><p>Sebelum metode ilmiah benar-benar matang, ada dua metode lain yang digunakan secara marak. Rasionalisme dan Empirisme.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/1*pnSn6vZse300nEHA-gYYBQ.jpeg" /><figcaption>Descartes, salah satu tokoh rasionalis</figcaption></figure><p>Rasionalisme menyatakan bahwa sumber ilmu pengetahuan yang dapat dipercaya adalah akal. Dan hanya akal, pengetahuan dari akallah yang dapat dituntut oleh semua ilmu pengetahuan ilmiah. Mengutip Descartes, “<em>Dubito ergo cogito cogito ergo sum”. </em>Makna dari <em>quotes</em> tersebut — dalam kasus ekstrim, apabila segala hal yang didunia ini merupakan kepalsuan, suatu ilusi yang dibuat oleh suatu iblis yang mahakuat, ada suatu hal yang nyata adanya: pikiran manusia.</p><p>Kelemahan dari rasionalisme — adalah ketidaksesuaiannya dengan sains, sains tidak hanya membutuhkan akal untuk berkembang, melainkan membutuhkan suatu pengalaman yang diperoleh dari dunia nyata [1]. Meskipun bisa jadi indra manusia menipu, tidak dipungkiri lagi bahwa belum kreasi manusia yang bisa menandinginya. Dikarenakan kendala ini, banyak tokoh rasionalisme menjadi Matematikawan dan Filsuf.</p><p>Sementara itu, empirisme menyatakan bahwa pengetahuan itu bersumber dari luar. Atau, menyatakan bahwa semua <a href="https://id.wikipedia.org/wiki/Pengetahuan">pengetahuan</a> berasal dari <a href="https://id.wikipedia.org/wiki/Pengalaman">pengalaman</a> <a href="https://id.wikipedia.org/wiki/Manusia">manusia</a>. Empirisme menolak anggapan bahwa manusia telah membawa fitrah pengetahuan dalam dirinya ketika dilahirkan. Ajaran empirisme memberikan kebimbangan kepada sains dan agama pada zaman modern filsafat, sehingga dapat diasumsikan mengecilkan peranan akal.</p><h3><strong>Referensi</strong></h3><p>[1] Markie, Peter, “Rationalism vs. Empiricism”, <em>The Stanford Encyclopedia of Philosophy </em>(Fall 2017 Edition), Edward N. Zalta (ed.), URL = &lt;https://plato.stanford.edu/archives/fall2017/entries/rationalism-empiricism/&gt;.</p><p>[2] Harris, William. 2020. “How the Scientific Method Works”, <a href="https://science.howstuffworks.com/innovation/scientific-experiments/scientific-method3.htm">https://science.howstuffworks.com/innovation/scientific-experiments/scientific-method6.htm</a>, diakses pada 24 Juli 2020 pukul 08:31 WIB.</p><p>[3] Gauch Jr, Hugh G., Hugh G. Gauch, and Hugh G. Gauch Jr. <em>Scientific method in practice</em>. Cambridge University Press, 2003.</p><p>[4] Ost, Parker. 2014. “The Impact Of The Scientific Method On The Scientific Revolution”, <a href="https://www.academia.edu/9717286/The_Impact_Of_The_Scientific_Method_On_The_Scientific_Revolution">https://www.academia.edu/9717286/The_Impact_Of_The_Scientific_Method_On_The_Scientific_Revolution</a>, diakses pada 27 Juli 2020 pukul 12:10</p><p>[5] “Steps of the Scientific Method”, <a href="https://www.sciencebuddies.org/science-fair-projects/science-fair/steps-of-the-scientific-method">https://www.sciencebuddies.org/science-fair-projects/science-fair/steps-of-the-scientific-method</a>, diakses pada 27 Juli 2020 pukul 16:17.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e52acdc8577b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>