{"id":20698002,"url":"https://github.com/fly-apps/hello_elixir","last_synced_at":"2025-04-22T21:29:33.328Z","repository":{"id":44409404,"uuid":"361903309","full_name":"fly-apps/hello_elixir","owner":"fly-apps","description":"An example for building and deploying an Elixir application to Fly using a Dockerfile","archived":false,"fork":false,"pushed_at":"2024-03-07T00:07:38.000Z","size":311,"stargazers_count":49,"open_issues_count":0,"forks_count":23,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-29T19:02:07.960Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fly-apps.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-04-26T21:51:14.000Z","updated_at":"2025-03-21T15:28:51.000Z","dependencies_parsed_at":"2024-02-21T04:32:02.069Z","dependency_job_id":"20ab9642-32e4-42e8-bcdf-3b769799a3c0","html_url":"https://github.com/fly-apps/hello_elixir","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fly-apps%2Fhello_elixir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fly-apps%2Fhello_elixir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fly-apps%2Fhello_elixir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fly-apps%2Fhello_elixir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fly-apps","download_url":"https://codeload.github.com/fly-apps/hello_elixir/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250327804,"owners_count":21412503,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-17T00:21:33.871Z","updated_at":"2025-04-22T21:29:33.306Z","avatar_url":"https://github.com/fly-apps.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HelloElixir!\n\nThis is an example project demonstrating how to deploy an Elixir and Phoenix application on Fly.io.\n\nThis was created using `mix phx.new hello_elixir` with the following versions:\n\n- erlang - 26.2.2\n- elixir - 1.16.1-otp-26\n- phoenix - 1.7.11\n\n## Deploy steps\n\nInstall [`flyctl`](https://fly.io/docs/hands-on/install-flyctl/), the command line interface we use for controlling our application.\n\nWith the `fly` command available, we launch!\n\n```\nfly launch\n```\n\nOutput:\n```\nScanning source code\nResolving Hex dependencies...\nResolution completed in 0.114s\nUnchanged:\n  bandit 1.2.3\n  ...\n  websock_adapter 0.5.5\nAll dependencies are up to date\nDetected a Phoenix app\nCreating app in /home/user/hello_elixir\nWe're about to launch your Phoenix app on Fly.io. Here's what you're getting:\n\nOrganization: Your Name                 (fly launch defaults to the personal org)\nName:         hello-elixir              (derived from your directory name)\nRegion:       San Jose, California (US) (this is the fastest region for you)\nApp Machines: shared-cpu-1x, 1GB RAM    (most apps need about 1GB of RAM)\nPostgres:     \u003cnone\u003e                    (not requested)\nRedis:        \u003cnone\u003e                    (not requested)\n\n? Do you want to tweak these settings before proceeding? Yes\nOpening https://fly.io/cli/launch/d0ec26d8b93c3ce8efe94855b1ea ...\n```\n\nIf you want a Postgres database, answer \"yes\" to tweak the settings. You'll be taken to a webpage where you can change the selections.\n\nAfter the process completes, your app is launched!\n\n## Clustering\n\nA recently generated Phoenix app already includes [`dns_cluster`](https://github.com/phoenixframework/dns_cluster) in the project! That means we'll already be clustering when we deploy multiple instances.\n\nBy default, the Erlang COOKIE is uniquely generated for each new build. This still allows for clustering, but we can explicitly set it to make it allow some other neat abilities.\n\nYou can read more about that in [Clustering: The Cookie Situation](https://fly.io/docs/elixir/the-basics/clustering/#the-cookie-situation).\nhttps://fly.io/docs/elixir/the-basics/clustering/#adding-dns_cluster\n\nIn our `fly.toml` file, we'll add and ENV setting for the cookie value we want to use. It looks like this:\n\n```toml\n[env]\n  RELEASE_COOKIE = \"my-app-cookie\"\n```\n\nRun `fly deploy` after setting this ENV to make it take effect.\n\n## Observer\n\nElixir and Erlang have a built-in tool called Observer that let's us explore a running system. You can read more about that in [Connecting Observer to Your App in Production](https://fly.io/docs/elixir/advanced-guides/connect-observer-to-your-app/).\n\n## Deploying\n\nOnce you've gone through the steps of `fly launch`:\n\n```\nfly deploy\n```\n\n... will deploy your changes!\n\nTo open your app in a browser:\n\n```\nfly apps open\n```\n\nTo access your Fly.io dashboard:\n\n```\nfly dashboard\n```\n\nTo access your logs locally:\n\n```\nfly logs\n```\n\n## Digging deeper\n\n### Dockerfile\n\nWhere did the Dockerfile come from?\n\nThe `fly launch` process detects our Phoenix application and runs [`mix phx.gen.release`](https://hexdocs.pm/phoenix/Mix.Tasks.Phx.Gen.Release.html#module-docker) to generate the release files and a Dockerfile, which can be further customized for the project as needed.\n\n### `fly.toml`\n\nThe `fly launch` command generates the `fly.toml` file for us. That includes the following command:\n\n```toml\n[deploy]\n  release_command = '/app/bin/migrate'\n```\n\nThis runs our migrations before starting the app on a deploy.\n\nYou can check out the `fly.example.toml` file as a reference.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffly-apps%2Fhello_elixir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffly-apps%2Fhello_elixir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffly-apps%2Fhello_elixir/lists"}