Summer of Elixir - podcast mini series

We’ve been working on a ‘Summer of Elixir’ as a mini series for our podcast JavaScript to Elm. A show that usually covers, well Elm, and other functional topics from the perspective of a JS developer. The goal is to build and deploy a small application with Elixir to learn and share our experience. The first 2 episodes are available

Elixir with Phoenix #84

Elixir Deployment #85

So far it’s been pretty enjoyable, with only mild frustrations. :smile: We’d love feedback, tips, resources. Anything you’ve got that might help us along the way. Check back for new episodes until summer’s over, or we get our project built!

You can subscribe here and follow along: Podcast Feed

10 Likes

I just started listening to the Elixir Deployment podcast and noticed a mention about Google App Engine not supporting WebSockets (called sockets in the podcasts for some reason). This is already solved, see here: Elixir | Google Cloud Platform
Anyway, I am currently trying to do the same CI/CD pipeline with GCP + Kubernetes, so I am really looking forward to the rest of that episode. :slight_smile:

2 Likes

You beat me to the punch !!! Today’s episode is about that realization and transition to App Engine !!! https://jstoelm.com/episodes/e086-app-engine

Continuing the Journey !!
Elixir with App Engine #86

App-Enggine WebSocket Support As of Feb 2019, it looks like we’re good to go. That coupled with the $30/month bill we would incur when our gcp credits ran out, this switch seems to make a lot of sense.

Excellent. Adding to my podcast queue. :slight_smile:

1 Like

We’ve finally getting into some of the actual Elixir now that our CI/CD is all set up and it’s a blast!!!
Checkout the progress, and look for the full rundown about it this week.

Imgur

Jesse

3 Likes

Pretty sure I called them ‘sockets’ just of of laziness, good catch, kind of a big difference! I hope you got your pipeline up and running with GCP :crossed_fingers:

2 Likes

We are making awesome progress !! Auth with Auth0 is totally working!!! Check it out

Elixir Phoenix with Auto0 #88

You can play with it at https://postit.blog

1 Like

Trying to get my Phoenix deployment on GCP App Engine to force or redirect to the SSL connection. Currently you can connect to both http and https. I’ve seen a couple options

Using the app.yaml for gcp

//app.yaml
handlers:
- url: /.*
  script: auto
  secure: always
  redirect_http_response_code: 301

In the prod config using rewrite_on

config :postit, PostitWeb.Endpoint,
  http: [port: System.get_env("PORT") || 4000],
  # url: [host: "localhost", port: System.get_env("PORT") || 4000], # This is critical for ensuring web-sockets properly authorize.
  cache_static_manifest: "priv/static/cache_manifest.json",
  check_origin: false,
  server: true,
  root: ".",
  version: Application.spec(:postit, :vsn),
  rewrite_on: [:x_forwarded_proto]

Oh! So it looks like I am using the right value, but totally forgot the force_ssl part !

force_ssl: [ rewrite_on: [:x_forwarded_proto]]

I’ll try that and report back

Thank you! Great podcast on Elm. I put Elm on the back burner, but will look at it again.

1 Like

Just fyi, we ended up setting up our pipeline with GitHub as a repo + pull requests -> GitLab CI for CI, checks, etc. -> Gigalixir for deployment. I would love to use GitHub Actions to avoid GitLab as another layer of complexity, but unfortunately, we’re still waiting for the public beta approval or for final release. As for Gigalixir, It’s lot easier to create, scale and mainly destroy an app compared to Google App Engine.

I use Gitlab CI at work for source and all the pipeline work, it’s a really good solution. I feel you having it and github adds unwelcome overhead. Knowing what I know now about gcp app engine and where this project ended up, I too would have gone with Gigalixir to help remove a lot of the complexity around create, scale, and destroy. I just came realize I have to manually destroy old instances of app engine, maybe?

1 Like

I would absolutely take another look at Elm. It’s giving me wider exposure to static types, type theory, functional programming, and really the got me to branch out from a full stack in JavaScript. It’s a great community that I really enjoy. :smile:

Making life a little easier with ecto migrations on prod release with distillery. :+1:

release :postit do
  set version: current_version(:postit)
  set applications: [
    :runtime_tools
  ]
  set commands: [
    "migrate": "rel/commands/migrate.sh"
  ]
end
1 Like

Subscribed :slight_smile:

1 Like

We started out with plans to add some routes and additional models, but fell down the rabbit hole trying to answer this question: How do i reuse a function in multiple controllers? In this specific instance, we’ll want to secure multiple routes, but don’t want to copy / paste the secure function we have to every controller, that will get out of hand fast!

Elixir Phoenix Plugs #88

2 Likes

Turns out, this works as advertised. Doesn’t need the ‘handlers’ on the app.yaml config for App Engine on GCP.

Finally migrations in prod working. :fireworks:

A 2019-07-28T23:28:17Z Running migrations for postit
 
A 2019-07-28T23:28:17Z 2019/07/28 23:28:17 New connection for "post-it-243617:us-central1:postitdb-beta"
 
A 2019-07-28T23:28:17Z 2019/07/28 23:28:17 New connection for "post-it-243617:us-central1:postitdb-beta"
 
A 2019-07-28T23:28:18Z 23:28:18.294 [info] == Running 20190717045929 Postit.Repo.Migrations.CreatePosts.change/0 forward
 
A 2019-07-28T23:28:18Z 23:28:18.298 [info] create table posts
 
A 2019-07-28T23:28:18Z 23:28:18.371 [info] == Migrated 20190717045929 in 0.0s
2 Likes

We’ve moved on from the default Phoenix page. It served us well, the project is starting to take on some real personality. We’re just getting into the good stuff!!

2 Likes

Tackle a little bit of devs ops to start, getting Ecto migrations working on ‘post_boot’ hook on release from Distillery. With that in place we can start to dig into the domain of our application and start making some meaningful changes. Also, checkout the new styling!!!1 :heart:

Elixir Ecto Models #89

2 Likes