Keep Moving https://dhoeric.github.io/ Recent content on Keep Moving Hugo -- gohugo.io en-us Sat, 19 Jan 2019 15:58:37 +0800 About https://dhoeric.github.io/about/ Sat, 19 Jan 2019 15:58:37 +0800 https://dhoeric.github.io/about/ Hi there, here is my blog and mostly about technical notes on DevOps-related work. - Eric Using logfmt on Phoenix Framework https://dhoeric.github.io/2018/using-logfmt-on-phoenix-framework/ Sat, 31 Mar 2018 02:20:16 +0800 https://dhoeric.github.io/2018/using-logfmt-on-phoenix-framework/ Nowadays application log is not only serve as an assets for tracing application error but also a data for analyse user requests. Logfmt is a format to show the logs in key/value pairs, which is readable by human or computer. This article shows you to: Convert default Phoenix Framework output into logfmt Add remote ip to the request log In case you don’t want to study a long steps, you can go to https://github. Ansible dynamic inventory with AWS EC2 https://dhoeric.github.io/2017/ansible-with-aws/ Sat, 03 Jun 2017 21:47:50 +0800 https://dhoeric.github.io/2017/ansible-with-aws/ By using ansible dynamic inventory, we can run ansible based on instances’ tags, such as app=backend,env=staging etc. Here will talk about how to make use of defined tags on AWS EC2 and run ansible-playbook scripts onto them. 1. Define a few tags on target EC2 instances Define some tags on created EC2, such as App=backend, Environment=staging, Usage=clock-worker To assign tags on the multiple instances, you can use with AWS Resource Tag editor. Logrotate with crontab https://dhoeric.github.io/2017/logrotate-crontab/ Sat, 03 Jun 2017 20:32:03 +0800 https://dhoeric.github.io/2017/logrotate-crontab/ While working with logrotate, it’s usually pretty hard to debug while we want to write it in a short period of time. Here are some basic info of logrotate, as well as crontab, which invokes logrotate regularly in Ubuntu 14.04. Test logrotate manually Directory of logrotate config file, for defining target service’s log rotation: /etc/logrotate.d To test with logrotate manually, you can run logrotate -d /etc/logrotate.d/nginx To check for last run on logrotate, you can run cat /var/lib/logrotate/status One-liner to replace HTTPS into SSH url in .gitmodules https://dhoeric.github.io/2017/https-to-ssh-in-gitmodules/ Tue, 16 May 2017 23:57:00 +0800 https://dhoeric.github.io/2017/https-to-ssh-in-gitmodules/ While pulling submodule repositories in CI servers like Jenkins/CircleCI, repositories with HTTPS submodule url will ask for credentials, which is hard for automation. Demo of .gitmodules $ cat .gitmodules [submodule "common"] path = common url = https://github.com/dhoeric/common.git After you trying to pull submodule repo, you will be asked for password… $ git submodule sync $ git submodule update --init Submodule 'common' (https://github.com/dhoeric/common.git) registered for path 'common' Cloning into '~/r/hello-submodule/common'... Username for 'https://github. Cheatsheet for AWS IAM policy https://dhoeric.github.io/2017/aws-iam/ Mon, 24 Apr 2017 22:28:16 +0800 https://dhoeric.github.io/2017/aws-iam/ AWS IAM is a service to control permission over AWS’s different services, which is pretty useful for restricting access level for CI services or other account. AWS itself actually already provided templates policy but it usually still too wide for specific usage. Here is just to name a few common usages for (myself) reference. S3 Deploy to specific bucket 1 2 3 4 5 6 7 8 9 10 { "Version":"2012-10-17", "Statement":[ { "Effect":"Allow", "Action":["s3:PutObject"], "Resource":"arn:aws:s3:::[DEPLOY_BUCKET]/*" } ] }