{"id":15370120,"url":"https://github.com/danschultzer/ansible-phoenix-build","last_synced_at":"2025-04-15T13:52:28.355Z","repository":{"id":27257679,"uuid":"112948915","full_name":"danschultzer/ansible-phoenix-build","owner":"danschultzer","description":"Sample app with full build and deploy setup of a Phoenix app using ansible","archived":false,"fork":false,"pushed_at":"2023-01-03T15:14:59.000Z","size":736,"stargazers_count":62,"open_issues_count":13,"forks_count":8,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-28T20:46:20.062Z","etag":null,"topics":["ansible","build","deploy","distillery","elixir","phoenix","production"],"latest_commit_sha":null,"homepage":"https://dreamconception.com/tech/phoenix-automated-build-and-deploy-made-simple/","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danschultzer.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}},"created_at":"2017-12-03T17:37:56.000Z","updated_at":"2024-09-25T12:26:10.000Z","dependencies_parsed_at":"2022-08-07T12:15:48.522Z","dependency_job_id":null,"html_url":"https://github.com/danschultzer/ansible-phoenix-build","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/danschultzer%2Fansible-phoenix-build","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danschultzer%2Fansible-phoenix-build/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danschultzer%2Fansible-phoenix-build/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danschultzer%2Fansible-phoenix-build/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danschultzer","download_url":"https://codeload.github.com/danschultzer/ansible-phoenix-build/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249085474,"owners_count":21210267,"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","build","deploy","distillery","elixir","phoenix","production"],"created_at":"2024-10-01T13:39:59.967Z","updated_at":"2025-04-15T13:52:28.335Z","avatar_url":"https://github.com/danschultzer.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![CircleCI](https://circleci.com/gh/danschultzer/ansible-phoenix-build.svg?style=svg)](https://circleci.com/gh/danschultzer/ansible-phoenix-build) [Blog post](https://dreamconception.com/tech/phoenix-automated-build-and-deploy-made-simple/)\n\n# Ansible Phoenix Build\n\nThis sample repo is configured for production-ready build and deploy cycle. It contains an ansible setup that will maintain docker image, build phoenix app in docker image, and do automated versioned releases on your production server.\n\n## Commands\n\nA set of binaries have been added to the [`bin/`](bin/) directory.\n\n| Command                     | What it does |\n| --------------------------- | ------------ |\n| `bin/update-docker-image`   | Builds and pushes the docker container used for building the Phoenix app. |\n| `bin/build`                 | Builds a release of the app. |\n| `bin/prepare-deploy-docker` | Prepare the docker container for deploy. This is only necessary for contained test of this repo. |\n| `bin/deploy`                | Deploys a release of the app (to the docker image). |\n\n## Vault pass\n\n`.ansible/.vault_pass.txt` needs the following content for you to be able to run builds (this is obviously just for demo data):\n\n```text\nciloPBJybrzq51S7Sl3c0t6MjAAQhKn/FXJBRP3JM1YL9VSlTvcwP4GJa82ip83Q\ns2uJGdPt9Edt4kqQa9PCEDz8ab2uJ3CMfuLw6BWiQmbiaDRNKZFs7P6i4/5txpcz\nppGE/IZaX4sdwM+DFyXnHfzLDRxmEmf7Jmlhcb1icqc3jbsvHQwKe0L+Sk2qyTs4\nMZHca7cTI+247BrWuGqKMsxnpSHB8zuHCGqCAkwM1rSa9VQDbvSS9hH+TEg2ciXR\nDWSrmiR3A3wdMsmdg/JxyOi2I4JAVp7mWkgH4clxVYlVru+nmVW9/14fv7kJnhxj\n1cHUCAcGkDvbmP7ECqau9vlbhDBLCczbUDR4yY4Cw9zhJK5oJAZHIA==\n```\n\n## Run build locally\n\nYou can run the build locally by doing the following:\n\n```bash\ndocker attach ansible_phoenix_build_build_server\ncd build/_build/prod/rel/ansible_phoenix_build\nbin/ansible_phoenix_build start\n```\n\nNote that you'll need a database server to connect to. The easiest way if you're using postgres is to just run `sh bin/prepare-deploy-docker` to prepare a docker container with a postgres server and database. It'll set up a new container with the name `example.com`, so you will have to run `bin/deploy` to add the build.\n\nNow you can start the server in the container with:\n\n```bash\ndocker attach example.com\ncd /u/apps/ansible_phoenix_build/current\nbin/ansible_phoenix_build start\n```\n\nThe `bin/prepare-deploy-docker` script ensures that the docker container is accessible on port 4000, so you should be able to visit http://localhost:4000 now.\n\n## Deploy to remote server\n\nI recommend you to follow the [blog post guide](https://dreamconception.com/tech/phoenix-automated-build-and-deploy-made-simple/) but you will be able to use this repo to deploy to a remote server.\n\n1. Search and replace `example.com` with your actual host name (both file name, and in files)\n2. Set up a `deploy` user on your remote host\n3. Create the deploy directory with `mkdir -p /u/apps/ansible_phoenix_build/releases`\n4. Make the directory writeable for the deploy user with: `chown -R deploy /u/apps/ansible_phoenix_build`\n5. Permit `deploy` user to run `sudo /bin/systemctl restart ansible_phoenix_build`.\n6. Add the following systemd configuration to `/etc/systemd/system/ansible_phoenix_build.service`:\n\n    ```ini\n    [Unit]\n    Description=Server for ansible_phoenix_build\n    Wants=postgres.service\n    After=postgres.service\n    After=syslog.target\n    After=network.target\n\n    [Service]\n    Type=simple\n    User=deploy\n    Group=deploy\n    WorkingDirectory=/u/apps/ansible_phoenix_build/current\n    ExecStart=/u/apps/ansible_phoenix_build/current/bin/ansible_phoenix_build start\n    KillMode=process\n    Restart=on-failure\n    SuccessExitStatus=143\n    TimeoutSec=10\n    RestartSec=5\n    SyslogIdentifier=ansible_phoenix_build\n\n    [Install]\n    WantedBy=multi-user.target\n    ```\n\nYou'll be able to deploy to your remote server now!\n\nTo use the `bin/deploy` command, remove the `--user` and `--connection` arguments.\n\n## Notes\n\n- Local deploys goes to the docker container\n- CI deploys goes to localhost\n\n## LICENSE\n\n(The MIT License)\n\nCopyright (c) 2017-2019 Dan Schultzer \u0026 the Contributors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanschultzer%2Fansible-phoenix-build","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanschultzer%2Fansible-phoenix-build","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanschultzer%2Fansible-phoenix-build/lists"}