Git Product home page Git Product logo

hellophoenix's Introduction

Hello Phoenix

Code examples and demonstration apps built in Phoenix 1.3 while reading through the Phoenix Guides.

A Cheat-Sheet of Sorts

This is not a tutorial. :) I made these code examples in order to have a direct link between content in the guides and code in a working and deployed Phoenix app.

Note that while Phoenix apps are very responsive, these demo apps are deployed to free Heroku dynos which go to sleep after 30 minutes of inactivity. When you click on a demo link, there will be a delay while the dyno activates.

Contact: @smeade.

Guides

Testing

Deployment

Deploying each branch to its own Heroku app

We'll create a demo app for each branch of this repo. To do so, we need to:

  1. Tell Phoenix of the updated Heroku URL
  2. Create the Heroku application and add buildpacks
  3. Create environment variables in the new app in Heroku
  4. Add a git remote and deploy

Tell Phoenix of the updated Heroku URL

Update the host in prod.exs.

url: [scheme: "https", host: "phx-010-ecto.herokuapp.com", port: 443],

Create the Heroku application and add buildpacks

$ heroku create phx-010-ecto --buildpack "https://github.com/HashNuke/heroku-buildpack-elixir.git"
$ heroku buildpacks:add https://github.com/gjaldon/heroku-buildpack-phoenix-static.git -a phx-010-ecto

Create environment variables in Heroku

$ heroku addons:create heroku-postgresql:hobby-dev -a phx-010-ecto
$ heroku config:set POOL_SIZE=18 -a phx-010-ecto
$ mix phx.gen.secret
$ heroku config:set  -a phx-010-ecto SECRET_KEY_BASE="insertkeyhere"

Add a git remote and deploy

$ git remote add phx-010-ecto https://git.heroku.com/phx-010-ecto.git
$ git push phx-010-ecto phx-010-ecto:master
$ heroku open -a phx-010-ecto

Migrate database as required

heroku run "POOL_SIZE=2 mix ecto.migrate" -a phx-011-contexts

Learn more

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.