What is the current behavior?
While provisioning a machine works alright, the Nginx service isn't enabled so it isn't registered to start on boot. I also noticed Nginx isn't started with the default settings (no modifications made to group_vars). It results in Connection Refused:
❯ curl 192.168.50.5
curl: (7) Failed to connect to 192.168.50.5 port 80: Connection refused
I wanted to confirm this was intentional before I started working on it as it's been a minute since I've done any Trellis work!
What is the expected or desired behavior?
Nginx is started and connections to port 80 are available.
(delete this section if not applicable)
Please provide steps to reproduce, including full log output:
vagrant upPlease describe your local environment:
OS: macOS 10.13.4
Vagrant version: 2.0.3
Where did the bug happen? Development or remote servers?
Development
Please provide a repository or your wordpress_sites config (if possible):
It's the default.
Is there a related Discourse thread or were any utilized (please link them)?
N/A
I tried another approach of changing the development URL to see what would happen. This has nginx start after a provision. Unfortunately, nginx still isn't enabled so it doesn't survive restarts.
vagrant@example:~$ sudo service nginx status
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Docs: man:nginx(8)
Wow, thanks for bringing more attention to this.
Also at https://discourse.roots.io/t/nginx-restart/12287
On server just a few months old I see that nginx is enabled to start on reboot.
$ lsb_release -a
Description: Ubuntu 16.04.3 LTS
$ sudo systemctl is-enabled nginx
enabled
On a new VM and a new server at DigitalOcean I see that nginx is no longer enabled to start on reboot.
$ lsb_release -a
Description: Ubuntu 16.04.4 LTS
$ sudo systemctl is-enabled nginx
disabled
I believe adding this to the end of roles/nginx/tasks/main.yml would resolve it:
- name: Enable Nginx to start on boot
service:
name: nginx
enabled: yes
state: started
use: service
ansible/ansible-modules-core#3764 led me to ansible/ansible#22303.
Related: geerlingguy/ansible-role-nginx#151
⚠️ Needs testing (e.g., on older Ubuntu 16.04.x and on various Ansible versions)
As for the failed curl 192.168.50.5 I think it's just because site_hosts doesn't include the IP.
Hi @fullyint,
it seems you did the magic happens. It works:
vagrant@blog:~$ sudo systemctl is-enabled nginx
enabled
What's super weird is that I've looked at older installations of Trellis on my machine and it doesn't look like the nginx service was ever enabled. Not since Sep 2016, anyway! Something else must have been enabling the service.
Just ran into this - perhaps related to changes in the most recent bento box https://github.com/chef/bento/blob/master/CHANGELOG.md#201803240-2018-03-24
Thanks for the quick fix!
Thanks for the quick fix @fullyint!
Most helpful comment
Wow, thanks for bringing more attention to this.
Also at https://discourse.roots.io/t/nginx-restart/12287
On server just a few months old I see that
nginxis enabled to start on reboot.On a new VM and a new server at DigitalOcean I see that
nginxis no longer enabled to start on reboot.I believe adding this to the end of
roles/nginx/tasks/main.ymlwould resolve it:ansible/ansible-modules-core#3764 led me to ansible/ansible#22303.
Related: geerlingguy/ansible-role-nginx#151
⚠️ Needs testing (e.g., on older Ubuntu 16.04.x and on various Ansible versions)
As for the failed
curl 192.168.50.5I think it's just becausesite_hostsdoesn't include the IP.