###SSH into a remote machine###
ssh user@mydomain.com
#or by ip address
ssh user@192.168.1.1
exit: exit
###Install Something###
#If it's a new server, update apt-get first thing
/*------------------------------------------ | |
Responsive Grid Media Queries - 1280, 1024, 768, 480 | |
1280-1024 - desktop (default grid) | |
1024-768 - tablet landscape | |
768-480 - tablet | |
480-less - phone landscape & smaller | |
--------------------------------------------*/ | |
@media all and (min-width: 1024px) and (max-width: 1280px) { } | |
@media all and (min-width: 768px) and (max-width: 1024px) { } |
###SSH into a remote machine###
ssh user@mydomain.com
#or by ip address
ssh user@192.168.1.1
exit: exit
###Install Something###
#If it's a new server, update apt-get first thing
packages: | |
yum: | |
gcc-c++: [] | |
make: [] | |
sources: | |
/home/ec2-user: http://download.redis.io/releases/redis-2.8.4.tar.gz | |
commands: | |
redis_build: | |
command: make | |
cwd: /home/ec2-user/redis-2.8.4 |
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
# two different ways to implement a find_or_create for Ecto | |
find_or_create_user = fn user -> | |
case Repo.all(from u in users, where: u.id == ^user.id and u.email == ^user.email) do | |
[] -> | |
%User{} | |
|> User.changeset(user) | |
|> Repo.insert!() | |
_ -> | |
IO.puts "Already inserted" |
# 1) Use VCR.use_cassette in your let block. This will use | |
# the cassette just for requests made by creating bar, not | |
# for anything else in your test. | |
let(:foo) { VCR.use_cassette("foo") { create(:bar) } } | |
it "uses foo" do | |
foo | |
end | |
# 2) Wrap the it block that uses #foo in VCR.use_cassette. |
If you want a run-down of the 1.3 changes and the design decisions behidn those changes, check out the LonestarElixir Phoenix 1.3 keynote: https://www.youtube.com/watch?v=tMO28ar0lW8
To use the new phx.new
project generator, you can install the archive with the following command:
$ mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez
Phoenix v1.3.0 is a backwards compatible release with v1.2.x. To upgrade your existing 1.2.x project, simply bump your phoenix dependency in mix.exs
:
# A virtualenv running Python3.6 on Amazon Linux/EC2 (approximately) simulates the Python 3.6 Docker container used by Lambda | |
# and can be used for developing/testing Python 3.6 Lambda functions | |
# This script installs Python 3.6 on an EC2 instance running Amazon Linux and creates a virtualenv running this version of Python | |
# This is required because Amazon Linux does not come with Python 3.6 pre-installed | |
# and several packages available in Amazon Linux are not available in the Lambda Python 3.6 runtime | |
# The script has been tested successfully on a t2.micro EC2 instance (Root device type: ebs; Virtualization type: hvm) | |
# running Amazon Linux AMI 2017.03.0 (HVM), SSD Volume Type - ami-c58c1dd3 | |
# and was developed with the help of AWS Support |
# Install Git needed for Git based gems | |
packages: | |
yum: | |
git: [] | |
#!/usr/bin/env ruby | |
require 'rest-client' | |
require 'time' | |
require 'json' | |
require 'bundler' | |
CHECK_GEMS_BEFORE = Time.parse("Feb 8, 2015") | |
def check_bundler |