Hello World
hashnuke / ansible-elixir-stack Goto Github PK
View Code? Open in Web Editor NEWAnsible role to setup server with Elixir & Postgres to deploy apps
Ansible role to setup server with Elixir & Postgres to deploy apps
What is the default password for the deployer user?
I don't see it being specified in the deployer-user.yml
task nor anywhere else in the role.
I am new to Ansible (as well as Elixir & Phoenix) and am trying to deploy my first test app to production. I tried ansible-elixir-stack and get the following error at the action deployer-user:
fatal: [*.*.*.*] => SSH Error: Permission denied (publickey,password).
while connecting to *.*.*.*
It is sometimes useful to re-run the command using -vvvv, which prints SSH debug output to help diagnose the issue.
Is there a way to skip the action: deployer-user? I already have a deployer user setup on my production server so I do not need this.
I am planning on taking a stab at adapting this for a CentOS server and wanted to get input ahead of time.
I'm planning on following yoyoclouds' blog post. It seems like that approach would also be easy to transition to Ansible 2.0's package management module in the future.
Yay/Nay/Thoughts?
I think it would be a good idea to use roles for installing Postgresql, nodejs, erlang, elixir and other dependencies. The tasks directory will also become much cleaner.
A project that does something like this is this one
If an asdf plugin is installed, setup playbook fails. Because when a plugin is already added to asdf, it exists with 1 code. It's quite annoying.
A solution may be to ignore errors in this step, but in this case the playbook will continue it's work even if asdf failed to add a plugin. What do you think? Should ansible ignore errors on this step? Would it be a good improvement?
Hi -
Curious what the license on this repository is? Happy to create PR to add the correct license file.
Thanks!
Not sure if I am doing something wrong, but using brew-installed ansible on El Capitan as well as pip-installed ansible on a Ubuntu 14.04 server, the initial setup.yml fails on an Ubuntu 15.10 target on the step for creating the PostgreSQL user.
Solution was to add a task to ensure the service is started.
The Ubuntu 16.04 LTS is released and even available as a digitalocean droplet. Also postgresql 9.5 is stable. What do you think about changing the postgresql version to 9.5? Would you like me to submit such pull request?
monit module is included within this role is a copy of the latest monit module from the ansible-modules-extras repo. Needed for a bugfix (else monit stop won't work in Ansible v1.9.2 stable release)
Hey!
I'm trying to update existing project (I received it from another developer), and I'm trying to ansible-playbook playbooks/deploy.yml
. Unfortunately, I have a problems with these lines.
TASK: [HashNuke.elixir-stack | create file] ***********************************
fatal: [162.243.77.207] => error while evaluating conditional: create_swap_file == True and swap_info.stat.exists == False
FATAL: all hosts have already failed -- aborting
What is reason for the problem?
An issue related to exrm or relx causes creating releases to error out. I've reported the issue here - bitwalker/exrm#167
Been updating details from debugging sessions and identified the problem.
It seems that node is not installed?
TASK [HashNuke.elixir-stack : set npm jobs config] *****************************
fatal: [138.68.27.79]: FAILED! => {"changed": true, "cmd": ["bash", "-lc", "npm config set jobs 1"], "delta": "0:00:00.013386", "end": "2016-08-04 11:57:42.123368", "failed": true, "rc": 127, "start": "2016-08-04 11:57:42.109982", "stderr": "bash: npm: command not found", "stdout": "", "stdout_lines": [], "warnings": []}
If a new dependency is added to mix.exs, eg:
diff --git a/mix.exs b/mix.exs
index 7f8fb0c..df627cd 100644
--- a/mix.exs
+++ b/mix.exs
@@ -35,6 +35,7 @@ defmodule HelloPhoenix.Mixfile do
{:phoenix_html, "~> 1.4"},
{:phoenix_live_reload, "~> 0.5", only: :dev},
{:cowboy, "~> 1.0"},
- {:exrm, "~> 0.18.1"}]
+ {:exrm, "~> 0.18.1"},
+ {:exprotobuf, "~> 0.11.0"}]
end
end
..and then the project is deployed without updating mix.lock
, then the NEXT deploy after that will fail:
TASK: [HashNuke.elixir-stack | clone project] *********************************
failed: [178.62.201.149] => {"failed": true}
msg: Local modifications exist in repository (force=no).
FATAL: all hosts have already failed -- aborting
PLAY RECAP ********************************************************************
to retry, use: --limit @/home/johwar/deploy.retry
178.62.201.149 : ok=9 changed=0 unreachable=0 failed=1
This is due to the Ansible 'git' task not forcing overwrites of modified files in the working tree by default. At the first deploy, mix.lock
in the working tree on the server was updated with the new dependency, meaning it's now modified compared to what's in the Git repo.. so when we deploy a second time, the 'git' task fails as above.
I've noticed that release.yml:
- when: deploy_type == "restart"
name: stop app
monit: name="{{ app_name }}" state=stopped
Then, I got this error:
TASK [HashNuke.elixir-stack : stop app] ****************************************
fatal: [x.x.x.x]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh.", "unreachable": true}
to retry, use: --limit @playbooks/setup.retry
Please advice
Have a look at following error.
TASK [HashNuke.elixir-stack : install hex] *************************************
fatal: [1.2.3.4]: FAILED! => {"changed": true, "cmd": ["bash", "-lc", "mix local.hex --force"], "delta": "0:00:00.007902", "end": "2016-07-18 02:49:50.697173", "failed": true, "rc": 127, "start": "2016-07-18 02:49:50.689271", "stderr": "bash: mix: command not found", "stdout": "", "stdout_lines": [], "warnings": []}
to retry, use: --limit @playbooks/setup.retry
PLAY RECAP *********************************************************************
1.2.3.4 : ok=52 changed=31 unreachable=0 failed=1
Refactor and test the following actions:
I've got production working great, pulling from my master branch and placed under projects on the server like so:
/home/deployer/projects/appname_web
I would also like to have staging under projects as well:
/home/deployer/projects/appname_web_staging
Unfortunately I'm getting a error on the "create release" task (see below).
I've changed the following in the staging branch files:
/config/prod.exs
url: [host: "staging.appname.com", port: 80]
app_name: appname_web_staging
repo_url: "[email protected]:company/appname.git"
git_ref: staging
app_port: 3002
domains: ["staging.appname.com"]
enable_mail_alerts: False
Here is the top part of the error I'm getting when deploying:
TASK [HashNuke.elixir-stack : create release] **********************************
task path: /usr/local/etc/ansible/roles/HashNuke.elixir-stack/tasks/release.yml:13
fatal: [IPADDRESS]: FAILED! => {"changed": true, "cmd": ["bash", "-lc", "SERVER=1 mix release"], "delta": "0:01:05.441843", "end": "2016-02-13 17:33:05.265316", "failed": true, "invocation": {"module_args": {"_raw_params": "bash -lc 'SERVER=1 mix release'", "_uses_shell": false, "chdir": "/home/deployer/projects/appname_web_staging", "creates": null, "executable": null, "removes": null, "warn": true}, "module_name": "command"}, "rc": 1, "start": "2016-02-13 17:31:59.823473", "stderr": "lib/conform/schema.ex:17: warning: redefining @doc attribute previously set at line 10\nlib/conform/translate.ex:16: warning: redefining @doc attribute previously set at line 9", "stdout": "==> connection\nCompiled lib/connection.ex\nGenerated connection app\n==> poolboy (compile)\n==> decimal\nCompiled lib/decimal.ex\nGenerated decimal app\nWARN: Missing plugins: [rebar3_hex]\n==> neotoma (compile)\n==> rebar3_hex (compile)\n==> poison\nCompiled lib/poison.ex\n
When trying to use this with a private repo I get:
TASK: [HashNuke.elixir-stack | clone project] *********************************
failed: [128.199.129.15] => {"cmd": "/usr/bin/git ls-remote '' -h refs/heads/master", "failed": true, "rc": 128}
stderr: Warning: Permanently added the RSA host key for IP address '131.103.20.167' to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
This makes sense as I have not given access to the git repo to the deployer user.
Somewhere in the workflow I need to create and upload ssh keys for the deployer user, then copy the public key in repository.
Thoughts on this?
i get following output.
TASK [HashNuke.elixir-stack : create postgres user for deployer] ***************
fatal: [1.2.3.4]: FAILED! => {"changed": false, "failed": true, "msg": "unable to connect to database: could not connect to server: No such file or directory\n\tIs the server running locally and accepting\n\tconnections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?\n"}
to retry, use: --limit @playbooks/setup.retry
PLAY RECAP *********************************************************************
1.2.3.4 : ok=37 changed=24 unreachable=0 failed=1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.