Skip to content

Instantly share code, notes, and snippets.

Thorarinn Sigurdsson thsig

Block or report user

Report or block thsig

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@thsig
thsig / project-config.yml
Created Apr 8, 2019
Rails example - project config
View project-config.yml
kind: Project
name: vote-rails
environments:
- name: local
providers:
- name: local-kubernetes
@thsig
thsig / db-migrate.txt
Created Apr 5, 2019
Rails example - running rake db:migrate inside a container
View db-migrate.txt
$ garden run task db-migrate
Running task db-migrate 🏃
✔ frontend → Getting build status... → Done (took 0.6 sec)
✔ postgres → Getting build status... → Done (took 0.6 sec)
✔ postgres → Checking status... → Version v-4bf9f73668 already deployed
✔ db-migrate → Running → Done (took 4.2 sec)
(0.5ms) SELECT pg_try_advisory_lock(737815420147457505)
↳ /usr/local/bundle/bin/rake:23
@thsig
thsig / rails-console.txt
Created Apr 5, 2019
Rails example - running rails console inside the container
View rails-console.txt
$ garden run module frontend "rails console"
Running command rails console in module frontend 🏃
✔ frontend → Getting build status... → Done (took 0.4 sec)
Loading development environment (Rails 5.2.2.1)
irb(main):001:0> Vote.where(animal: "cat").count
(0.7ms) SELECT COUNT(*) FROM "votes" WHERE "votes"."animal" = $1 [["animal", "cat"]]
=> 6
@thsig
thsig / postgres-config.yml
Created Apr 5, 2019
Rails example - garden.yml for postgres service
View postgres-config.yml
kind: Module
description: Postgres container for storing voting results
type: container
name: postgres
image: postgres:9.4
Services:
- name: postgres
volumes: # A persistent volume for the data.
- name: data
containerPath: /db-data
@thsig
thsig / frontend-tasks.yml
Created Apr 5, 2019
Rails example - task config for frontend
View frontend-tasks.yml
tasks:
- name: db-migrate
args: [rake db:migrate]
dependencies:
- postgres
@thsig
thsig / frontend-service-config.yml
Created Apr 5, 2019
Rails example - service config for frontend
View frontend-service-config.yml
services:
- name: frontend
ports:
- name: http # Maps 80 to 3000.
containerPort: 3000
ingresses:
- path: /
port: http
hostname: vote-rails.local.app.garden
dependencies:
@thsig
thsig / frontend-hot-reload.yml
Created Apr 5, 2019
Rails example - hot reload config for frontend service
View frontend-hot-reload.yml
hotReload:
sync:
- source: app/
target: /usr/src/app/app
@thsig
thsig / frontend-garden.yml
Last active Apr 9, 2019
Rails example - config for frontend service
View frontend-garden.yml
kind: Module
type: container
name: frontend
description: Front-end Rails service
...
@thsig
thsig / garden-dev.txt
Last active Apr 5, 2019
Rails example - garden dev log output
View garden-dev.txt
$ garden dev --hot=frontend
Good morning! Let's get your environment wired up...
✔ local-kubernetes → Configured
✔ tiller → Installing to garden-system... → Done (took 5.9 sec)
ℹ tiller → Service deployed
ℹ tiller → Service deployed
✔ kubernetes-dashboard → Building version v-4f7ba3eeaf... → Done (took 1.5 sec)
✔ ingress-controller → Building version v-df47c0150b... → Done (took 1.5 sec)
@thsig
thsig / git-open
Created Mar 27, 2018
Simple script for viewing a file at a given commit/branch Github.com
View git-open
#!/usr/bin/env ruby
usage_description = """Usage:
github-open <commit> [<path> [<line-number>]]
Uses the <origin> remote's URL, and assumes that it's a Github repo.
"""
args = ARGV
You can’t perform that action at this time.