This config wrapper is based on the one I originally saw in https://gist.github.com/bitwalker/a4f73b33aea43951fe19b242d06da7b9.
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
defmodule YourAppName.Search do | |
# ... | |
@doc """ | |
Queries listings. | |
""" | |
def query_listings(query, current_user) do | |
default_scope = from l in Listing, where: l.draft == false or l.user_id == ^current_user.id, order_by: [desc: l.updated_at], limit: 50 | |
id = _try_integer(query) |
FROM ubuntu:16.04 | |
RUN apt-get update | |
RUN apt-get install -y git wget curl build-essential | |
RUN wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb && dpkg -i erlang-solutions_1.0_all.deb | |
RUN apt-get update | |
RUN apt-get install erlang -y | |
RUN apt-get install -y elixir | |
RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - |
Thanks for watching my talk, Domain-Driven Desire at Øredev 2016. Here's a list of resources that inspired me, and will hopefully inspire you:
Taken and modified from: https://gist.github.com/joakimk/48ed80f1a7adb5f5ea27 | |
* line 4 and 13 of circle.yml reference a script/ci structure. Modify to suit. |
#!/bin/bash | |
##################################################### | |
# Name: Bash CheatSheet for Mac OSX | |
# | |
# A little overlook of the Bash basics | |
# | |
# Usage: | |
# | |
# Author: J. Le Coupanec | |
# Date: 2014/11/04 |
# Integer vs Float div by zero gotchas | |
# | |
# | |
1 / 0 = [answer] | |
1.0 / 0 = [answer] | |
1 / 0.0 = [answer] | |
0 / 0.0 = [answer] | |
# String concatenation vs interpolation | |
x = 5 |
Background | |
Raise.com is built on top of Spree. We have in-lined spree, and have decorators | |
on the models to beat the band. We want to move away from Spree altogeher. | |
This involves taking the models from Spree, moving them to the Raise | |
base app. This merge has the potential to create lots of big classes. Big classes | |
are difficult to maintain. One of the first steps towards returning classes/models to | |
being "right sized." is splitting the business logic and the persistence. | |
What I did |
- Your class can be no longer than 100 lines of code.
- Your methods can be no longer than five lines of code.
- You can pass no more than four parameters and you can’t just make it one big hash.
- When a call comes into your Rails controller, you can only instantiate one object to do whatever it is that needs to be done. And your view can only know about one instance variable.
You can break these rules if you can talk your pair into agreeing with you.