Posts

Install gdu

Quick install script for go DiskUsage() If you want to quickly run through your file system usage and determine what’s eating up your storage space you can simply use gdu . This will install the gdu binary on your linux system. LATEST_VERSION=$(curl -LISs https://github.com/dundee/gdu/releases/latest | grep location | cut -d" " -f2) LATEST_VERSION=$(echo "${LATEST_VERSION##*/}" | tr -d '\r') PKG_NAME="gdu_linux_amd64.tgz" curl -LSs https://github.com/dundee/gdu/releases/download/${LATEST_VERSION}/${PKG_NAME} | sudo tar -xzf - -C /usr/local/bin/ sudo mv /usr/local/bin/{"${PKG_NAME%.*}",gdu} For more information on the features and how to use it, check out the gdu github .

Stunnel to DigitalOcean Redis DB

Stunnel to DigitalOcean Redis DB Connecting to your DigitalOcean DBaaS Redis server The DigitalOcean DBaaS Redis offering requires that connections be made over secure connections using SSL/TLS. Unfortunately the default redis-cli client does not support SSL/TLS connections. So to get your clients connected you’ll need to either use a third-party client or library that supports secured connections, or use Stunnel to create a tunnel through which your redis-cli can connect. We’ll quickly go through setting up Stunnel and getting it connected to your Redis server. Keep in mind that your application will most likely use a library, but this can be useful if you have a management node or a jumpbox/bastion node. Prerequisites We’ll be using an Ubuntu 18.04 server in SFO2. The size doesn’t really matter for this example, but if you do plan to use this moving forward, be sure to give yourself enough room to run your tool set from it as well as having room for other use...

resize your LVM partition

resize your LVM partition resizing your LVM partition So this process takes a little manual work but is pretty straight forward. We’re going to be using a DigitalOcean Droplet that was created using a custom image created from FreePBX distro 7. The issue was that the SSD was provisioned with 25G of storage, but the OS was only seeing 10G. Start off by extending the /dev/vda2 partition parted /dev/vda This will enter parted’s interactive mode. you’ll want to enter in the command resizepart , then enter the number of the partition you want to modify. In this case partition 2 . For the partition ‘end’ prompt you can enter in 100% or -1s . This next step is a little odd but you can enter an estimate for the total size that should be allocated for /dev/vda2. pvresize --setphysicalvolumesize 24.6G /dev/vda2 You’ll be see a prompt that actually states the real size. So you can just select no for the prompt to carry out the change and adjust the size on the command...

Configure Postfix through cloud-init

Configure Postfix through cloud-init I recently decided to set up Nagios for monitoring a small cluster of nodes I’m running, and set up alerts to be sent out through email; however, I didn’t want those emails being sent directly from the VPS itself. What I did was set up this cloud-config script to be executed in order to spin up the VPS with postfix configured to connect to a Google email account in order to send out notification emails. This should help with minimizing the possibility that the email will be seen as spam and I won’t have to add additional IP addresses to my SPF record. Here’s the script for you to try out if you’re interested in getting this set up: #cloud-config packages: - postfix - mailutils - libsasl2-2 - ca-certificates - libsasl2-modules write_files: - path: /etc/postfix/sasl_passwd content: | [smtp.gmail.com]:587 [email protected]:PASSWORD owner: root:root permissions: 0400 runcmd: - sed -i 's/r...

Nginx deployed through Terraform and Ansible

nginx deployed through terraform and ansible Purpose This Terraform deployment will set up a floating IP, 2 nodes with Nginx configures as load balancers, and 2 web nodes. Provisioning will be handled by Terraform and configuration will be done with Ansible. The repo used can be located here . Prerequisites You’ll need to install Terraform which will be used to handle Droplet provisioning. In order to apply configuration changes to the newly provisioned Droplets, Ansible needs to be installed. Ansible’s inventory will be handled by Terraform, so you’ll need terraform-inventory . We’re going to need a DigitalOcean API key. The steps to generate a DigitalOcean API key can be found here . Use the included gen_auth_key script to generate an auth key for your load balancing cluster. Configuring Let’s get Terraform ready to deploy. We’re going to be using terraform.tfvars to store values required such as API key, project name, SSH data, the number of backe...