All Projects → danschultzer → Ansible Phoenix Build

danschultzer / Ansible Phoenix Build

Licence: mit
Sample app with full build and deploy setup of a Phoenix app using ansible

Programming Languages

elixir
2628 projects

Projects that are alternatives of or similar to Ansible Phoenix Build

Ansible Elixir Playbooks
Ansible playbooks for Elixir build server and Phoenix Website. Sample app here: https://github.com/LunarLogic/phoenix_website
Stars: ✭ 39 (-33.9%)
Mutual labels:  ansible, phoenix
Opsmanage
自动化运维平台: 代码及应用部署CI/CD、资产管理CMDB、计划任务管理平台、SQL审核|回滚、任务调度、站内WIKI
Stars: ✭ 2,849 (+4728.81%)
Mutual labels:  ansible, deploy
Deploy
Ansible role to deploy scripting applications like PHP, Python, Ruby, etc. in a capistrano style
Stars: ✭ 2,141 (+3528.81%)
Mutual labels:  ansible, deploy
Unity Actions
Github actions for testing and building Unity projects
Stars: ✭ 358 (+506.78%)
Mutual labels:  build, deploy
Pm2
Node.js Production Process Manager with a built-in Load Balancer.
Stars: ✭ 36,126 (+61130.51%)
Mutual labels:  deploy, production
Flubucore
A cross platform build and deployment automation system for building projects and executing deployment scripts using C# code.
Stars: ✭ 695 (+1077.97%)
Mutual labels:  build, deploy
unity-test-runner
Run tests for any Unity project
Stars: ✭ 134 (+127.12%)
Mutual labels:  build, deploy
Ansible Phoenix
[Unmaintained] Develop and deploy a Phoenix app using Ansible!
Stars: ✭ 37 (-37.29%)
Mutual labels:  ansible, phoenix
Ansible Role Packer rhel
Ansible Role - Packer RHEL/CentOS Configuration for Vagrant VirtualBox
Stars: ✭ 45 (-23.73%)
Mutual labels:  build, ansible
Hkube
Kubernetes cluster deployment to Hetzner Cloud
Stars: ✭ 55 (-6.78%)
Mutual labels:  ansible
Ansible Osx Command Line Tools
An Ansible role for installing OS X Command Line Tools
Stars: ✭ 57 (-3.39%)
Mutual labels:  ansible
Kubernetes Ansible
Deploy Kubernetes with ansible
Stars: ✭ 53 (-10.17%)
Mutual labels:  ansible
Habits
An Elixir/Phoenix app for tracking daily habits, ready to deploy to Heroku.
Stars: ✭ 55 (-6.78%)
Mutual labels:  phoenix
Tahrir
Pyramid app for issuing your own Open Badges
Stars: ✭ 57 (-3.39%)
Mutual labels:  ansible
Ansible Role Memcached
Ansible Role - Memcached
Stars: ✭ 54 (-8.47%)
Mutual labels:  ansible
Ansible Role Visual Studio Code
Ansible role for installing the Visual Studio Code IDE
Stars: ✭ 58 (-1.69%)
Mutual labels:  ansible
Ansible Role Nvm
Installs NVM & Node.js on Debian/Ubuntu and RHEL/CentOS
Stars: ✭ 52 (-11.86%)
Mutual labels:  ansible
Molior
Molior - Debian Build System
Stars: ✭ 53 (-10.17%)
Mutual labels:  build
Rsync Deployments
GitHub Action for deploying code via rsync over ssh
Stars: ✭ 59 (+0%)
Mutual labels:  deploy
Ansible Role Gitea
Ansible role to deploy a Gitea instance
Stars: ✭ 58 (-1.69%)
Mutual labels:  ansible

CircleCI Blog post

Ansible Phoenix Build

This 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.

Commands

A set of binaries have been added to the bin/ directory.

Command What it does
bin/update-docker-image Builds and pushes the docker container used for building the Phoenix app.
bin/build Builds a release of the app.
bin/prepare-deploy-docker Prepare the docker container for deploy. This is only necessary for contained test of this repo.
bin/deploy Deploys a release of the app (to the docker image).

Vault pass

.ansible/.vault_pass.txt needs the following content for you to be able to run builds (this is obviously just for demo data):

ciloPBJybrzq51S7Sl3c0t6MjAAQhKn/FXJBRP3JM1YL9VSlTvcwP4GJa82ip83Q
s2uJGdPt9Edt4kqQa9PCEDz8ab2uJ3CMfuLw6BWiQmbiaDRNKZFs7P6i4/5txpcz
ppGE/IZaX4sdwM+DFyXnHfzLDRxmEmf7Jmlhcb1icqc3jbsvHQwKe0L+Sk2qyTs4
MZHca7cTI+247BrWuGqKMsxnpSHB8zuHCGqCAkwM1rSa9VQDbvSS9hH+TEg2ciXR
DWSrmiR3A3wdMsmdg/JxyOi2I4JAVp7mWkgH4clxVYlVru+nmVW9/14fv7kJnhxj
1cHUCAcGkDvbmP7ECqau9vlbhDBLCczbUDR4yY4Cw9zhJK5oJAZHIA==

Run build locally

You can run the build locally by doing the following:

docker attach ansible_phoenix_build_build_server
cd build/_build/prod/rel/ansible_phoenix_build
bin/ansible_phoenix_build start

Note 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.

Now you can start the server in the container with:

docker attach example.com
cd /u/apps/ansible_phoenix_build/current
bin/ansible_phoenix_build start

The 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.

Deploy to remote server

I recommend you to follow the blog post guide but you will be able to use this repo to deploy to a remote server.

  1. Search and replace example.com with your actual host name (both file name, and in files)

  2. Set up a deploy user on your remote host

  3. Create the deploy directory with mkdir -p /u/apps/ansible_phoenix_build/releases

  4. Make the directory writeable for the deploy user with: chown -R deploy /u/apps/ansible_phoenix_build

  5. Permit deploy user to run sudo /bin/systemctl restart ansible_phoenix_build.

  6. Add the following systemd configuration to /etc/systemd/system/ansible_phoenix_build.service:

    [Unit]
    Description=Server for ansible_phoenix_build
    Wants=postgres.service
    After=postgres.service
    After=syslog.target
    After=network.target
    
    [Service]
    Type=simple
    User=deploy
    Group=deploy
    WorkingDirectory=/u/apps/ansible_phoenix_build/current
    ExecStart=/u/apps/ansible_phoenix_build/current/bin/ansible_phoenix_build start
    KillMode=process
    Restart=on-failure
    SuccessExitStatus=143
    TimeoutSec=10
    RestartSec=5
    SyslogIdentifier=ansible_phoenix_build
    
    [Install]
    WantedBy=multi-user.target
    

You'll be able to deploy to your remote server now!

To use the bin/deploy command, remove the --user and --connection arguments.

Notes

  • Local deploys goes to the docker container
  • CI deploys goes to localhost

LICENSE

(The MIT License)

Copyright (c) 2017-2019 Dan Schultzer & the Contributors

Permission 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:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE 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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].