Skip to content

Instantly share code, notes, and snippets.

@brienw
brienw / rake_autocomplete_for_bash.rb
Created June 14, 2011 17:50 — forked from petrblaho/rake_autocomplete_for_bash.rb
bash autocomplete for rake with cache
#!/usr/bin/env ruby
# Complete rake tasks script for bash
# Save it somewhere and then add
# complete -C path/to/script -o default rake
# to your ~/.bashrc
# Xavier Shay (http://rhnh.net), combining work from
# Francis Hwang ( http://fhwang.net/ ) - http://fhwang.net/rb/rake-complete.rb
# Nicholas Seckar <[email protected]> - http://www.webtypes.com/2006/03/31/rake-completion-script-that-handles-namespaces
# Saimon Moore <[email protected]>

Keybase proof

I hereby claim:

  • I am brienw on github.
  • I am br13n (https://keybase.io/br13n) on keybase.
  • I have a public key whose fingerprint is 8414 1E59 A860 651C B3BA 5615 4EC4 FC71 D048 6528

To claim this, I am signing this object:

Deploying Elixir and Phoenix applications using Docker and Exrm

Goal

By the end of this quick guide, you will know how to compile a Phoenix app release using Exrm and run it inside a Docker container. I've found only a couple of articles that discuss getting an Elixir app up and running inside a Docker container, and even those only touched on some parts of the process. The idea is that this guide will give you a full end-to-end example of how to get all the pieces and parts working together so that you are able to deploy your Phoenix application inside a Docker container.

Assumptions

  1. You already have a working Elixir environment with the Phoenix Framework installed
  2. You have at least basic working knowledge of Docker, and have installed the Docker tools onto your local environment
#!/bin/bash
echo ECS_CLUSTER=your_ecs_cluser_name > /etc/ecs/ecs.config
INSTANCE=$(curl -s http://169.254.169.254/latest/meta-data/instance-id)
hostname $INSTANCE
sed -i.bak "s/\\(HOSTNAME=\\).*/\\1$INSTANCE/" /etc/sysconfig/network
# https://aws.amazon.com/blogs/compute/using-amazon-efs-to-persist-data-from-amazon-ecs-containers/
yum -y install jq
#!/bin/bash
export MIX_ENV=${MIX_ENV:-prod}
if [ -f /.dockerenv ]; then
# We are inside a docker container, so lets build a release
if [ -n "${APP_NAME:+set}" ]; then
echo ">>> BUILDING $APP_NAME <<<"
mix release --env=$MIX_ENV --name=$APP_NAME
else
@brienw
brienw / can0_setup.md
Last active November 29, 2017 09:17
Quick notes on the Nerves setup steps to enable an mcp2515 can controller on an rpi3

can0 setup

(for mcp2515 controller like the PiCAN2)

  1. fork (or clone) nerves_system_rpi3 locally into the parent directory of your project

  2. edit mix.exs and change the nerves_system_rpi3 lines to point to your local one:

     def system("rpi3"), do: [{:nerves_system_rpi3, path: "../nerves_system_rpi3", runtime: false}]
    
  3. mix deps.get

  4. mkdir config/rpi3 to set up a place to store some customized rpi configs