-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The Azavea role does not work with Ubuntu 22.04. It tries to add an nginx PPA which is not required in Jammy.
- Loading branch information
Showing
8 changed files
with
88 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
deployment/ansible/roles/model-my-watershed.nginx/defaults/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
nginx_version: "stable" | ||
nginx_delete_default_site: False |
3 changes: 3 additions & 0 deletions
3
deployment/ansible/roles/model-my-watershed.nginx/handlers/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
- name: Restart Nginx | ||
service: name=nginx state=restarted |
27 changes: 27 additions & 0 deletions
27
deployment/ansible/roles/model-my-watershed.nginx/tasks/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
- name: Install Nginx | ||
apt: pkg=nginx-full state=present | ||
|
||
- name: Delete default site | ||
file: path=/etc/nginx/sites-enabled/default state=absent | ||
register: delete_default_site | ||
when: nginx_delete_default_site | bool | ||
notify: | ||
- Restart Nginx | ||
|
||
- name: Delete default web root | ||
file: path=/var/www/html state=absent | ||
when: nginx_delete_default_site | bool and delete_default_site is changed | ||
|
||
- name: Check Nginx Upstart service definition exists | ||
stat: path=/etc/init/nginx.conf | ||
register: nginx_upstart | ||
|
||
- name: Configure Nginx log rotation | ||
template: src=logrotate_nginx.j2 dest=/etc/logrotate.d/nginx | ||
when: nginx_upstart.stat.exists | ||
|
||
- name: Configure Nginx | ||
template: src=nginx.conf.j2 dest=/etc/nginx/nginx.conf | ||
notify: | ||
- Restart Nginx |
18 changes: 18 additions & 0 deletions
18
deployment/ansible/roles/model-my-watershed.nginx/templates/logrotate_nginx.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/var/log/nginx/*.log { | ||
weekly | ||
missingok | ||
rotate 52 | ||
compress | ||
delaycompress | ||
notifempty | ||
create 0640 www-data adm | ||
sharedscripts | ||
prerotate | ||
if [ -d /etc/logrotate.d/httpd-prerotate ]; then \ | ||
run-parts /etc/logrotate.d/httpd-prerotate; \ | ||
fi \ | ||
endscript | ||
postrotate | ||
service nginx rotate >/dev/null 2>&1 | ||
endscript | ||
} |
34 changes: 34 additions & 0 deletions
34
deployment/ansible/roles/model-my-watershed.nginx/templates/nginx.conf.j2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
user www-data; | ||
worker_processes {{ ansible_processor_count }}; | ||
pid /run/nginx.pid; | ||
|
||
events { | ||
worker_connections 768; | ||
} | ||
|
||
http { | ||
sendfile on; | ||
tcp_nopush on; | ||
tcp_nodelay on; | ||
keepalive_timeout 65; | ||
types_hash_max_size 2048; | ||
|
||
server_tokens off; | ||
|
||
include /etc/nginx/mime.types; | ||
default_type application/octet-stream; | ||
|
||
access_log /var/log/nginx/access.log; | ||
error_log /var/log/nginx/error.log; | ||
|
||
gzip on; | ||
gzip_vary on; | ||
gzip_proxied any; | ||
gzip_comp_level 6; | ||
gzip_buffers 16 8k; | ||
gzip_http_version 1.1; | ||
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript; | ||
|
||
include /etc/nginx/conf.d/*.conf; | ||
include /etc/nginx/sites-enabled/*; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters