Powered by AppSignal & Oban Pro

Deployment

exercises/deployment.livemd

Deployment

Mix.install([
  {:jason, "~> 1.4"},
  {:kino, "~> 0.8.0", override: true},
  {:youtube, github: "brooklinjazz/youtube"},
  {:hidden_cell, github: "brooklinjazz/hidden_cell"}
])

Navigation

Return Home Report An Issue

Deploy

Use Fly.io to deploy your Blog or capstone project.

At the time of writing, Fly.io allows you to have two free apps. If you choose to deploy your Blog project, then you may have to pay a fee to deploy your capstone project.

Setup Continuous Integration

Use GitHub Actions to setup a CI system that will automatically run tests whenever you make a PR to the Blog project.

Setup Continuous Deployment System

Use GitHub Actions to setup a CD system with Fly.io that will automatically deploy your project whenever you merge a PR to the main branch.

Bonus: Production Seeds

Create a module that will seed your production database with data. Open the IEx shell in your production application and use the module to seed your production database.

Bonus: CI Check

Add the following steps to your CI process.

Code formatting:

Run mix format --check-formatted

Check warnings as errors:

mix compile --warnings-as-errors

Bonus: Credo CI

Add Credo to your project and configure it with your continuous integration system.

Bonus: Dialyzer CI

Add Dialyzer to your project and configure it with your continuous integration system.

Mark As Completed

file_name = Path.basename(Regex.replace(~r/#.+/, __ENV__.file, ""), ".livemd")

save_name =
  case Path.basename(__DIR__) do
    "reading" -> "deployment_reading"
    "exercises" -> "deployment_exercise"
  end

progress_path = __DIR__ <> "/../progress.json"
existing_progress = File.read!(progress_path) |> Jason.decode!()

default = Map.get(existing_progress, save_name, false)

form =
  Kino.Control.form(
    [
      completed: input = Kino.Input.checkbox("Mark As Completed", default: default)
    ],
    report_changes: true
  )

Task.async(fn ->
  for %{data: %{completed: completed}} <- Kino.Control.stream(form) do
    File.write!(
      progress_path,
      Jason.encode!(Map.put(existing_progress, save_name, completed), pretty: true)
    )
  end
end)

form

Commit Your Progress

Run the following in your command line from the curriculum folder to track and save your progress in a Git commit. Ensure that you do not already have undesired or unrelated changes by running git status or by checking the source control tab in Visual Studio Code.

$ git checkout -b deployment-exercise
$ git add .
$ git commit -m "finish deployment exercise"
$ git push origin deployment-exercise

Create a pull request from your deployment-exercise branch to your solutions branch. Please do not create a pull request to the DockYard Academy repository as this will spam our PR tracker.

DockYard Academy Students Only:

Notify your teacher by including @BrooklinJazz in your PR description to get feedback. You (or your teacher) may merge your PR into your solutions branch after review.

If you are interested in joining the next academy cohort, sign up here to receive more news when it is available.

Up Next

Previous Next
BookSearch: Deployment Group Project: Presentation