Skip to content

Instantly share code, notes, and snippets.

View thbar's full-sized avatar

Thibaut Barrère thbar

View GitHub Profile
@thbar
thbar / ansible-bootstrap-ubuntu-16.04.yml
Created April 25, 2018 13:21 — forked from gwillem/ansible-bootstrap-ubuntu-16.04.yml
Get Ansible to work on bare Ubuntu 16.04 without python 2.7
# Add this snippet to the top of your playbook.
# It will install python2 if missing (but checks first so no expensive repeated apt updates)
# [email protected]
- hosts: all
gather_facts: False
tasks:
- name: install python 2
raw: test -e /usr/bin/python || (apt -y update && apt install -y python-minimal)
function onPageRequest(req, res) {
res.writeHead(200, {
'Content-Type': 'application/json',
"Access-Control-Allow-Origin": "*"
});
res.end(JSON.stringify(
{
@thbar
thbar / Flexible Dockerized Phoenix Deployments.md
Created August 30, 2018 16:42 — forked from jswny/Flexible Dockerized Phoenix Deployments.md
A guide to building and running zero-dependency Phoenix (Elixir) deployments with Docker. Works with Phoenix 1.2 and 1.3.

Prelude

I. Preface and Motivation

This guide was written because I don't particularly enjoy deploying Phoenix (or Elixir for that matter) applications. It's not easy. Primarily, I don't have a lot of money to spend on a nice, fancy VPS so compiling my Phoenix apps on my VPS often isn't an option. For that, we have Distillery releases. However, that requires me to either have a separate server for staging to use as a build server, or to keep a particular version of Erlang installed on my VPS, neither of which sound like great options to me and they all have the possibilities of version mismatches with ERTS. In addition to all this, theres a whole lot of configuration which needs to be done to setup a Phoenix app for deployment, and it's hard to remember.

For that reason, I wanted to use Docker so that all of my deployments would be automated and reproducable. In addition, Docker would allow me to have reproducable builds for my releases. I could build my releases on any machine that I wanted in a contai

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@thbar
thbar / phoenix_to_umbrella
Created October 30, 2018 15:59 — forked from emilsoman/phoenix_to_umbrella
How to move an existing phoenix app under an umbrella app
How to convert existing phoenix app to an umbrella app.
https://elixir-lang.slack.com/archives/phoenix/p1472921051000134
chrismccord [10:14 PM]
@alanpeabody yes, it's straightforward
[10:14]
1) mix new my_umbrella --umbrella
@thbar
thbar / main.workflow
Created January 14, 2019 08:42 — forked from jhawthorn/main.workflow
GitHub actions workflow for my static site https://github.com/jhawthorn/site-example for more
workflow "Build and deploy on push" {
on = "push"
resolves = [
"Branch master",
"Invalidate cache",
]
}
action "Build" {
uses = "docker://ruby:latest"
@thbar
thbar / README.md
Created June 29, 2019 14:48
Emulating a RasPi Utilizing QEMU
@thbar
thbar / s3-updater.rb
Created July 5, 2019 13:20 — forked from mattboldt/s3-updater.rb
Update S3 object metadata of an entire bucket using the AWS Ruby SDK
require 'aws-sdk'
require 'active_support'
require 'active_support/core_ext'
# http://docs.aws.amazon.com/sdkforruby/api/Aws/S3/Object.html#copy_to-instance_method
COPY_TO_OPTIONS = [:multipart_copy, :content_length, :copy_source_client, :copy_source_region, :acl, :cache_control, :content_disposition, :content_encoding, :content_language, :content_type, :copy_source_if_match, :copy_source_if_modified_since, :copy_source_if_none_match, :copy_source_if_unmodified_since, :expires, :grant_full_control, :grant_read, :grant_read_acp, :grant_write_acp, :metadata, :metadata_directive, :tagging_directive, :server_side_encryption, :storage_class, :website_redirect_location, :sse_customer_algorithm, :sse_customer_key, :sse_customer_key_md5, :ssekms_key_id, :copy_source_sse_customer_algorithm, :copy_source_sse_customer_key, :copy_source_sse_customer_key_md5, :request_payer, :tagging, :use_accelerate_endpoint]
Aws.config.update({
region: 'us-east-1',
credentials: Aws::Credentials.new(AWS_ACCESS_KEY, AWS_SECRET_KEY)

Using Elixir releases and multi-stage Docker files to simplify Phoenix deployment

This repo is my experiment in deploying a basic Phoenix app using the release feature from elixir 1.9 (https://elixir-lang.org/blog/2019/06/24/elixir-v1-9-0-released/) and docker, via a multi-stage Dockerfile (https://docs.docker.com/develop/develop-images/multistage-build/) leveraging bitwalker's docker images for Elixir and Phoenix.

Step 1: Install Elixir 1.9.1 (and Erlang)

The simplest way to manage Elixir versions is to use asdf.

@thbar
thbar / rails_lamby_notes.md
Created April 30, 2020 20:52 — forked from joshuap/rails_lamby_notes.md
Deploy a new Rails app to AWS Lambda using Lamby