What’s wrong with the Container?

I wanted to provision a Japanese version of my website but one of the containers kept on restarting. I couldn’t figure out what’s wrong with it for a while.

I finally figured out how to view the log of the container.

docker logs --tail 50 --follow --timestamps [container ID]

Here is the log output.

2022-03-13T05:46:44.573226016Z /docker-entrypoint.sh: Configuration complete; ready for start up
2022-03-13T05:46:44.579540345Z 2022/03/13 05:46:44 [emerg] 1#1: cannot load certificate "/home/opc/wordpress/nginx/conf.d/ssl/cert1.pem": BIO_new_file() failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/home/opc/wordpress/nginx/conf.d/ssl/cert1.pem','r') error:2006D080:BIO routines:BIO_new_file:no such file)
2022-03-13T05:46:44.579598505Z nginx: [emerg] cannot load certificate "/home/opc/wordpress/nginx/conf.d/ssl/cert1.pem": BIO_new_file() failed (SSL: error:02001002:system library:fopen:No such file or directory:fopen('/home/opc/wordpress/nginx/conf.d/ssl/cert1.pem','r') error:2006D080:BIO routines:BIO_new_file:no such file)

Of course, I made a mistake in specifying the path of the certificate files. When I corrected it, the site came up correctly.

C++

I’m going through the basics of C++ on this site. I am imitating the code on the site and actually compile it and execute it. So far, C++ is kind of too much… Here is the example I’m talking about.

#include <iostream>
#include <string>

class Person {
public:
    Person() = default;
    Person(int age) 
      : age(age) {

    }

    Person(int age, std::string name)
      : age(age), name(std::move(name)) {

    }

    int age = 25;
    std::string name = "Unknown";
};


int main() {
    Person person;
    std::cout << person.name << " is " << person.age << "\n";

    Person person2 = Person(40);
    std::cout << person2.name << " is " << person2.age << "\n";

    Person person3 = Person(33, "Johnny");
    std::cout << person3.name << " is " << person3.age << "\n";
}

Here is the code in Python that generates the same result.

class Person:
    def __init__(self, age=None, name=None):
        self.age = age if age is not None else 25
        self.name = name if name is not None else "Unknown"

if __name__ == '__main__':
    person = Person()
    print(f"{person.name} is {person.age}")

    person2 = Person(40)
    print(f"{person2.name} is {person2.age}")

    person3 = Person(33, "Johnny")
    print(f"{person3.name} is {person3.age}")

Now that I see the difference, I wonder if I’m going to continue with C++ exploration. C++ still fascinates me, so I might continue a little more. Hmm I don’t really have a motivation to create an application C++ because of the lack of syntax sugar, so…

DMZ

DMZ in computer network world is an area in the network where there is no protection. DMZ in real world is where there is no military force but if you put an unpatched computer in DMZ, the computer would be totally infected and it would be in a very bad condition. So what I’m thinking is DMZ should be named differently. I think it should be like Exposed Zone (EZ?) or Unprotected Zone (UZ).

I mean it is possible to put your computer in DMZ but who does it nowadays anyway?

g++

Now I want to learn C++ on Linux… But it’s OK because this is my own space. I am just going over some basics on C++ coding.

#include <iostream>

using namespace std;

double square(double x)
{
    return x*x;
}

void print_square(double x)
{
    cout << "the square of " << x << " is " << square(x) << "\n";
}

int main()
{
    print_square(5);
}

I saved as helloworld.cpp. Now to compile it, I run…

g++ helloworld.cpp -o helloworld

It generates a binary file helloworld. When I execute it, it shows something like this…

the square of 5 is 25

Very simple, but I love something like this. When I start to learn a new language, I don’t use IDE. It makes me learn the language and how it works better.

Going Back to the Office

I am going back to the office from next Monday. It has been 2 long years since the company let all employees work from home. It was amazing to see my company quickly adopted WFH right after the pandemic started. I had an option to keep working from home even after the office reopening but I choose to go back to the office a few times a week.

I miss the face to face communication with people. My team is scattered all over the US and some in different country but I am going to enjoy some impromptu conversations with other engineers.

My commute is going to be mainly by train. It also has been 2 years since I took the train the last time. Wow, it’s been 2 years…

Programming Languages

I like programming languages. Each programming language has its unique syntax sugar.

The language that I use the most nowadays is Python. It just gets things done at work.

The first programming language I had my hands on seriously is Visual Basic 6. I remember buying a beginner’s package at Fry’s electronics for $99. At that time, I just came to US wanting to be a software engineer. Not knowing where to start, I thought I’d start from somewhere. That gave me a career. It was a very rough start where I had to work 16 hours a day for a while and the requirements changed every day and to make matters worse, a sales guy sold an enterprise solution to a big customer while no code existed at that time. It was a .com era and it was a crazy time. The company doesn’t exist anymore for the obvious reason. VB 6 was the first language I became fluent with and I also got a skill to write ASP (Active Server Pages). VBScript was what I breathed every day at that time… I still remember how to code it today.

Dim rs As RecordSet
Set rs = New RecordSet
' Do stuff here
If Not rs Is Nothing Then
    Set rs = Nothing
End If

Though it makes me feel nostalgic, I wouldn’t want to code in Visual Basic anymore.

I rambled too much about the past but if I had started my career with a language like C++, I think my career path would have been different but after all I am at where I want to be, so it’s all good after all. I never had a chance to get my hands on C++ and I’m interested in it.

Tokyo VPN Server Cost

I provisioned an ARM64 VM in Tokyo last weekend to create a VPN server in Japan. I noticed that I was starting to get charged for it. Here is how much…

So far only $0.09. Looks like only $0.06 per day. That means $0.06 x 30 = $1.8 a month. A full blown VPN server just for myself for $1.8 a month. The boot volume size is what’s costing me, and the size is 47GB. That’s the default size I picked.

I thought up to 4 ARM64 hosts were free but that seems to be only in the home region, which is us-ashburn-1 in my case. But still $1.8 per month for my own VPN server in Japan is very very cheap and I have no problem keeping it running. I have been using the VPN server to watch movies and contents in Japan and I have been very happy with it.

I used to have an VPN server in Japan with Azure and it used to cost me around $20 a month for mostly data transfer but OCI seems to be very generous in the amount of data transferred.

My Own VPN Server in Japan

I’m from Japan and I want to watch movies and TV programs in Japan from time to time. I subscribe to Amazon Prime in Japan but the IP address here in US prevents me from watching movies on it. In my opinion, that kind of service really kills advantage of the Internet but there must be business reasons why they want to filter the traffic by the source IP address.

To get around it, you could use a VPN connection. You can connect to a server in Japan and watch contents there pretending that you are in Japan. Yeah, there are VPN services out there and you can easily get decent service relatively reasonably but as an engineer, I thought why don’t I create a VPN host in Japan.

I provisioned a host in Japan on OCI. It is a ARM64 Ubuntu host. After Googling some, I was able to find a nice article that let me walk through steps to configure a VPN server. After like 20 to 30 mins, I was able to use the VPN server. It was a breeze.

As far as I see, the ARM64 Ubuntu host in Japan is free so far, so as long as you are willing to go through some steps your self, you get a free VPN server in the country you want.

Migrated Yet Again

I didn’t feel right that I had to clone the boot volume and recreated the blog instance out of it to recover my SSH key, so I created an ARM instance from scratch again.

It was very easy to install and configure the Docker containers this time because I already had an Ansible project to automate it.

If you are seeing this article, you are seeing it on a yet another ARM host with Dockerized WordPress.