puntonim / ansible-biostar

An Ansible playbook to automatize the deployment of a Biostar-based project using Docker containers
http://painl.es/ansible-biostar/
GNU General Public License v3.0
10 stars 3 forks source link

Nginx restart #27

Closed puntonim closed 10 years ago

puntonim commented 10 years ago

After deploying, the website should be available both from the numeric IP url (like http://54.77.157.187) and the domain url (like http://staging.neurostars.org). It works for the numeric IP but it doesn't for the domain. A service nginx reload from the webapp container is required.

I tried to add:

sleep 60
service nginx restart

at the end of run-webapp.sh.j2 but it didn't work.

I suggest to add to the end main.yml the following:

Checking a website can probably be done with the uri module. Something like:

- name: Ensure the website is up and running
  uri:
    url: http://{{ ansible_ec2_public_ipv4 }}
    status_code: 200
    timeout: 300
    user: "{{ basic_auth_username }}"
    password: "{{ basic_auth_password }}"
    async: 300
    poll: 10
puntonim commented 10 years ago

Done: https://github.com/nimiq/ansible-biostar/blob/master/roles/docker_webapp/templates/run-webapp.sh.j2#L81