We need to generate secret key for development environment.
mix phoenix.gen.secret
# ednkXywWll1d2svDEpbA39R5kfkc9l96j0+u7A8MgKM+pbwbeDsuYB8MP2WUW1hf
Let's generate User model and controller.
# Runs rake assets:clean | |
# Defaults to nil (no asset cleanup is performed) | |
# If you use Rails 4+ and you'd like to clean up old assets after each deploy, | |
# set this to the number of versions to keep | |
set :keep_assets, 2 | |
set :user, 'ubuntu' | |
set :pem_file, %w(/home/mayur/.ssh/pem/dev.pem) | |
set :ssh_options, { |
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.
FactoryGirl.define do | |
factory :product_with_image, parent: :product do | |
after :create do |p| | |
image = File.open("spec/support/images/image.jpg") | |
p.images.create!(attachment: image, alt: p.name) | |
end | |
end | |
end |
Steps to install and run PostgreSQL 9.2 using Homebrew (Mac OS X) | |
(if you aren't using version 9.1.5, change line 6 with the correct version) | |
1. launchctl unload -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist | |
2. mv /usr/local/var/postgres /usr/local/var/postgres91 | |
3. brew update | |
4. brew upgrade postgresql | |
5. initdb /usr/local/var/postgres -E utf8 | |
6. pg_upgrade -b /usr/local/Cellar/postgresql/9.1.5/bin -B /usr/local/Cellar/postgresql/9.2.0/bin -d /usr/local/var/postgres91 -D /usr/local/var/postgres | |
7. cp /usr/local/Cellar/postgresql/9.2.0/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/ |
require "rake" | |
task :say_hi do | |
puts "What's your name?" | |
name = $stdin.gets.chomp | |
puts "Hi #{name}!" | |
end |