I’ve migrated my blog to yet another host on OCI‘s free tier host. It was much easier this time because I had all my contents into one zip file and expanded it on the new host. By Dockerizing the whole site, it completely separates data and server and makes the migration so much easier.
As a blogger (though a mediocre one) who maintains the whole thing by himself, I cannot live without this anymore. It’s really convenient and much more maintainable.
The command above writes out the public key generated on the client machine to the remote hosts’s ~/.ssh/authorized_keys file. If you just try to SSH into the host again, you won’t be promoted to enter password again.
sqlite3 module provides nice ways to deal with Sqlite database. We will cover a way to create a table and pump data into the table with a right way.
I’d recommend this nice tool called DB Browser for SQLite. This tool is very useful when you browse the data in the database and execute SQL scripts.
First, let’s create a sample table.
def create_table_hoge(self, conn):
cur = conn.cursor()
cur.execute('''CREATE TABLE HOGE (
id INTEGER PRIMARY KEY AUTOINCREMENT,
We will pump bunch of dummy data into the table using the following code.
conn = sqlite3.connect(self.db_name)
cur = conn.cursor()
for i in range(1000):
cur.execute('''INSERT INTO HOGE (col1, col2)
VALUES (?, ?);
Note that cursor.execute method takes SQL statement and the parameter values as tuple. You can see the values are being accepted with question marks and actual values are in the tuple. I haven’t tried it but it probably prevents SQL injection rather than using a straight SQL like INSERT INTO HOGE (col1, col2) VALUES (‘test1’, ‘test2’).
When I browse HOGE table with DB Browser for SQLite, it looks like the following.
This tech blog has been hosted at OCI free tier for a few weeks and Oracle has not changed me a dime. It really has been free. My WordPress site is much faster on OCI than being hosted at iPage.com now.
One caveat is that I still have to pay for my own domain and hosting at iPage.com but it’s a cheap service so it doesn’t hurt me too much.
It has been running very well on all Dockerized components, so this is very cool. Much faster and I have control over every single details of my site. As an engineer, this is exactly what I wanted. Though it was quite a bit of work to figure out how to get it to work, it has been totally worth it.