Posts

Mastodon and Docker Compose

Docker Compose

I use Traefik as my reverse proxy. Here is a snippet of my Docker Compose file for Mastodon:

######################
# Mastodon           #
######################
  mastodon-db:
    image: postgres:14-alpine
    container_name: mastodon-db
    shm_size: 256mb
    environment:
      - UID=${PUID}
      - GID=${PGID}
      - TZ=${TZ}
      - POSTGRES_HOST_AUTH_METHOD=trust
    volumes:
      - /root/docker/appdata/mastodon/dbdata:/var/lib/postgresql/data
    labels:
      - "com.centurylinklabs.watchtower.enable=true"
    restart: unless-stopped
  mastodon-redis:
    image: redis:7-alpine
    container_name: mastodon-redis
    environment:
      - UID=${PUID}
      - GID=${PGID}
      - TZ=${TZ}
    volumes:
      - /root/docker/appdata/mastodon/redis:/data
    labels:
      - "com.centurylinklabs.watchtower.enable=true"
    restart: unless-stopped
  mastodon-web:
    image: tootsuite/mastodon
    container_name: mastodon-web
    command: bash -c "rm -f /mastodon/tmp/pids/server.pid; bundle exec rails s -p 3000"
    env_file:
      - .mastodon.env
    environment:
      - UID=${PUID}
      - GID=${PGID}
      - TZ=${TZ}
    volumes:
      - /root/docker/appdata/mastodon/public/system:/mastodon/public/system
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.mastodon-web.rule=Host(`toot.onitato.com`)"
      - "traefik.http.routers.mastodon-web.entrypoints=https"
      - "traefik.http.routers.mastodon-web.tls=true"
      - "traefik.http.routers.mastodon-web.tls.certresolver=letsencrypt"
      - "traefik.http.routers.mastodon-web.middlewares=authelia@docker"
      - "com.centurylinklabs.watchtower.enable=true"
    ports:
      - "3000:3000"
    restart: unless-stopped
    depends_on:
      - traefik
      - mastodon-redis
      - mastodon-db
  mastodon-streaming:
    image: tootsuite/mastodon
    container_name: mastodon-streaming
    command: node ./streaming
    env_file:
      - .mastodon.env
    environment:
      - UID=${PUID}
      - GID=${PGID}
      - TZ=${TZ}
    labels:
      - "traefik.enable=true"
      - "traefik.http.services.mastodon-web.loadbalancer.server.port=4000"
      - "traefik.http.routers.mastodon-streaming.rule=(Host(`toot.onitato.com`) && PathPrefix(`/api/v1/streaming`))"
      - "traefik.http.routers.mastodon-streaming.entrypoints=https"
      - "traefik.http.routers.mastodon-streaming.tls=true"
      - "traefik.http.routers.mastodon-streaming.tls.certresolver=letsencrypt"
      - "traefik.http.routers.mastodon-streaming.middlewares=authelia@docker"
      - "com.centurylinklabs.watchtower.enable=true"
    ports:
      - "4000:4000"
    restart: unless-stopped
    depends_on:
      - traefik
      - mastodon-redis
      - mastodon-db
  mastodon-sidekiq:
    image: tootsuite/mastodon
    container_name: mastodon-sidekiq
    command: bundle exec sidekiq
    env_file:
      - .mastodon.env
    environment:
      - UID=${PUID}
      - GID=${PGID}
      - TZ=${TZ}
    volumes:
      - /root/docker/appdata/mastodon/public/system:/mastodon/public/system
    labels:
      - "com.centurylinklabs.watchtower.enable=true"
    restart: unless-stopped
    depends_on:
      - mastodon-redis
      - mastodon-db

mastodon.env

mastodon.env was generated using these instructions:

Extra Life 2022

What is Extra Life?

I’ve pledged to play games and raise funds for kids at my local children’s hospital. Please visit my Extra Life Page to make a donation. Your donation is tax-deductible and will make miracles happen for families who desperately need them.

Watch

Visit my Twitch Stream and Follow my channel so you are notified when I go live on Game Day, November 5th, 2022.

F-150 Lightning Event

Welcome and Registration Tent

I was invited to the Ford F-150 Lightning event here in Denver, CO. I got to ride along in the new Lightning and get an up close and personal look. They also had an E-Transit on site as well.

Test Ride

Let’s start with the most exciting part. After registration, I walked straight over to the test ride tent. Unfortunately, I was prohibited from recording anything inside the vehicle during the test ride. Here’s the video of the others taking a test ride:

Hush Little Baby

My own special version of Hush Little Baby.

Hush little baby, don’t say a word.
Daddy’s gonna buy you a mockingbird.

If that mockingbird doesn’t sing,
daddy’s gonna buy you a golden ring.

If that golden ring turns brass,
daddy’s gonna buy you a looking glass.

If that looking glass does break,
daddy’s gonna buy you some roller skates.

If those roller skates make you fall,
daddy’s gonna buy you a bouncy ball.

Running Chocolatey on Linux

Update: This docker image is now available on the Docker Hub as linuturk/mono-choco.

Do you want to create Chocolatey packages but don’t want to run a Windows server? Use this Dockerfile to build Chocolatey and do your package development without a Windows system.

FROM mono:3.12.1

MAINTAINER Justin Phelps

RUN apt-get update && apt-get install -y wget unzip

WORKDIR /usr/local/src/choco
RUN wget https://github.com/chocolatey/choco/archive/stable.zip
RUN unzip stable.zip
RUN rm stable.zip

WORKDIR /usr/local/src/choco/choco-stable
RUN chmod +x build.sh
RUN chmod +x zip.sh
RUN ./build.sh

WORKDIR /usr/local/bin
RUN ln -s /usr/local/src/choco/choco-stable/build_output/chocolatey

COPY choco /usr/local/bin/choco

WORKDIR /root

In the same directory as the Dockerfile, place a file called choco with executable permissions. The content of this file should be:

Retrying Server Builds with Ansible

A common problem with building multiple servers in the cloud is an intermittent failure in one build that can stop your entire deployment process. With the right retry logic you can avoid this problem with Ansible.

I’m using until to check the output from the rax module. Using the length Jinja2 filter, I can check if the correct number of instances have been created. This should retry the task 3 times with a delay of 5 seconds between attempts.

The Go Programming Language

Golang Gopher

I was fortunate to receive a review copy of The Go Programming Language by Alan A. A. Donovan and Brian W. Kernighan. The following is my review of this book based on my limited experience with Golang.

I’m new to Go. I’ve only been through the excellent Tour of Go. This Tour gives you a great hands on trial of Go but leaves out some of the more complex topics that are covered by Donovan and Kernighan’s book. I’ve made it through Chapter 5 which covers functions in detail. The book is well written and fairly easy to read but the subject matter can get quite dense at times. It takes dedication to read and may require you to look up concepts or terminology.

My Impressions of salt-ssh

I’ve done a search and there seem to be a large number of issues related to salt-ssh usability with non-root users. I’d like to understand more about the perceived use case from Salt’s perspective and give some feedback.

Perceived use case

salt-ssh seems to be an answer to Ansible and Fabric where the ssh transport from a single laptop is useful for a system administrator to maintain a smaller set of infrastructure. My use case would be running from a virtualenv after pip installing salt-ssh. I would typically create a folder for a set of infrastructure and states. If I was executing the command from this directory I expect salt-ssh to look in this working directory for things like rosters and configuration files. The next place would be a folder ~/.salt-ssh folder in my home directory. I would expect cache directories to be automatically created in that location. The final location would be the system wide settings in /etc/salt.

Testing CloudFormation Templates with Ansible

There are many variations and combinations of AWS products and services that lend the platform to great flexibility and customization. We work hard to evaluate these combinations and put forth a collection of best practices for our customers to follow. One of these best practices is the use of CloudFormation templates. My team maintains a series of standard CloudFormation templates for our customers to use. Part of that maintenance includes updating those templates and testing them for functionality.

Texas Linux Fest 2015

Texas Linux Fest 2015

I will be speaking at Texas Linux Fest this year. My talk will be about Consul, the service discovery tool from HashiCorp. I’m scheduled for Saturday, August 22nd at 1:30 PM in Room 3.

Talk Materials:

Here is the full schedule for the conference. Looking forward to seeing you there!

Checking and Restarting a Modem

My ISP is less than reliable so I decided to automate my modem restarts. I’m using a Motorola SB6141 and I can access a web based interface at 192.168.100.1.

Using a combination of curl, grep, and sed, I was able to scrape the necessary pages to get information about the modem’s status. The script then checks the status and restarts the modem if it detects a fault. The script uses curl to GET a specific URL with the necessary parameters. This GET request triggers the modem’s restart.

No Hassle Blog Automation - A New Hope

In this third installment of my No Hassle Blog Automation series, I remove the necessity for running any infrastructure of my own. Drone has been replaced with a hosted solution at CircleCI. Their support is amazing, and their circle.yml format made configuration easy. Take a look at the first and second installments of this series.

Requirements

There are a few requirements for this setup:

  • Rackspace Cloud Account
  • Cloud Files Container*
  • Existing Pelican Blog
  • GitHub Account

* This container should be configured to serve a static site.

Speaking at SaltConf 2015

SaltConf 2015

My talk has been accepted to SaltConf 2015 this year. I will be in Salt Lake City March 3rd through March 5th. I’ll be speaking about my experience deploying WebPageTest with SaltStack. We’ll talk about the benefits and gotchas of WebPageTest and SaltStack during this presentation. You’ll also see copious amounts of stateful PowerShell being used. If you have ever tried using Salt to managed Windows machines, this talk is certainly a must see!

Ansible's Rackspace Dynamic Inventory Plugin

Installing

Installing inventory plugins isn’t intuitive, and the documentation available on this process isn’t immediately clear. The instructions found on this page Ansible Documentation can be adapted for the Rackspace plugin.

It boils down to this for the Rackspace plugin:

  1. Grab the latest version of rax.py from the plugins/inventory folder on GitHub. Raw GitHub Link
  2. Place this file on your Ansible master. The location doesn’t matter that much, but convention says to put it in /etc/ansible/rax.py.
  3. Make this script executable by issuing chmod +x /etc/ansible/rax.py.
  4. As the user that runs Ansible, create the following file at ~/.rackspace_cloud_credentials: (Be sure to replace the appropriate values with your Rackspace username and apikey.)
[rackspace_cloud]
username = my_username
api_key = 01234567890abcdef

Target the rax.py script in your ansible run: ansible -i /etc/ansible/rax.py webserver -m ping

Deploying to Rackspace using salt-cloud

These instructions should be a nice and easy start to deploying Rackspace Cloud servers using the salt-cloud tool. Just follow along exactly, and at the end you should have a fully functional salt-cloud deployment tool.

Dependencies

I’m performing my installation on a Debian 7 (Wheezy) server, where my salt-master already exists. The following two commands should install salt-cloud, and all the necessary dependencies. This assumes you are already using the Python tool pip.

IRC Logging Bot

This article is in response to a request by Ryan Jung. Request your own article.

One of the disadvantages of using IRC over another chat medium is the lack of logging while you aren’t connected to the server. In this article, I will describe the process I used to implement logging for my favorite IRC channels.

The Environment

Pierc is my choice of logging bot for this article. It logs the contents of IRC channels to a MySQL instance, and presents an easy to use web interface.

Load Balancing in the Cloud

This article is in response to a request by Shawn Laasch and Jordan Rinke. Request your topic today! This article will focus on Rackspace Cloud Load Balancers.

Cloud Load Balancers

Load balancing is performed by a device or service acting as a single endpoint to your application or site. This device then spreads the requests it receives across multiple back end nodes. There are benefits to using a load balancer in your configuration:

PEP8 Checking in Vim

Following proper coding standards is important to ensure others can read and modify your code. I make use of the following tools when writing Python to ensure I am formatting my code properly.

Install Dependencies

Let’s start by installing a dependency of the Vim plugin we are going to use. The Flake8 module will be needed for our vim-flake8 setup. As root (or using sudo), run the following commands:

easy_install pip
pip install flake8

The first command installs the latest version of pip, a tool for installing and managing Python packages. The second command uses pip to install the flake8 package. Now let’s configure vim.

Send Email for yum-cron Update

When using yum-cron, you might want to receive email notifications when updates are applied. Here is how you enable these notifications for CentOS. This article assumes a properly configured mail service.

Installing yum-cron

Install yum-cron using the yum package manager:

yum install yum-cron

Configure yum-cron

Modify the /etc/sysconfig/yum-cron file and add your email address to the MAILTO line.

MAILTO=email@address.com

Be sure to read up on the other settings in this file. You can disable automatic updates and only have the system send the notification.

Using a Tablet as a Laptop Replacement

I’ve been using a tablet as a laptop replacement for the past week. These are my thoughts concerning my experiences with the current state of Android on a ThinkPad Tablet.

The feature of my typical Linux laptop I missed the most on Android were floating windows. Android makes you focus on a single task, for better or worse when considering your work flow. I often reference documentation and articles when I’m working on a new project or a complex issue. This work flow doesn’t carry over well to Android.

No Hassle Blog Automation

Managing a blog can be a hassle. Operating system updates, blog software updates, and server security take up tons of time. Don’t forget about scaling your blog if you get popular. Inspired by the Rackspace DevOps post on their new blog format, I’ve setup my own version using Pelican instead of Octopress.

Resources

This tutorial will assume you have two systems to manage your blog.

  • Local Workstation
  • Remote Server

The local workstation will be used to manage your blog posts, as well as uploading the content. This system will need git and Pelican installed.

Fedora 18 and Host Name Dashes

I ran into an interesting problem today when installing the newly released Fedora 18. It was quite annoying, so I wanted to document it here.

Fedora 18

Using the new installer, I configured my computer’s host name to subdomain.domain.com on the network setup page. After I finished the installation, I noticed my host name was still the default localhost.localdomain. I tried the usual tricks to set the host name, but all the following tactics failed:

Running a Wesnoth Server

The Battle for Wesnoth is a turn based strategy game that has unique and fun campaigns and great multiplayer maps. Playing on the official server is fun, but sometimes you’ll want a private server on which you and your close friends can play.

The Battle for Wesnoth

Installing the Server Software

Most popular Linux distributions have the wesnoth-server package available in their repositories. For this example, I’ll be installing this service on a machine running Fedora 17. To install the Wesnoth multiplayer service, run the following command as root on your machine.

Strong Passwords are Easy with KeePassX

Strong passwords are important, today more than ever. Clever passwords like “Password123”, “hunter2”, and just the letter “a” just won’t cut it anymore. How can someone create strong passwords, use a different one for every account they have, and still remember them all? KeePassX is the answer.

KeePassX

KeePassX

KeePassX is a password database. It allows you to create an encrypted database file to hold all of your passwords. You unlock this database with a single master password. Since you choose where to save this database file, this tool has an edge over cloud based password tools like LastPass. It also has tools that allow you to generate really secure and random passwords.

Connecting to IRC

IRC stands for Internet Relay Chat. Here is the first paragraph from the Wikipedia article on IRC:

Internet Relay Chat (IRC) is a protocol for real-time Internet text messaging (chat) or synchronous conferencing. It is mainly designed for group communication in discussion forums, called channels, but also allows one-to-one communication via private message as well as chat and data transfer, including file sharing.

Connecting to an IRC server isn’t hard. You just need the right IRC client, and a little bit of information.

Passion Haiku

I wrote this haiku as part of my Rookie Orientation at Rackspace:

Burning desire grows.
Smoldering embers ignite.
Show them your passion.