{"id":16573758,"url":"https://github.com/dkarter/deploy-elixir-example","last_synced_at":"2025-03-21T12:31:30.566Z","repository":{"id":42843589,"uuid":"263061984","full_name":"dkarter/deploy-elixir-example","owner":"dkarter","description":"⚙️ Automatic server provisioning and configuration for Elixir and Phoenix Deployment","archived":false,"fork":false,"pushed_at":"2024-01-09T04:13:20.000Z","size":2028,"stargazers_count":19,"open_issues_count":21,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-12T21:42:57.505Z","etag":null,"topics":["ansible","automation","configuration-management","deployment","distillery","edeliver","elixir","liveview","phoenix","pulumi"],"latest_commit_sha":null,"homepage":"https://deployelixir.xyz","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dkarter.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-11T14:12:24.000Z","updated_at":"2024-08-13T03:48:19.000Z","dependencies_parsed_at":"2023-02-05T10:46:55.289Z","dependency_job_id":null,"html_url":"https://github.com/dkarter/deploy-elixir-example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkarter%2Fdeploy-elixir-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkarter%2Fdeploy-elixir-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkarter%2Fdeploy-elixir-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkarter%2Fdeploy-elixir-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dkarter","download_url":"https://codeload.github.com/dkarter/deploy-elixir-example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221815150,"owners_count":16885130,"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":["ansible","automation","configuration-management","deployment","distillery","edeliver","elixir","liveview","phoenix","pulumi"],"created_at":"2024-10-11T21:43:00.576Z","updated_at":"2024-10-28T10:07:35.265Z","avatar_url":"https://github.com/dkarter.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Automating Elixir Deployment - Example Repo\n\n## TOC\n* [What Is This?](#what-is-this)\n* [Demo](#demo)\n* [Deployment Instructions](#deployment-instructions)\n  * [Setup Pulumi](#setup-pulumi)\n  * [Deploy Using eDeliver](#deploy-using-edeliver)\n* [Running Locally](#running-locally)\n* [About](#about)\n\n## What Is This?\nThis is a companion repository for a series of posts I wrote for the [Hashrocket](https://hashrocket.com) blog:\n\n  * [Automate Your Infrastructure with Pulumi (Part 0)](https://hashrocket.com/blog/posts/automate-your-infrastructure-with-pulumi)\n  * [Automate Your Elixir Deployments - Part 1 - Ansible](https://hashrocket.com/blog/posts/automate-your-elixir-deployments-part-1-ansible)\n  * [Automate Your Elixir Deployments - Part 2 - Distillery \u0026 eDeliver](https://hashrocket.com/blog/posts/automate-your-elixir-deployments-part-2-distillery-edeliver)\n\n\n## Demo\n[See it live!](https://deployelixir.xyz)\n\n![demo](img/deployelixir.jpg)\n\n## Deployment Instructions\n### Setup Pulumi\n\n1. Get a [Digital Ocean](lhttps://bit.ly/create-digital-ocean-account) API key\n2. Export it in your shell:\n\n   ```bash\n   export DIGITALOCEAN_TOKEN='your token.......'\n   ```\n\n3. Install dependencies:\n\n   ```bash\n   $ mix setup\n   ```\n\n4. Select a stack:\n\n   ```bash\n   $ mix pulumi stack select prod\n   ```\n\n   Look in `infra/Pulumi.prod.yaml` and change it according to your needs.\n\n   You will need a [domain name](https://www.namecheap.com/) with name servers\n   pointed at:\n\n   ```\n   ns1.digitalocean.com\n   ns2.digitalocean.com\n   ns3.digitalocean.com\n   ```\n\n   This may take a bit to propagate.\n\n\n4. Run `pulumi up`:\n\n   ```bash\n   mix pulumi up --yes\n   ```\n\n### Setup Ansible\n1. Create a vault password file:\n\n   ```bash\n   $ echo 'topsecret' \u003e ansible/.vault-password\n   ```\n\n   Replace `topsecret` with a password generated by your password manager.\n\n2. Remove existing secret files and create your own using the password you\n   specified above:\n\n   ```bash\n   $ cd ansible\n   $ rm inventories/group_vars/all/secret/all.yml\n   $ ansible-vault create inventories/group_vars/all/secret/all.yml\n   ```\n\n   It should look like this:\n\n   ```yaml\n   ---\n   secret_admin_email: admin@example.com\n   ```\n\n   Replace with your own email, save and exit the file.\n\n   Now do the same for the phoenix secrets file:\n\n   ```bash\n   $ rm inventories/group_vars/application/secret/phoenix.yml\n   $ ansible-vault create inventories/group_vars/application/secret/phoenix.yml\n   ```\n\n   It should look like this:\n\n\n   ```yaml\n   ---\n   secret_secret_key_base: 'run mix phx.gen.secret to generate'\n   secret_erlang_cookie: 'run mix phx.gen.secret to generate'\n   ```\n\n   In a separate terminal generate the secrets using `mix phx.gen.secret`, paste\n   them into the file, save and exit.\n\n3. Change directories back up to the root of the project and run:\n\n   ```bash\n   $ mix ansible\n   ```\n\n### Deploy Using eDeliver\nOnce the server is fully provisioned by Pulumi and Ansible, you should be able\nto build a release:\n\n```bash\n$ mix edeliver build release\n```\n\nThe output should look like:\n\n```\nBUILDING RELEASE OF EXAMPLE APP ON BUILD HOST\n\n-----\u003e Authorizing hosts\n-----\u003e Ensuring hosts are ready to accept git pushes\n-----\u003e Pushing new commits with git to: deploy@example.com\n-----\u003e Resetting remote hosts to 26b6853c000982d80466818c7a1028e392b60483\n-----\u003e Cleaning generated files from last build\n-----\u003e Updating git submodules\n-----\u003e Fetching / Updating dependencies\n-----\u003e Build static assets\n-----\u003e Compiling sources\n-----\u003e Generating release\n-----\u003e Copying release 0.1.0+1-26b6853 to local release store\n-----\u003e Copying example.tar.gz to release store\n\nRELEASE BUILD OF EXAMPLE WAS SUCCESSFUL!\n```\n\nCopy the release version and use it to deploy the release to production:\n\n\n```bash\n$ mix edeliver deploy release to production --version=0.1.0+1-26b6853\n```\n\nWhen the deploy is finished, restart the production release:\n\n```bash\n$ mix edeliver restart production\n```\n\n## Running Locally\nTo start your Phoenix server:\n\n  * Setup the project with `mix setup`\n  * Start Phoenix endpoint with `mix phx.server`\n\nNow you can visit [`localhost:4000`](http://localhost:4000) from your browser.\n\n## About\n[![Hashrocket logo](https://hashrocket.com/hashrocket_logo.svg)](https://hashrocket.com)\n\nDeploy Elixir Example is kindly supported by [Hashrocket, a multidisciplinary design and development consultancy](https://hashrocket.com). If you'd like to [work with us](https://hashrocket.com/contact-us/hire-us) or [join our team](https://hashrocket.com/contact-us/jobs), don't hesitate to get in touch.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdkarter%2Fdeploy-elixir-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdkarter%2Fdeploy-elixir-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdkarter%2Fdeploy-elixir-example/lists"}