devops on davidchua https://dchua.com/tags/devops/ Recent content in devops on davidchua Hugo -- gohugo.io en-us Tue, 28 Feb 2017 00:00:00 +0000 Alerting with Prometheus and AlertManager https://dchua.com/posts/2017-02-28-alerting-with-prometheus-and-alertmanager/ Tue, 28 Feb 2017 00:00:00 +0000 https://dchua.com/posts/2017-02-28-alerting-with-prometheus-and-alertmanager/ How to setup Prometheus AlertManager and get a whole alerting pipeline setup. Objectives and Goals Write and Deploy Prometheus Alert Rules Configure Prometheus to send Alerts to Alert Manager Setup AlertManager to receive Prometheus Alert Send a Slack message on Alert Prerequisite Prometheus is already setup and running Alert Rules To begin writing and deploying alerts, you’ll need to modify your prometheus config file. Usually, its located at /etc/prometheus/prometheus. How to change instance size of an existing Kubernetes Cluster https://dchua.com/posts/2016-07-27-how-to-change-instance-size-of-an-existing-kubernetes-cluster/ Wed, 27 Jul 2016 00:00:00 +0000 https://dchua.com/posts/2016-07-27-how-to-change-instance-size-of-an-existing-kubernetes-cluster/ Just recently, I was trying to reverse my poor decision of starting my Kubernetes Cluster on AWS with a very simple t2.micro nodes. If you’re on AWS, your nodes are probably created via an Auto-scaling group. To change your instance size, you’ll need to: Copy the launch configuration that Kubernetes is probably running. Change the instance size of the launch configuration Update the Kubernetes Auto Scaling Group to use the new launch configuration ? Getting Started with Jenkins using Docker https://dchua.com/posts/2016-06-10-getting-started-with-jenkins-using-docker/ Fri, 10 Jun 2016 00:00:00 +0000 https://dchua.com/posts/2016-06-10-getting-started-with-jenkins-using-docker/ $ docker run --user root --privileged -p 8080:8080 -p 50000:50000 -v /path/to/host/volume:/var/jenkins_home -v /var/run/docker.sock:/var/run/docker.sock jenkins Lets break it down. -p 8080:8080 What we’re doing here is to expose the Jenkins port on the container out to the host. Jenkins uses 8080 by default so you may want to change the host port to a port that you find comfortable. -p 50000:50000 Jenkins uses port 50000 for its REST API. Expose this too. Installing Jenkins Plugins with their Dependencies in One Step https://dchua.com/posts/2016-06-02-installing-jenkins-plugins-with-their-dependencies-in-one-step/ Thu, 02 Jun 2016 00:00:00 +0000 https://dchua.com/posts/2016-06-02-installing-jenkins-plugins-with-their-dependencies-in-one-step/ Assuming that your Jenkins server is listening at port 8080, all you need to do is to run the following curl command: $ curl -X POST -d '<jenkins><install plugin="[email protected]" /></jenkins>' --header 'Content-Type: text/xml' http://localhost:8080/pluginManager/installNecessaryPlugins Replace [email protected] with the name of your plugin you’re trying to install by looking for the plugin-id in the plugin’s page. ie for Docker Build Step, the Plugin ID listed on the page is docker-build-step So your curl script should look something like: Writing a Serverless Python Microservice with AWS Lambda and AWS API Gateway https://dchua.com/posts/2016-03-22-writing-a-serverless-python-microservice-with-aws-lambda-and-aws-api-gateway/ Tue, 22 Mar 2016 00:00:00 +0000 https://dchua.com/posts/2016-03-22-writing-a-serverless-python-microservice-with-aws-lambda-and-aws-api-gateway/ Serverless Architectures are the rage nowadays. In this article, I’ll attempt to walkthrough the process of writing a Serverless Microservice with AWS Lambda and Amazon API Gateway. For people who know me, know that I’m not much of a Pythonista, but doing this blog post helped me to better appreciate Python and its awesome standard libraries and while I could have done this in NodeJS, this was a perfect example to pick up Python while doing something new. Getting npm packages to be installed with docker-compose https://dchua.com/posts/2016-02-07-getting-npm-packages-to-be-installed-with-docker-compose/ Sun, 07 Feb 2016 00:00:00 +0000 https://dchua.com/posts/2016-02-07-getting-npm-packages-to-be-installed-with-docker-compose/ If you’re trying to deploy your node app into a docker container and you’re also using docker-compose, here’s something to watch out for. If you are running npm install on your Dockerfile, you might want to make sure that you mount /node_modules as a data volume in your docker-compose. For eg. your Dockerfile might look something like this: # Dockerfile FROM node:5.5.0 ADD ./ /node_app WORKDIR /node_app RUN npm install Normal stuff. Configuring Chef https://dchua.com/posts/2015-03-24-configuring-chef/ Tue, 24 Mar 2015 00:00:00 +0000 https://dchua.com/posts/2015-03-24-configuring-chef/ Preparing Cookbooks Lets prepare a cookbook. Uploading a cookbook $ knife cookbook upload -a Databags Creating a databag $ knife data_bag create 'users' Uploading a databag $ knife data_bag from file users path/to/data_bag/files Bootstraping Create a new node In order to bootstrap a server to get and use chef, ensure that you have ssh access to your server already. You can define which user to login as using the –ssh-user command below. Setting up Chef https://dchua.com/posts/2015-03-24-setting-up-chef/ Tue, 24 Mar 2015 00:00:00 +0000 https://dchua.com/posts/2015-03-24-setting-up-chef/ Prerequisite: Chef 12.1.x Setting up Chef-Server Download Chef on your Chef-Server $ wget https://web-dl.packagecloud.io/chef/stable/packages/ubuntu/trusty/chef-server-core_12.0.5-1_amd64.deb $ sudo dpkg -i chef-server-core_*.deb $ sudo chef-server-ctl reconfigure Install Opscode-Manage Web interface for Chef management (highly recommended) Note: Opscode-Manage will run on port 80 so keep that free. # On Chef-server $ chef-server-ctl install opscode-manage $ opscode-manage-ctl reconfigure $ chef-server-ctl reconfigure Setup your User and Organization Users are an account that will be used to connect to Chef-server.