Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

postgresql | create georchestra user fails #32

Open
fvanderbiest opened this issue Feb 24, 2016 · 16 comments
Open

postgresql | create georchestra user fails #32

fvanderbiest opened this issue Feb 24, 2016 · 16 comments
Assignees

Comments

@fvanderbiest
Copy link
Member

With up to date sources, and no local additions,

TASK: [postgresql | create georchestra user] ********************************** 
failed: [mygeorchestra] => {"failed": true}
msg: unable to connect to database: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?


FATAL: all hosts have already failed -- aborting

PLAY RECAP ******************************************************************** 
           to retry, use: --limit @/home/fvanderbiest/georchestra.retry

mygeorchestra              : ok=17   changed=14   unreachable=0    failed=1   

Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.
@landryb
Copy link
Member

landryb commented Feb 25, 2016

race condition again i guess, can you retry with this before the 'create georchestra user' task ?

wait_for: port=5432

should be equivalent to

wait_for: path=/var/run/postgresql/.s.PGSQL.5432 state=present

but im not sure having the socket is enough of a clue for psql being fully available.

@fvanderbiest
Copy link
Member Author

Will retry tonight on my home computer.
Works without the fix this morning on my c2c computer...

@fvanderbiest fvanderbiest self-assigned this Feb 25, 2016
@fvanderbiest
Copy link
Member Author

This did not fix it.

Looks like 8efd230 is the culprit.

@fvanderbiest
Copy link
Member Author

Seems like a vagrant-specific issue, since this fixes it:

diff --git a/playbooks/georchestra.yml b/playbooks/georchestra.yml
index 9c077d1..f58d3a0 100644
--- a/playbooks/georchestra.yml
+++ b/playbooks/georchestra.yml
@@ -83,7 +83,7 @@
     extractor_datadir: /srv/data/extractor/
     tomcat_keystore_pass: tomcatkstp
     tomcat_basedir: /srv/tomcat
-    system_locale: en_US.UTF-8
+    system_locale: fr_FR.UTF-8
     logs_basedir: /srv/log
     force_https: true
     ldapadmin_adminemail: [email protected]

@landryb
Copy link
Member

landryb commented Mar 1, 2016

That.. makes no sense to me :) If you use en_US, postgresql doesnt start in the remote VM ?

@fvanderbiest
Copy link
Member Author

right, makes no sense to me too...

@landryb
Copy link
Member

landryb commented Mar 1, 2016

oh, maybe an empty vm settings depends on the host settings, and en_US is not in the list of 'available' locales to locale_gen ?

@fvanderbiest
Copy link
Member Author

possibly

@landryb
Copy link
Member

landryb commented Mar 1, 2016

Eww, gross.. so what's the 'right' way to fix this ? Fix vagrand config/sample invocation ? The playbook ?

@landryb
Copy link
Member

landryb commented Mar 1, 2016

http://stackoverflow.com/a/34582489 seems a minimal fix, does it work for you ?

@fvanderbiest
Copy link
Member Author

Will try tonight.

@fvanderbiest
Copy link
Member Author

@Vampouille is going to have a look :-)

@fvanderbiest
Copy link
Member Author

Seems like I fixed this issue by preventing the guest ssh server to accept the LANG and LC_* environment variables from my host:

 diff --git a/Vagrantfile b/Vagrantfile
index fe33e82..3440e1d 100644
--- a/Vagrantfile
+++ b/Vagrantfile
@@ -4,6 +4,12 @@
 # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
 VAGRANTFILE_API_VERSION = "2"

+$script = <<SCRIPT
+echo configuring ssh in guest...
+sudo sed -i '/AcceptEnv/d' /etc/ssh/sshd_config
+sudo /etc/init.d/ssh restart
+SCRIPT
+
 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
   # All Vagrant configuration is done here. The most common configuration
   # options are documented and commented below. For a complete reference,
@@ -31,6 +37,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
   config.vm.define "georchestra" do |georchestra|
   end

+  config.vm.provision "shell", inline: $script
+
   config.vm.provision "ansible" do |ansible|
     # execute this playbook for vm provisioning:
     ansible.playbook = "playbooks/georchestra.yml"

For the record, here are the locales on my host:

LANG=en_US.UTF-8
LANGUAGE=en_US
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=fr_FR.UTF-8
LC_TIME=fr_FR.UTF-8
LC_COLLATE="en_US.UTF-8"
LC_MONETARY=fr_FR.UTF-8
LC_MESSAGES="en_US.UTF-8"
LC_PAPER=fr_FR.UTF-8
LC_NAME=fr_FR.UTF-8
LC_ADDRESS=fr_FR.UTF-8
LC_TELEPHONE=fr_FR.UTF-8
LC_MEASUREMENT=fr_FR.UTF-8
LC_IDENTIFICATION=fr_FR.UTF-8
LC_ALL=

... while in the box, they are:

LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

@fvanderbiest
Copy link
Member Author

An improvement over the previous patch would be:

  • run the pre-provisioning step, commenting out the AcceptEnv line
  • provision with ansible
  • post-provision step, restoring the AcceptEnv line

Opinions ?

@landryb
Copy link
Member

landryb commented May 17, 2016

http://stackoverflow.com/a/34582489 seems a minimal fix, does it work for you ?

Have you tried this instead ? Seems 'simpler' than a shell hack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants