GitLab Runner

Pre-requirement I installed Docker because I wanted to use Docker executor for better isolation of environments. Install GitLab Runner on the server Follow the official manual. https://docs.gitlab.com/runner/install/linux-repository.html On Ubuntu From repo (recommended) curl -L https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh | sudo bash export GITLAB_RUNNER_DISABLE_SKEL=true; sudo -E apt install gitlab-runner Check. $ sudo gitlab-runner status Runtime platform arch=amd64 os=linux pid=3163 revision=2ebc4dc4 version=13.9.0 gitlab-runner: Service is running! $ sudo gitlab-runner list Runtime platform arch=amd64 os=linux pid=3172 revision=2ebc4dc4 version=13.

AWS Network for dummy (me)

Reference I found the good slide which contains good figures to understand AWS network. https://de.slideshare.net/AmazonWebServicesLATAM/aws-vpc-fundamentals-webinar Physical location From the slide 10/58. Region consists of multi AZs (Availability Zone) An AZ consists of AZ-a, AZ-b, AZ-c, etc. AZx (x=a,b,c) consists of data centers The latency within the Region is ~2ms. Logical network VPC: A private network like 172.31.0.0/16 across AZs (AZa, AZb, AZc). VPC subnet: Each AZx is assiend a subnet, like 172.

LVM and File System

How to think Linux volume system Here is the coprehensive image from Wikipedia. There are several physical volumes (PVs) in a server. Linux group the physical volumes in a volume group (a VG). Each of PVs contains physical partitions (PPs). We can aggregate the PVs in a logical volume (a LV). On a LV, we can decide a file system (FS). From Linux side, we can mount a Linux directory to the FS.

Cognito - tutorial

First thing you should decide We should decided “User pool” or “Identity pool”. Here is the official blog post about the differences. https://aws.amazon.com/de/premiumsupport/knowledge-center/cognito-user-pools-identity-pools/ In a nut shell, User pools are for authentication (identify verification), and Identity pools are for authorization (access control). I’ll try an User pool. Future scope: integrate with AppSync. Tutorial 1. Create an User pool I followed the link. Very easy. https://docs.aws.amazon.com/cognito/latest/developerguide/tutorial-create-user-pool.html Choose Manage User Pools. Manage User Pools.

MongoDB - Tutorial

Good tutorial video https://www.youtube.com/watch?v=pWbMrx5rVBE Handson Install on Ubuntu sudo su wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add - echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list apt update sudo apt install -y mongodb-org systemctl start mongodb Playground in local Docker container docker run -p 27017:27017 -d mongo:4.0-xenial Toolkit curl https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2004-x86_64-100.3.0.deb -O sudo apt install ./mongodb-database-tools-ubuntu2004-x86_64-100.3.0.deb Mongo shell mkdir mongosh cd mongosh curl https://downloads.mongodb.com/compass/mongosh-0.8.3-linux.tgz -O tar -zxvf mongosh-0.

WASM by Rust - Tutorial

Tutorial The URL I followed. https://developer.mozilla.org/en-US/docs/WebAssembly/Rust_to_wasm Pre-requirement You should install npm beforehand. To compile wasm-pack, apt install -y build-essential and install gcc. In case of Ubuntu, apt install -y libssl-dev pkg-config. Download wasm-pack To build the package, we need an additional tool, wasm-pack. This helps compile the code to WebAssembly, as well as produce the right packaging for npm. $ cargo install wasm-pack $ cargo new --lib hello-wasm $ cd hello-wasm Write codes src/lib.

AppSync - Tutorial

Getting started Set up Go to AppSync Page. Create API. Getting Started. Customize your API or import from Amazon DynamoDB -> Create with wizard Click Start Create model Model Name: Atlex00Model Configure model fields: Name: uid, Type: ID, Required. Name: first_name: Type: String Name: last_name: Type: String Name: gender: Type: Int Name: age: Type: Int Name: email: Type: Email Configure model table (optional) Table Name: Atlex00ModelTable Primary Key: uid, Sort key: first_name Create resources API configuration API name: atlex00AppSync Your API is almost ready… Updating the schema.

GraphQL tutorial with Python (`graphene`)

Original source I followed the linke below. https://hatemtayeb2.medium.com/hello-graphql-a-practical-guide-a2f7f9f70ab4 Install library pip -U install graphene Use it scheme.py import graphene import json class Query(graphene.ObjectType): hello = graphene.String() def resolve_hello(self, info): return "world" schema = graphene.Schema(query=Query) result = schema.execute( ''' { hello } ''' ) data = dict(result.data.items()) print(json.dumps(data,indent=2)) Try the code. $ python schema.py { "hello": "world" } GraphQL concepts Every GraphQL implementation needs a Query class that contains some fields, every field (not always) must have a resolver function that return data related to the field.

Slow query - MySQL

What is slow query? https://dev.mysql.com/doc/refman/8.0/en/slow-query-log.html The definition “slow query” is “SQL statements that take more than long_query_time seconds to execute and require at least min_examined_row_limit rows to be examined”. Configure Check current status SHOW VARIABLES LIKE "slow_query_log"; SHOW VARIABLES LIKE "slow_query_time"; SHOW VARIABLES LIKE "slow_query_log_file"; Enable to log slow queries Logging slow queries which take more than 10 seconds. SET GLOBAL slow_query_log = 'ON'; SET GLOBAL long_query_time = 10; SET GLOBAL slow_query_log_file = '/path/filename'; A sample line in the log file:

OAuth 2.0 - RFC 6749 and Google Identity implementation (hands-on)

This is my memo while learning OAuth 2.0. RFC 6749 https://tools.ietf.org/html/rfc6749 1.1 (Entities and) Roles Client: An application making protected resource requests on behalf of the resource owner and with its authorization. Resource owner: An entity capable of granting access to a protected resource. When the resource owner is a person, it is referred to as an end-user. Resource server: The server hosting the protected resources, capable of accepting and responding to protected resource requests using access tokens.