Posts

Showing posts from March, 2021

Jenkins: Quick Start

Image
This post describes how to setup Jenkins on Mac. I personally like to run it over docker. However, because docker (preview) acts weird sometimes on Mac M1, I decided to do it on Mac directly this time. 1. install You can use brew to install Jenkins. In my case, I needed to install xcode first. You may want to check the Java version in advance, as Java 8+ is required. % java --version % xcode-select --install % brew install jenkins Note: If you see the error like this, it means you probably need xcode like I did: --- xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun Error: An exception occurred within a child process:   CompilerSelectionError: jenkins cannot be built with any available compilers. --- 2. start % jenkins 3. initial setup Access http://localhost:8080/ and follow the instruction. The unlocking password cab be found at: % cat ~/.jenkins/secrets/initialAdminPassword For plugi

Terraform: Quick Start

This post explains how to run   “hashicorp/terraform docker”   using docker-compose. You will be able to create an instance on AWS. pre-requisite IAM user with programmatic access is needed. 1. Dockerfile Create a directory to mount the local files (Reference:  Terraform With Docker ). FROM hashicorp/terraform:0.12.29 RUN mkdir /workspace WORKDIR /workspace 2. docker-compose.yml Pass the IAM info as environment variables, and mount the current directory. version: '3' services: terraform: build: . environment: AWS_ACCESS_KEY_ID: YOUR_ACCESS_ID AWS_SECRET_ACCESS_KEY: YOUR_SECRET_KEY AWS_DEFAULT_REGION: us-east-1 volumes: - .:/workspace 3. main.tf resource "aws_instance" "example" { ami = "ami-08f3d892de259504d" instance_type = "t1.micro" } The AMI ID refers to  Amazon Linux 2 AMI (HVM), SSD Volume Type - ami-08f3d892de259504d (64-bit x86) 4. create & destroy instance Probably, it is a good idea

How I passed AWS Certified Solutions Architect – Associate

AWS Certified Solutions Architect – Associate ( https://aws.amazon.com/certification/certified-solutions-architect-associate/ ) is an AWS official certificate for architects to validate their knowledge about AWS. Because I got a few inquiries for what I did to be certified from basically zero knowledge, I would like to share it in this post. Study Materials Mostly, I studied it on Udemy. Here are the courses: AWS Certified Solutions Architect - Associate 2020 https://www.udemy.com/course/aws-certified-solutions-architect-associate/ AWS Certified Solutions Architect Associate Practice Exams https://www.udemy.com/course/aws-certified-solutions-architect-associate-amazon-practice-exams-saa-c02/ The first one is recommended if you are a beginner like me. The lab parts are pretty interesting (my favorite is AWS Snowball). The second one is recommended for everyone. It is probably around 20% more difficult than the actual exam. It is more cost efficient than the AWS official practice test, i

Selenide: Quick Start

Selenide is a Selenium wrapper in Java for testing.   This post describes how you can start using Selenide (using Gradle). 1. Setup Java Application # keep pressing enters to choose default values gradle init --type java-application # confirm that test succeeds gradle test 2. Add Selenide Dependency open build.gradle and edit as: dependencies {   ...   testImplementation 'com.codeborne:selenide:5.13.0' } 3. Write Test (replace the existing test with selenide code) src/test/java/selenide/AppTest.java package selenide; import static com.codeborne.selenide.Condition.text; import static com.codeborne.selenide.Selenide.$; import static com.codeborne.selenide.Selenide.open; import org.junit.Test;   public class AppTest { @Test public void test() { open("https://www.google.ca/"); $("input[type=text]").val("test").pressEnter(); $("body").shouldHave(text("test")); } } 4. Run Selenide gradle test This will open a browser t

openpyxl - Excel in Python: Quick Start

Image
"openpyxl is a Python library to read/write Excel 2010 xlsx/xlsm/xltx/xltm files" https://openpyxl.readthedocs.io/en/stable/ install $ pip install openpyxl hello world (new file) from openpyxl import Workbook workbook = Workbook() sheet = workbook.active sheet[ 'A1' ] = 'hello world' workbook.save(filename= 'test.xlsx' ) hello world (update) from openpyxl import Workbook import openpyxl # workbook = Workbook() workbook = openpyxl.load_workbook( 'test.xlsx' ) sheet = workbook.active sheet[ 'A1' ] = 'hello world' workbook.save(filename= 'test.xlsx' )

Rundeck: Quick Start

Overview Rundeck is a super crontab or "runbook automation that gives you and your colleagues self-service access to the processes and tools they need to get their job done" This 9-min YouTube video explains what you can do, popular usecases, basic concept (like Project, Job, Step, and Node), and so on with Rundeck. Run locally I found it easy to use the docker image to try Rundeck. You can check this example on GitHub and write the docker-compose.yml to start. version: '3' services:     rundeck:         image: ${RUNDECK_IMAGE:-rundeck/rundeck:SNAPSHOT}         tty: true         volumes:           - data:/home/rundeck/server/data           - ${RUNDECK_LICENSE_FILE:-/dev/null}:/home/rundeck/etc/rundeckpro-license.key         ports:           - 4440:4440 volumes:     data: Or, run the following bash to do the same: git clone https://github.com/rundeck/docker-zoo.git cd docker-zoo/basic docker-compose up Login Once the Rundeck is up, you can access [http://localhost:4

AWS Chalice: Quick Start

In this post, I am going to use Chalice to deploy a sample application on AWS API Gateway and Lambda. What is Chalice? Chalice is an AWS framework for writing serverless applications in Python.  https://aws.github.io/chalice/quickstart.html Similar technologies include SAM. See  https://aws.github.io/chalice/faq.html  for more detail. Install % python3 -m pip install chalice Note: you need to have aws credentials set. See  https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html Create Project % chalice new-project helloworld Your project has been generated in ./helloworld % cd helloworld  % tree -a . ├── .chalice │   └── config.json ├── .gitignore ├── app.py └── requirements.txt Run Locally % chalice local Serving on http://127.0.0.1:8000 % curl http://127.0.0.1:8000 {"hello":"world"} Deploy & Cleanup % chalice deploy ... Rest API URL: https://xxxxxxxxxx.execute-api.ap-northeast-1.amazonaws.com/api/ % curl https://xxxxxxxxxx.execute-api.ap